summaryrefslogtreecommitdiff
path: root/cppu
diff options
context:
space:
mode:
authorDaniel Boelzle <dbo@openoffice.org>2001-03-30 09:51:55 +0000
committerDaniel Boelzle <dbo@openoffice.org>2001-03-30 09:51:55 +0000
commit593d7125d2a73387f8f24432c2165cac92e45a00 (patch)
treeed510af1ec6368365ad78df452c10c1ef0cf14ab /cppu
parent9c5b731708ad4348f4ae0a179ffd8b9b352bad84 (diff)
added getCppuSequenceType<>( Type const & rElementType )
Diffstat (limited to 'cppu')
-rw-r--r--cppu/inc/com/sun/star/uno/Sequence.h16
-rw-r--r--cppu/inc/com/sun/star/uno/Sequence.hxx19
2 files changed, 31 insertions, 4 deletions
diff --git a/cppu/inc/com/sun/star/uno/Sequence.h b/cppu/inc/com/sun/star/uno/Sequence.h
index 18125e7c04b1..0593f31170bd 100644
--- a/cppu/inc/com/sun/star/uno/Sequence.h
+++ b/cppu/inc/com/sun/star/uno/Sequence.h
@@ -2,9 +2,9 @@
*
* $RCSfile: Sequence.h,v $
*
- * $Revision: 1.9 $
+ * $Revision: 1.10 $
*
- * last change: $Author: dbo $ $Date: 2001-03-16 16:34:33 $
+ * last change: $Author: dbo $ $Date: 2001-03-30 10:51:55 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -280,6 +280,18 @@ template< class S >
inline const ::com::sun::star::uno::Type &
SAL_CALL getCppuType( const ::com::sun::star::uno::Sequence< S > * ) SAL_THROW( () );
+/** Gets the meta type of IDL sequence.
+ THE GIVEN ELEMENT TYPE MUST BE THE SAME AS THE CPP_UNO TYPE OF THE TEMPLATE ARGUMENT!
+ This function has been introduced, because one cannot get the (templated) cppu type out
+ of C++ array types. Array types have special getCppuArrayTypeN<>() functions.
+ <br>
+ @param rElementType element type of sequence
+ @return type of IDL sequence
+*/
+template< class S >
+inline const ::com::sun::star::uno::Type &
+SAL_CALL getCppuSequenceType( const ::com::sun::star::uno::Type & rElementType ) SAL_THROW( () );
+
/** Gets the meta type of IDL <b>sequence< char ></b>.
This function has been introduced due to ambiguities with unsigned short.
<br>
diff --git a/cppu/inc/com/sun/star/uno/Sequence.hxx b/cppu/inc/com/sun/star/uno/Sequence.hxx
index e737e3836b23..166e8d853da4 100644
--- a/cppu/inc/com/sun/star/uno/Sequence.hxx
+++ b/cppu/inc/com/sun/star/uno/Sequence.hxx
@@ -2,9 +2,9 @@
*
* $RCSfile: Sequence.hxx,v $
*
- * $Revision: 1.10 $
+ * $Revision: 1.11 $
*
- * last change: $Author: dbo $ $Date: 2001-03-16 16:34:33 $
+ * last change: $Author: dbo $ $Date: 2001-03-30 10:51:55 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -239,6 +239,21 @@ SAL_CALL getCppuType( const ::com::sun::star::uno::Sequence< S > * ) SAL_THROW(
& ::com::sun::star::uno::Sequence< S >::s_pType );
}
+// generic sequence template for given element type (e.g. C++ arrays)
+template< class S >
+inline const ::com::sun::star::uno::Type &
+SAL_CALL getCppuSequenceType( const ::com::sun::star::uno::Type & rElementType ) SAL_THROW( () )
+{
+ if (! ::com::sun::star::uno::Sequence< S >::s_pType)
+ {
+ ::typelib_static_sequence_type_init(
+ & ::com::sun::star::uno::Sequence< S >::s_pType,
+ rElementType.getTypeLibType() );
+ }
+ return * reinterpret_cast< const ::com::sun::star::uno::Type * >(
+ & ::com::sun::star::uno::Sequence< S >::s_pType );
+}
+
#if ((defined(__SUNPRO_CC) && (__SUNPRO_CC == 0x500)) || (defined(__GNUC__) && defined(__APPLE__)))
static typelib_TypeDescriptionReference * s_pType_com_sun_star_uno_Sequence_Char = 0;
#endif