19 #ifndef INCLUDED_CPPUHELPER_IMPLBASE_HXX
20 #define INCLUDED_CPPUHELPER_IMPLBASE_HXX
27 #include <com/sun/star/lang/XTypeProvider.hpp>
28 #include <com/sun/star/lang/XMultiServiceFactory.hpp>
62 sal_Int32 nType2Offset;
88 ClassDataBase( sal_Int32 nClassCode )
SAL_THROW(());
91 ~ClassDataBase() SAL_THROW(());
103 Type_Offset arType2Offset[1];
107 void SAL_CALL initTypeProvider() SAL_THROW(());
113 void SAL_CALL writeTypeOffset( const ::com::sun::star::uno::Type & rType, sal_Int32 nOffset )
122 ::com::sun::star::uno::Any SAL_CALL query(
123 const ::com::sun::star::uno::Type & rType, ::com::sun::star::lang::XTypeProvider * pBase )
129 ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes()
135 ::com::sun::star::uno::Sequence<
sal_Int8 > SAL_CALL getImplementationId()
151 #if defined _MSC_VER // public -> protected changes mangled names there
152 #define CPPUHELPER_DETAIL_IMPLHELPER_PROTECTED public
154 #define CPPUHELPER_DETAIL_IMPLHELPER_PROTECTED protected
170 #define __DEF_IMPLHELPER_PRE( N ) \
173 struct ClassData##N : public ClassDataBase \
175 Type_Offset arType2Offset[ N ]; \
176 ClassData##N( sal_Int32 nInClassCode ) SAL_THROW(()) \
177 : ClassDataBase( nInClassCode ) \
180 template< __CLASS_IFC##N > \
181 class SAL_NO_VTABLE SAL_DLLPUBLIC_TEMPLATE ImplHelperBase##N \
182 : public ::com::sun::star::lang::XTypeProvider \
185 CPPUHELPER_DETAIL_IMPLHELPER_PROTECTED: \
186 ~ImplHelperBase##N() throw () {} \
188 ClassData & SAL_CALL getClassData( ClassDataBase & s_aCD ) SAL_THROW(()) \
190 ClassData & rCD = * static_cast< ClassData * >( &s_aCD ); \
191 if (! rCD.bOffsetsInit) \
193 ::osl::MutexGuard aGuard( getImplHelperInitMutex() ); \
194 if (! rCD.bOffsetsInit) \
196 char * pBase = (char *)this;
199 #define __IFC_WRITEOFFSET( N ) \
200 rCD.writeTypeOffset( ::getCppuType( (const ::com::sun::star::uno::Reference< Ifc##N > *)0 ), \
201 (char *)(Ifc##N *)this - pBase );
204 #define __DEF_IMPLHELPER_POST_A( N ) \
205 rCD.bOffsetsInit = sal_True; \
211 template< __CLASS_IFC##N > \
212 class SAL_NO_VTABLE SAL_DLLPUBLIC_TEMPLATE ImplHelper##N \
213 : public ImplHelperBase##N< __IFC##N > \
215 static ClassData##N s_aCD; \
217 virtual ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type & rType ) throw (::com::sun::star::uno::RuntimeException) \
218 { return this->getClassData( s_aCD ).query( rType, (ImplHelperBase##N< __IFC##N > *)this ); } \
219 virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes() throw (::com::sun::star::uno::RuntimeException) \
220 { return this->getClassData( s_aCD ).getTypes(); } \
221 virtual ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() throw (::com::sun::star::uno::RuntimeException) \
222 { return this->getClassData( s_aCD ).getImplementationId(); } \
223 CPPUHELPER_DETAIL_IMPLHELPER_PROTECTED: \
224 ~ImplHelper##N() throw () {} \
226 template< __CLASS_IFC##N > \
227 class SAL_NO_VTABLE SAL_DLLPUBLIC_TEMPLATE WeakImplHelper##N \
228 : public ::cppu::OWeakObject \
229 , public ImplHelperBase##N< __IFC##N > \
231 static ClassData##N s_aCD; \
233 virtual ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type & rType ) throw (::com::sun::star::uno::RuntimeException) \
235 ::com::sun::star::uno::Any aRet( this->getClassData( s_aCD ).query( rType, (ImplHelperBase##N< __IFC##N > *)this ) ); \
236 return (aRet.hasValue() ? aRet : OWeakObject::queryInterface( rType )); \
238 virtual void SAL_CALL acquire() throw () \
239 { OWeakObject::acquire(); } \
240 virtual void SAL_CALL release() throw () \
241 { OWeakObject::release(); } \
242 virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes() throw (::com::sun::star::uno::RuntimeException) \
243 { return this->getClassData( s_aCD ).getTypes(); } \
244 virtual ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() throw (::com::sun::star::uno::RuntimeException) \
245 { return this->getClassData( s_aCD ).getImplementationId(); } \
247 template< __CLASS_IFC##N > \
248 class SAL_NO_VTABLE SAL_DLLPUBLIC_TEMPLATE WeakAggImplHelper##N \
249 : public ::cppu::OWeakAggObject \
250 , public ImplHelperBase##N< __IFC##N > \
252 static ClassData##N s_aCD; \
254 virtual ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type & rType ) throw (::com::sun::star::uno::RuntimeException) \
255 { return OWeakAggObject::queryInterface( rType ); } \
256 virtual ::com::sun::star::uno::Any SAL_CALL queryAggregation( const ::com::sun::star::uno::Type & rType ) throw (::com::sun::star::uno::RuntimeException) \
258 ::com::sun::star::uno::Any aRet( this->getClassData( s_aCD ).query( rType, (ImplHelperBase##N< __IFC##N > *)this ) ); \
259 return (aRet.hasValue() ? aRet : OWeakAggObject::queryAggregation( rType )); \
261 virtual void SAL_CALL acquire() throw () \
262 { OWeakAggObject::acquire(); } \
263 virtual void SAL_CALL release() throw () \
264 { OWeakAggObject::release(); } \
265 virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes() throw (::com::sun::star::uno::RuntimeException) \
266 { return this->getClassData( s_aCD ).getTypes(); } \
267 virtual ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() throw (::com::sun::star::uno::RuntimeException) \
268 { return this->getClassData( s_aCD ).getImplementationId(); } \
273 #define __DEF_IMPLHELPER_POST_B( N ) \
274 template< __CLASS_IFC##N > \
275 ClassData##N ImplHelper##N< __IFC##N >::s_aCD = ClassData##N( 0 ); \
276 template< __CLASS_IFC##N > \
277 ClassData##N WeakImplHelper##N< __IFC##N >::s_aCD = ClassData##N( 1 ); \
278 template< __CLASS_IFC##N > \
279 ClassData##N WeakAggImplHelper##N< __IFC##N >::s_aCD = ClassData##N( 2 );
282 #define __DEF_IMPLHELPER_POST_C( N ) \
287 #define __DEF_IMPLHELPER_POST( N ) \
288 __DEF_IMPLHELPER_POST_A( N ) \
289 __DEF_IMPLHELPER_POST_B( N ) \
290 __DEF_IMPLHELPER_POST_C( N )
Type description of an interface.
Definition: typedescription.h:424
#define CPPUHELPER_DLLPUBLIC
Definition: cppuhelperdllapi.h:28
unsigned char sal_Bool
Definition: types.h:46
signed char sal_Int8
Definition: types.h:51
#define SAL_THROW(exc)
Definition of function throw clause macros.
Definition: types.h:358