summaryrefslogtreecommitdiff
path: root/cppu/inc/com
diff options
context:
space:
mode:
authorDaniel Boelzle <dbo@openoffice.org>2002-06-20 10:04:52 +0000
committerDaniel Boelzle <dbo@openoffice.org>2002-06-20 10:04:52 +0000
commit30fe116702022a8a1a768a7bab81b238e8a43146 (patch)
treee13b5620fa1e9eecdc56d898031347f082eff393 /cppu/inc/com
parent1c6275d149e15ee99f12599ebbb3bae1311f7acc (diff)
#100535# moved temlate class Array to namespace ::com::sun::star::uno
Diffstat (limited to 'cppu/inc/com')
-rw-r--r--cppu/inc/com/sun/star/uno/Type.h56
-rw-r--r--cppu/inc/com/sun/star/uno/Type.hxx80
2 files changed, 90 insertions, 46 deletions
diff --git a/cppu/inc/com/sun/star/uno/Type.h b/cppu/inc/com/sun/star/uno/Type.h
index 771fdc5058e7..16fa64734a68 100644
--- a/cppu/inc/com/sun/star/uno/Type.h
+++ b/cppu/inc/com/sun/star/uno/Type.h
@@ -2,9 +2,9 @@
*
* $RCSfile: Type.h,v $
*
- * $Revision: 1.6 $
+ * $Revision: 1.7 $
*
- * last change: $Author: dbo $ $Date: 2001-11-09 09:14:30 $
+ * last change: $Author: dbo $ $Date: 2002-06-20 11:04:52 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -234,6 +234,15 @@ public:
{ return (! ::typelib_typedescriptionreference_equals( _pType, rType._pType )); }
};
+/** Helper class to specify a type pointer for idl arrays.
+*/
+template< class T >
+class Array
+{
+public:
+ static typelib_TypeDescriptionReference * s_pType;
+};
+
}
}
}
@@ -354,4 +363,47 @@ inline const ::com::sun::star::uno::Type & SAL_CALL getCppuType( const float * )
*/
inline const ::com::sun::star::uno::Type & SAL_CALL getCppuType( const double * ) SAL_THROW( () );
+/** Array template function to get meta type for one-dimensional arrays.
+
+ @param pT array pointer
+ @return type of array
+*/
+template< class T >
+inline const ::com::sun::star::uno::Type & SAL_CALL getCppuArrayType1( T * pT ) SAL_THROW( () );
+/** Array template function to get meta type for two-dimensional arrays.
+
+ @param pT array pointer
+ @return type of array
+*/
+template< class T >
+inline const ::com::sun::star::uno::Type & SAL_CALL getCppuArrayType2( T * pT ) SAL_THROW( () );
+/** Array template function to get meta type for three-dimensional arrays.
+
+ @param pT array pointer
+ @return type of array
+*/
+template< class T >
+inline const ::com::sun::star::uno::Type & SAL_CALL getCppuArrayType3( T * pT ) SAL_THROW( () );
+/** Array template function to get meta type for four-dimensional arrays.
+
+ @param pT array pointer
+ @return type of array
+*/
+template< class T >
+inline const ::com::sun::star::uno::Type & SAL_CALL getCppuArrayType4( T * pT ) SAL_THROW( () );
+/** Array template function to get meta type for five-dimensional arrays.
+
+ @param pT array pointer
+ @return type of array
+*/
+template< class T >
+inline const ::com::sun::star::uno::Type & SAL_CALL getCppuArrayType5( T * pT ) SAL_THROW( () );
+/** Array template function to get meta type for six-dimensional arrays.
+
+ @param pT array pointer
+ @return type of array
+*/
+template< class T >
+inline const ::com::sun::star::uno::Type & SAL_CALL getCppuArrayType6( T * pT ) SAL_THROW( () );
+
#endif
diff --git a/cppu/inc/com/sun/star/uno/Type.hxx b/cppu/inc/com/sun/star/uno/Type.hxx
index 17f160cdd604..97690595514c 100644
--- a/cppu/inc/com/sun/star/uno/Type.hxx
+++ b/cppu/inc/com/sun/star/uno/Type.hxx
@@ -2,9 +2,9 @@
*
* $RCSfile: Type.hxx,v $
*
- * $Revision: 1.6 $
+ * $Revision: 1.7 $
*
- * last change: $Author: dbo $ $Date: 2001-11-09 09:14:30 $
+ * last change: $Author: dbo $ $Date: 2002-06-20 11:04:52 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -132,6 +132,10 @@ inline Type & Type::operator = ( const Type & rType ) SAL_THROW( () )
return *this;
}
+//__________________________________________________________________________________________________
+template< class T >
+typelib_TypeDescriptionReference * Array< T >::s_pType = 0;
+
}
}
}
@@ -241,56 +245,43 @@ inline const ::com::sun::star::uno::Type & SAL_CALL getCppuType( const double *
::typelib_static_type_getByTypeClass( typelib_TypeClass_DOUBLE ) );
}
-// help class to specify an unique type pointer
-template<class T>
-class Array
-{
-public:
- static typelib_TypeDescriptionReference * s_pType;
-};
-
-template<class T>
-typelib_TypeDescriptionReference * Array<T>::s_pType = 0;
-
-// generic array template
template< class T >
-inline const ::com::sun::star::uno::Type &
-SAL_CALL getCppuArrayType1( T * pT ) SAL_THROW( () )
+inline const ::com::sun::star::uno::Type & SAL_CALL getCppuArrayType1( T * pT ) SAL_THROW( () )
{
- if (! Array< T >::s_pType)
+ if (! ::com::sun::star::uno::Array< T >::s_pType)
{
const ::com::sun::star::uno::Type & rElementType = ::getCppuType( *pT );
sal_Int32 size = sizeof( **pT );
sal_Int32 dim1 = sizeof( *pT ) / size;
::typelib_static_array_type_init(
- & Array< T >::s_pType, rElementType.getTypeLibType(), 1, dim1 );
+ & ::com::sun::star::uno::Array< T >::s_pType, rElementType.getTypeLibType(),
+ 1, dim1 );
}
return * reinterpret_cast< const ::com::sun::star::uno::Type * >(
- & Array< T >::s_pType );
+ & ::com::sun::star::uno::Array< T >::s_pType );
}
template< class T >
-inline const ::com::sun::star::uno::Type &
-SAL_CALL getCppuArrayType2( T * pT ) SAL_THROW( () )
+inline const ::com::sun::star::uno::Type & SAL_CALL getCppuArrayType2( T * pT ) SAL_THROW( () )
{
- if (! Array< T >::s_pType)
+ if (! ::com::sun::star::uno::Array< T >::s_pType)
{
const ::com::sun::star::uno::Type & rElementType = ::getCppuType( **pT );
sal_Int32 size = sizeof( ***pT );
sal_Int32 dim2 = sizeof( **pT ) / size;
sal_Int32 dim1 = sizeof( *pT ) / dim2 / size;
::typelib_static_array_type_init(
- & Array< T >::s_pType, rElementType.getTypeLibType(), 2, dim1, dim2 );
+ & ::com::sun::star::uno::Array< T >::s_pType, rElementType.getTypeLibType(),
+ 2, dim1, dim2 );
}
return * reinterpret_cast< const ::com::sun::star::uno::Type * >(
- & Array< T >::s_pType );
+ & ::com::sun::star::uno::Array< T >::s_pType );
}
template< class T >
-inline const ::com::sun::star::uno::Type &
-SAL_CALL getCppuArrayType3( T * pT ) SAL_THROW( () )
+inline const ::com::sun::star::uno::Type & SAL_CALL getCppuArrayType3( T * pT ) SAL_THROW( () )
{
- if (! Array< T >::s_pType)
+ if (! ::com::sun::star::uno::Array< T >::s_pType)
{
const ::com::sun::star::uno::Type & rElementType = ::getCppuType( ***pT );
sal_Int32 size = sizeof( ****pT );
@@ -298,17 +289,17 @@ SAL_CALL getCppuArrayType3( T * pT ) SAL_THROW( () )
sal_Int32 dim2 = sizeof( **pT ) / dim3 / size;
sal_Int32 dim1 = sizeof( *pT ) / (dim2 * dim3)/ size;
::typelib_static_array_type_init(
- & Array< T >::s_pType, rElementType.getTypeLibType(), 3, dim1, dim2, dim3 );
+ & ::com::sun::star::uno::Array< T >::s_pType, rElementType.getTypeLibType(),
+ 3, dim1, dim2, dim3 );
}
return * reinterpret_cast< const ::com::sun::star::uno::Type * >(
- & Array< T >::s_pType );
+ & ::com::sun::star::uno::Array< T >::s_pType );
}
template< class T >
-inline const ::com::sun::star::uno::Type &
-SAL_CALL getCppuArrayType4( T * pT ) SAL_THROW( () )
+inline const ::com::sun::star::uno::Type & SAL_CALL getCppuArrayType4( T * pT ) SAL_THROW( () )
{
- if (! Array< T >::s_pType)
+ if (! ::com::sun::star::uno::Array< T >::s_pType)
{
const ::com::sun::star::uno::Type & rElementType = ::getCppuType( ****pT );
sal_Int32 size = sizeof( *****pT );
@@ -317,17 +308,17 @@ SAL_CALL getCppuArrayType4( T * pT ) SAL_THROW( () )
sal_Int32 dim2 = sizeof( **pT ) / (dim3 * dim4) / size;
sal_Int32 dim1 = sizeof( *pT ) / (dim2 * dim3 * dim4) / size;
::typelib_static_array_type_init(
- & Array< T >::s_pType, rElementType.getTypeLibType(), 4, dim1, dim2, dim3, dim4 );
+ & ::com::sun::star::uno::Array< T >::s_pType, rElementType.getTypeLibType(),
+ 4, dim1, dim2, dim3, dim4 );
}
return * reinterpret_cast< const ::com::sun::star::uno::Type * >(
- & Array< T >::s_pType );
+ & ::com::sun::star::uno::Array< T >::s_pType );
}
template< class T >
-inline const ::com::sun::star::uno::Type &
-SAL_CALL getCppuArrayType5( T * pT ) SAL_THROW( () )
+inline const ::com::sun::star::uno::Type & SAL_CALL getCppuArrayType5( T * pT ) SAL_THROW( () )
{
- if (! Array< T >::s_pType)
+ if (! ::com::sun::star::uno::Array< T >::s_pType)
{
const ::com::sun::star::uno::Type & rElementType = ::getCppuType( *****pT );
sal_Int32 size = sizeof( ******pT );
@@ -337,17 +328,17 @@ SAL_CALL getCppuArrayType5( T * pT ) SAL_THROW( () )
sal_Int32 dim2 = sizeof( **pT ) / (dim3 * dim4 * dim5) / size;
sal_Int32 dim1 = sizeof( *pT ) / (dim2 * dim3 * dim4 * dim5) / size;
::typelib_static_array_type_init(
- & Array< T >::s_pType, rElementType.getTypeLibType(), 5, dim1, dim2, dim3, dim4, dim5 );
+ & ::com::sun::star::uno::Array< T >::s_pType, rElementType.getTypeLibType(),
+ 5, dim1, dim2, dim3, dim4, dim5 );
}
return * reinterpret_cast< const ::com::sun::star::uno::Type * >(
- & Array< T >::s_pType );
+ & ::com::sun::star::uno::Array< T >::s_pType );
}
template< class T >
-inline const ::com::sun::star::uno::Type &
-SAL_CALL getCppuArrayType6( T * pT ) SAL_THROW( () )
+inline const ::com::sun::star::uno::Type & SAL_CALL getCppuArrayType6( T * pT ) SAL_THROW( () )
{
- if (! Array< T >::s_pType)
+ if (! ::com::sun::star::uno::Array< T >::s_pType)
{
const ::com::sun::star::uno::Type & rElementType = ::getCppuType( ******pT );
sal_Int32 size = sizeof( *******pT );
@@ -358,10 +349,11 @@ SAL_CALL getCppuArrayType6( T * pT ) SAL_THROW( () )
sal_Int32 dim2 = sizeof( **pT ) / (dim3 * dim4 * dim5 * dim6) / size;
sal_Int32 dim1 = sizeof( *pT ) / (dim2 * dim3 * dim4 * dim5 * dim6) / size;
::typelib_static_array_type_init(
- & Array< T >::s_pType, rElementType.getTypeLibType(), 6, dim1, dim2, dim3, dim4, dim5, dim6 );
+ & ::com::sun::star::uno::Array< T >::s_pType, rElementType.getTypeLibType(),
+ 6, dim1, dim2, dim3, dim4, dim5, dim6 );
}
return * reinterpret_cast< const ::com::sun::star::uno::Type * >(
- & Array< T >::s_pType );
+ & ::com::sun::star::uno::Array< T >::s_pType );
}
#endif