00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019 #ifndef _COM_SUN_STAR_UNO_TYPE_HXX_
00020 #define _COM_SUN_STAR_UNO_TYPE_HXX_
00021
00022 #include <osl/mutex.hxx>
00023 #include <com/sun/star/uno/Type.h>
00024 #include "cppu/unotype.hxx"
00025
00026 namespace com
00027 {
00028 namespace sun
00029 {
00030 namespace star
00031 {
00032 namespace uno
00033 {
00034
00035
00036 inline Type::Type() SAL_THROW(())
00037 {
00038 _pType = reinterpret_cast< const ::com::sun::star::uno::Type * >(
00039 ::typelib_static_type_getByTypeClass( typelib_TypeClass_VOID ) )->getTypeLibType();
00040 ::typelib_typedescriptionreference_acquire( _pType );
00041 }
00042
00043 inline Type::Type( TypeClass eTypeClass, const ::rtl::OUString & rTypeName ) SAL_THROW(())
00044 : _pType( 0 )
00045 {
00046 ::typelib_typedescriptionreference_new( &_pType, (typelib_TypeClass)eTypeClass, rTypeName.pData );
00047 }
00048
00049 inline Type::Type( TypeClass eTypeClass, const sal_Char * pTypeName ) SAL_THROW(())
00050 : _pType( 0 )
00051 {
00052 ::typelib_typedescriptionreference_newByAsciiName( &_pType, (typelib_TypeClass)eTypeClass, pTypeName );
00053 }
00054
00055 inline Type::Type( typelib_TypeDescriptionReference * pType ) SAL_THROW(())
00056 : _pType( pType )
00057 {
00058 ::typelib_typedescriptionreference_acquire( _pType );
00059 }
00060
00061 inline Type::Type( typelib_TypeDescriptionReference * pType, UnoType_NoAcquire ) SAL_THROW(())
00062 : _pType( pType )
00063 {
00064 }
00065
00066 inline Type::Type( typelib_TypeDescriptionReference * pType, __sal_NoAcquire ) SAL_THROW(())
00067 : _pType( pType )
00068 {
00069 }
00070
00071 inline Type::Type( const Type & rType ) SAL_THROW(())
00072 : _pType( rType._pType )
00073 {
00074 ::typelib_typedescriptionreference_acquire( _pType );
00075 }
00076
00077 inline ::rtl::OUString Type::getTypeName() const SAL_THROW(())
00078 {
00079 return ::rtl::OUString( _pType->pTypeName );
00080 }
00081
00082 inline Type & Type::operator = ( const Type & rType ) SAL_THROW(())
00083 {
00084 ::typelib_typedescriptionreference_assign( &_pType, rType._pType );
00085 return *this;
00086 }
00087
00088
00089 template< class T >
00090 typelib_TypeDescriptionReference * Array< T >::s_pType = 0;
00091
00092 }
00093 }
00094 }
00095 }
00096
00097 inline const ::com::sun::star::uno::Type & SAL_CALL getCppuType( SAL_UNUSED_PARAMETER const ::com::sun::star::uno::Type * ) SAL_THROW(())
00098 {
00099 return ::cppu::UnoType< ::com::sun::star::uno::Type >::get();
00100 }
00101
00102 inline const ::com::sun::star::uno::Type & SAL_CALL getCppuVoidType() SAL_THROW(())
00103 {
00104 return ::cppu::UnoType< ::cppu::UnoVoidType >::get();
00105 }
00106 inline const ::com::sun::star::uno::Type & SAL_CALL getVoidCppuType() SAL_THROW(())
00107 {
00108 return ::cppu::UnoType< ::cppu::UnoVoidType >::get();
00109 }
00110
00111 inline const ::com::sun::star::uno::Type & SAL_CALL getCppuBooleanType() SAL_THROW(())
00112 {
00113 return ::cppu::UnoType< bool >::get();
00114 }
00115 inline const ::com::sun::star::uno::Type & SAL_CALL getBooleanCppuType() SAL_THROW(())
00116 {
00117 return ::cppu::UnoType< bool >::get();
00118 }
00119 inline const ::com::sun::star::uno::Type & SAL_CALL getCppuType( SAL_UNUSED_PARAMETER const sal_Bool * ) SAL_THROW(())
00120 {
00121 return ::cppu::UnoType< bool >::get();
00122 }
00123
00124 inline const ::com::sun::star::uno::Type & SAL_CALL getCppuType(
00125 SAL_UNUSED_PARAMETER bool const * ) SAL_THROW(())
00126 {
00127 return ::cppu::UnoType< bool >::get();
00128 }
00129
00130 inline const ::com::sun::star::uno::Type & SAL_CALL getCharCppuType() SAL_THROW(())
00131 {
00132 return ::cppu::UnoType< ::cppu::UnoCharType >::get();
00133 }
00134 inline const ::com::sun::star::uno::Type & SAL_CALL getCppuCharType() SAL_THROW(())
00135 {
00136 return ::cppu::UnoType< ::cppu::UnoCharType >::get();
00137 }
00138
00139 inline const ::com::sun::star::uno::Type & SAL_CALL getCppuType( SAL_UNUSED_PARAMETER const sal_Int8 * ) SAL_THROW(())
00140 {
00141 return ::cppu::UnoType< ::sal_Int8 >::get();
00142 }
00143
00144 inline const ::com::sun::star::uno::Type & SAL_CALL getCppuType( SAL_UNUSED_PARAMETER const ::rtl::OUString * ) SAL_THROW(())
00145 {
00146 return ::cppu::UnoType< ::rtl::OUString >::get();
00147 }
00148
00149 inline const ::com::sun::star::uno::Type & SAL_CALL getCppuType( SAL_UNUSED_PARAMETER const sal_Int16 * ) SAL_THROW(())
00150 {
00151 return ::cppu::UnoType< ::sal_Int16 >::get();
00152 }
00153
00154 inline const ::com::sun::star::uno::Type & SAL_CALL getCppuType( SAL_UNUSED_PARAMETER const sal_uInt16 * ) SAL_THROW(())
00155 {
00156 return ::cppu::UnoType< ::cppu::UnoUnsignedShortType >::get();
00157 }
00158
00159 inline const ::com::sun::star::uno::Type & SAL_CALL getCppuType( SAL_UNUSED_PARAMETER const sal_Int32 * ) SAL_THROW(())
00160 {
00161 return ::cppu::UnoType< ::sal_Int32 >::get();
00162 }
00163
00164 inline const ::com::sun::star::uno::Type & SAL_CALL getCppuType( SAL_UNUSED_PARAMETER const sal_uInt32 * ) SAL_THROW(())
00165 {
00166 return ::cppu::UnoType< ::sal_uInt32 >::get();
00167 }
00168
00169 inline const ::com::sun::star::uno::Type & SAL_CALL getCppuType( SAL_UNUSED_PARAMETER const sal_Int64 * ) SAL_THROW(())
00170 {
00171 return ::cppu::UnoType< ::sal_Int64 >::get();
00172 }
00173
00174 inline const ::com::sun::star::uno::Type & SAL_CALL getCppuType( SAL_UNUSED_PARAMETER const sal_uInt64 * ) SAL_THROW(())
00175 {
00176 return ::cppu::UnoType< ::sal_uInt64 >::get();
00177 }
00178
00179 inline const ::com::sun::star::uno::Type & SAL_CALL getCppuType( SAL_UNUSED_PARAMETER const float * ) SAL_THROW(())
00180 {
00181 return ::cppu::UnoType< float >::get();
00182 }
00183
00184 inline const ::com::sun::star::uno::Type & SAL_CALL getCppuType( SAL_UNUSED_PARAMETER const double * ) SAL_THROW(())
00185 {
00186 return ::cppu::UnoType< double >::get();
00187 }
00188
00189 template< class T >
00190 inline const ::com::sun::star::uno::Type & SAL_CALL getCppuArrayType1( T * pT ) SAL_THROW(())
00191 {
00192 if (! ::com::sun::star::uno::Array< T >::s_pType)
00193 {
00194 const ::com::sun::star::uno::Type & rElementType =
00195 ::cppu::getTypeFavourUnsigned( *pT );
00196 sal_Int32 size = sizeof( **pT );
00197 sal_Int32 dim1 = sizeof( *pT ) / size;
00198 ::typelib_static_array_type_init(
00199 & ::com::sun::star::uno::Array< T >::s_pType, rElementType.getTypeLibType(),
00200 1, dim1 );
00201 }
00202 return * reinterpret_cast< const ::com::sun::star::uno::Type * >(
00203 & ::com::sun::star::uno::Array< T >::s_pType );
00204 }
00205
00206 template< class T >
00207 inline const ::com::sun::star::uno::Type & SAL_CALL getCppuArrayType2( T * pT ) SAL_THROW(())
00208 {
00209 if (! ::com::sun::star::uno::Array< T >::s_pType)
00210 {
00211 const ::com::sun::star::uno::Type & rElementType =
00212 ::cppu::getTypeFavourUnsigned( **pT );
00213 sal_Int32 size = sizeof( ***pT );
00214 sal_Int32 dim2 = sizeof( **pT ) / size;
00215 sal_Int32 dim1 = sizeof( *pT ) / dim2 / size;
00216 ::typelib_static_array_type_init(
00217 & ::com::sun::star::uno::Array< T >::s_pType, rElementType.getTypeLibType(),
00218 2, dim1, dim2 );
00219 }
00220 return * reinterpret_cast< const ::com::sun::star::uno::Type * >(
00221 & ::com::sun::star::uno::Array< T >::s_pType );
00222 }
00223
00224 template< class T >
00225 inline const ::com::sun::star::uno::Type & SAL_CALL getCppuArrayType3( T * pT ) SAL_THROW(())
00226 {
00227 if (! ::com::sun::star::uno::Array< T >::s_pType)
00228 {
00229 const ::com::sun::star::uno::Type & rElementType =
00230 ::cppu::getTypeFavourUnsigned( ***pT );
00231 sal_Int32 size = sizeof( ****pT );
00232 sal_Int32 dim3 = sizeof( ***pT ) / size;
00233 sal_Int32 dim2 = sizeof( **pT ) / dim3 / size;
00234 sal_Int32 dim1 = sizeof( *pT ) / (dim2 * dim3)/ size;
00235 ::typelib_static_array_type_init(
00236 & ::com::sun::star::uno::Array< T >::s_pType, rElementType.getTypeLibType(),
00237 3, dim1, dim2, dim3 );
00238 }
00239 return * reinterpret_cast< const ::com::sun::star::uno::Type * >(
00240 & ::com::sun::star::uno::Array< T >::s_pType );
00241 }
00242
00243 template< class T >
00244 inline const ::com::sun::star::uno::Type & SAL_CALL getCppuArrayType4( T * pT ) SAL_THROW(())
00245 {
00246 if (! ::com::sun::star::uno::Array< T >::s_pType)
00247 {
00248 const ::com::sun::star::uno::Type & rElementType =
00249 ::cppu::getTypeFavourUnsigned( ****pT );
00250 sal_Int32 size = sizeof( *****pT );
00251 sal_Int32 dim4 = sizeof( ****pT ) / size;
00252 sal_Int32 dim3 = sizeof( ***pT ) / dim4 / size;
00253 sal_Int32 dim2 = sizeof( **pT ) / (dim3 * dim4) / size;
00254 sal_Int32 dim1 = sizeof( *pT ) / (dim2 * dim3 * dim4) / size;
00255 ::typelib_static_array_type_init(
00256 & ::com::sun::star::uno::Array< T >::s_pType, rElementType.getTypeLibType(),
00257 4, dim1, dim2, dim3, dim4 );
00258 }
00259 return * reinterpret_cast< const ::com::sun::star::uno::Type * >(
00260 & ::com::sun::star::uno::Array< T >::s_pType );
00261 }
00262
00263 template< class T >
00264 inline const ::com::sun::star::uno::Type & SAL_CALL getCppuArrayType5( T * pT ) SAL_THROW(())
00265 {
00266 if (! ::com::sun::star::uno::Array< T >::s_pType)
00267 {
00268 const ::com::sun::star::uno::Type & rElementType =
00269 ::cppu::getTypeFavourUnsigned( *****pT );
00270 sal_Int32 size = sizeof( ******pT );
00271 sal_Int32 dim5 = sizeof( *****pT ) / size;
00272 sal_Int32 dim4 = sizeof( ****pT ) / dim5 / size;
00273 sal_Int32 dim3 = sizeof( ***pT ) / (dim4 * dim5) / size;
00274 sal_Int32 dim2 = sizeof( **pT ) / (dim3 * dim4 * dim5) / size;
00275 sal_Int32 dim1 = sizeof( *pT ) / (dim2 * dim3 * dim4 * dim5) / size;
00276 ::typelib_static_array_type_init(
00277 & ::com::sun::star::uno::Array< T >::s_pType, rElementType.getTypeLibType(),
00278 5, dim1, dim2, dim3, dim4, dim5 );
00279 }
00280 return * reinterpret_cast< const ::com::sun::star::uno::Type * >(
00281 & ::com::sun::star::uno::Array< T >::s_pType );
00282 }
00283
00284 template< class T >
00285 inline const ::com::sun::star::uno::Type & SAL_CALL getCppuArrayType6( T * pT ) SAL_THROW(())
00286 {
00287 if (! ::com::sun::star::uno::Array< T >::s_pType)
00288 {
00289 const ::com::sun::star::uno::Type & rElementType =
00290 ::cppu::getTypeFavourUnsigned( ******pT );
00291 sal_Int32 size = sizeof( *******pT );
00292 sal_Int32 dim6 = sizeof( ******pT ) / size;
00293 sal_Int32 dim5 = sizeof( *****pT ) / dim6 / size;
00294 sal_Int32 dim4 = sizeof( ****pT ) / (dim5 * dim6) / size;
00295 sal_Int32 dim3 = sizeof( ***pT ) / (dim4 * dim5 * dim6) / size;
00296 sal_Int32 dim2 = sizeof( **pT ) / (dim3 * dim4 * dim5 * dim6) / size;
00297 sal_Int32 dim1 = sizeof( *pT ) / (dim2 * dim3 * dim4 * dim5 * dim6) / size;
00298 ::typelib_static_array_type_init(
00299 & ::com::sun::star::uno::Array< T >::s_pType, rElementType.getTypeLibType(),
00300 6, dim1, dim2, dim3, dim4, dim5, dim6 );
00301 }
00302 return * reinterpret_cast< const ::com::sun::star::uno::Type * >(
00303 & ::com::sun::star::uno::Array< T >::s_pType );
00304 }
00305
00306 template< typename T >
00307 inline const ::com::sun::star::uno::Type & SAL_CALL getCppuType() SAL_THROW(())
00308 {
00309 return ::cppu::UnoType< T >::get();
00310 }
00311
00312 template<>
00313 inline const ::com::sun::star::uno::Type & SAL_CALL getCppuType< sal_Unicode >()
00314 SAL_THROW(())
00315 {
00316 return ::cppu::UnoType< ::cppu::UnoCharType >::get();
00317 }
00318
00319 #endif
00320
00321