From 593d7125d2a73387f8f24432c2165cac92e45a00 Mon Sep 17 00:00:00 2001 From: Daniel Boelzle Date: Fri, 30 Mar 2001 09:51:55 +0000 Subject: added getCppuSequenceType<>( Type const & rElementType ) --- cppu/inc/com/sun/star/uno/Sequence.h | 16 ++++++++++++++-- cppu/inc/com/sun/star/uno/Sequence.hxx | 19 +++++++++++++++++-- 2 files changed, 31 insertions(+), 4 deletions(-) (limited to 'cppu') 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. +
+ @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 sequence< char >. This function has been introduced due to ambiguities with unsigned short.
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 -- cgit