cppuhelper: simplify deprecated XTypeProvider.getImplementationId
Change-Id: I1e355c0ef9548d505de996304837d3d0910bd9b8
This commit is contained in:
@@ -365,16 +365,10 @@ Sequence< Type > OFactoryComponentHelper::getTypes()
|
|||||||
return Sequence< Type >( ar, m_fptr ? 4 : 3 );
|
return Sequence< Type >( ar, m_fptr ? 4 : 3 );
|
||||||
}
|
}
|
||||||
|
|
||||||
namespace
|
|
||||||
{
|
|
||||||
class theOFactoryComponentHelperImplementationId :
|
|
||||||
public rtl::Static<OImplementationId, theOFactoryComponentHelperImplementationId>{};
|
|
||||||
}
|
|
||||||
|
|
||||||
Sequence< sal_Int8 > OFactoryComponentHelper::getImplementationId()
|
Sequence< sal_Int8 > OFactoryComponentHelper::getImplementationId()
|
||||||
throw (::com::sun::star::uno::RuntimeException, std::exception)
|
throw (::com::sun::star::uno::RuntimeException, std::exception)
|
||||||
{
|
{
|
||||||
return theOFactoryComponentHelperImplementationId::get().getImplementationId();
|
return css::uno::Sequence<sal_Int8>();
|
||||||
}
|
}
|
||||||
|
|
||||||
// XSingleServiceFactory
|
// XSingleServiceFactory
|
||||||
|
@@ -22,7 +22,6 @@
|
|||||||
#include <osl/diagnose.h>
|
#include <osl/diagnose.h>
|
||||||
#include <rtl/instance.hxx>
|
#include <rtl/instance.hxx>
|
||||||
#include <rtl/string.hxx>
|
#include <rtl/string.hxx>
|
||||||
#include <rtl/uuid.h>
|
|
||||||
|
|
||||||
#include <com/sun/star/lang/XComponent.hpp>
|
#include <com/sun/star/lang/XComponent.hpp>
|
||||||
#include "com/sun/star/uno/RuntimeException.hpp"
|
#include "com/sun/star/uno/RuntimeException.hpp"
|
||||||
@@ -106,10 +105,6 @@ void ClassData::initTypeProvider() SAL_THROW(())
|
|||||||
::osl::MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() );
|
::osl::MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() );
|
||||||
if (! pTypes)
|
if (! pTypes)
|
||||||
{
|
{
|
||||||
// create id
|
|
||||||
pId = new Sequence< sal_Int8 >( 16 );
|
|
||||||
rtl_createUuid( (sal_uInt8 *)pId->getArray(), 0, sal_True );
|
|
||||||
|
|
||||||
// collect types
|
// collect types
|
||||||
Sequence< Type > * types = new Sequence< Type >(
|
Sequence< Type > * types = new Sequence< Type >(
|
||||||
nType2Offset + 1 + (nClassCode == 4 ? 2 : nClassCode) );
|
nType2Offset + 1 + (nClassCode == 4 ? 2 : nClassCode) );
|
||||||
@@ -151,9 +146,7 @@ Sequence< Type > ClassData::getTypes() SAL_THROW(())
|
|||||||
|
|
||||||
Sequence< sal_Int8 > ClassData::getImplementationId() SAL_THROW(())
|
Sequence< sal_Int8 > ClassData::getImplementationId() SAL_THROW(())
|
||||||
{
|
{
|
||||||
if (! pTypes)
|
return css::uno::Sequence<sal_Int8>();
|
||||||
initTypeProvider();
|
|
||||||
return *pId;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@@ -253,25 +253,10 @@ Any SAL_CALL ImplHelper_queryNoXInterface(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Sequence< sal_Int8 > SAL_CALL ImplHelper_getImplementationId( class_data * cd )
|
css::uno::Sequence<sal_Int8> ImplHelper_getImplementationId(
|
||||||
SAL_THROW( (RuntimeException) )
|
SAL_UNUSED_PARAMETER class_data *) SAL_THROW((css::uno::RuntimeException))
|
||||||
{
|
{
|
||||||
if (! cd->m_createdId)
|
return css::uno::Sequence<sal_Int8>();
|
||||||
{
|
|
||||||
sal_uInt8 * id = (sal_uInt8 *)alloca( 16 );
|
|
||||||
::rtl_createUuid( (sal_uInt8 *)id, 0, sal_True );
|
|
||||||
|
|
||||||
MutexGuard guard( getImplHelperInitMutex() );
|
|
||||||
if (! cd->m_createdId)
|
|
||||||
{
|
|
||||||
memcpy( cd->m_id, id, 16 );
|
|
||||||
cd->m_createdId = sal_True;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
sal_Sequence * seq = 0;
|
|
||||||
::rtl_byte_sequence_constructFromArray( &seq, cd->m_id, 16 );
|
|
||||||
return Sequence< sal_Int8 >( seq, SAL_NO_ACQUIRE );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Sequence< Type > SAL_CALL ImplHelper_getTypes(
|
Sequence< Type > SAL_CALL ImplHelper_getTypes(
|
||||||
|
@@ -74,7 +74,8 @@ struct CPPUHELPER_DLLPUBLIC ClassDataBase
|
|||||||
/** pointer to types sequence (com.sun.star.lang.XTypeProvider)
|
/** pointer to types sequence (com.sun.star.lang.XTypeProvider)
|
||||||
*/
|
*/
|
||||||
::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > * pTypes;
|
::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > * pTypes;
|
||||||
/** pointer to class id (com.sun.star.lang.XTypeProvider)
|
/** obsolete pointer to class id (com.sun.star.lang.XTypeProvider), will
|
||||||
|
always be null
|
||||||
*/
|
*/
|
||||||
::com::sun::star::uno::Sequence< sal_Int8 > * pId;
|
::com::sun::star::uno::Sequence< sal_Int8 > * pId;
|
||||||
|
|
||||||
|
@@ -175,7 +175,7 @@ public:
|
|||||||
{ return _aTypes; }
|
{ return _aTypes; }
|
||||||
};
|
};
|
||||||
|
|
||||||
/** Helper class to implement com::sun::star::lang::XTypeProvider. Construct a static object
|
/** Helper class to implement IDs for XUnoTunnel. Construct a static object
|
||||||
of this class for your UNO object's implementation id.
|
of this class for your UNO object's implementation id.
|
||||||
*/
|
*/
|
||||||
class CPPUHELPER_DLLPUBLIC OImplementationId
|
class CPPUHELPER_DLLPUBLIC OImplementationId
|
||||||
@@ -219,7 +219,7 @@ public:
|
|||||||
: _pSeq( new ::com::sun::star::uno::Sequence< sal_Int8 >( rId.getImplementationId() ) )
|
: _pSeq( new ::com::sun::star::uno::Sequence< sal_Int8 >( rId.getImplementationId() ) )
|
||||||
{}
|
{}
|
||||||
|
|
||||||
/** Called upon XTypeProvider::getImplementationId().
|
/** Get implementation id.
|
||||||
|
|
||||||
@return implementation id
|
@return implementation id
|
||||||
*/
|
*/
|
||||||
|
Reference in New Issue
Block a user