diff options
Diffstat (limited to 'cppu/inc/com')
-rw-r--r-- | cppu/inc/com/sun/star/uno/Any.h | 376 | ||||
-rw-r--r-- | cppu/inc/com/sun/star/uno/Any.hxx | 487 | ||||
-rw-r--r-- | cppu/inc/com/sun/star/uno/Reference.h | 342 | ||||
-rw-r--r-- | cppu/inc/com/sun/star/uno/Reference.hxx | 170 | ||||
-rw-r--r-- | cppu/inc/com/sun/star/uno/Sequence.h | 291 | ||||
-rw-r--r-- | cppu/inc/com/sun/star/uno/Sequence.hxx | 236 | ||||
-rw-r--r-- | cppu/inc/com/sun/star/uno/Type.h | 364 | ||||
-rw-r--r-- | cppu/inc/com/sun/star/uno/Type.hxx | 238 | ||||
-rw-r--r-- | cppu/inc/com/sun/star/uno/genfunc.h | 105 | ||||
-rw-r--r-- | cppu/inc/com/sun/star/uno/genfunc.hxx | 120 |
10 files changed, 2729 insertions, 0 deletions
diff --git a/cppu/inc/com/sun/star/uno/Any.h b/cppu/inc/com/sun/star/uno/Any.h new file mode 100644 index 000000000000..788031178b4b --- /dev/null +++ b/cppu/inc/com/sun/star/uno/Any.h @@ -0,0 +1,376 @@ +/************************************************************************* + * + * $RCSfile: Any.h,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 15:25:50 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ +#ifndef _COM_SUN_STAR_UNO_ANY_H_ +#define _COM_SUN_STAR_UNO_ANY_H_ + +#ifndef _CPPU_MACROS_HXX_ +#include <cppu/macros.hxx> +#endif + +#ifndef _UNO_ANY2_H_ +#include <uno/any2.h> +#endif +#ifndef _TYPELIB_TYPEDESCRIPTION_H_ +#include <typelib/typedescription.h> +#endif +#ifndef _COM_SUN_STAR_UNO_TYPE_H_ +#include <com/sun/star/uno/Type.h> +#endif + +#ifndef _RTL_ALLOC_H_ +#include <rtl/alloc.h> +#endif + +class BinaryCompatible_Impl; + +/** */ //for docpp +namespace com +{ +/** */ //for docpp +namespace sun +{ +/** */ //for docpp +namespace star +{ +/** */ //for docpp +namespace uno +{ + +/** C++ class representing an IDL any. + This class is used to transport any type defined in IDL. + The class inherits from the binary C representation + of <b>uno_Any</b>.<br> + You can insert a value by either using the <<= operators + or the template function makeAny(). No any can hold an any.<br> + You can extract values from an any by using the >>= operators + which return true if the any contains an assignable value + (no data loss), e.g. the any contains a short and you >>= it + into a long variable. + <br> +*/ +class Any : public uno_Any +{ +public: + // these are here to force memory de/allocation to sal lib. + inline static void * SAL_CALL operator new( size_t nSize ) throw() + { return ::rtl_allocateMemory( nSize ); } + inline static void SAL_CALL operator delete( void * pMem ) throw() + { ::rtl_freeMemory( pMem ); } + inline static void * SAL_CALL operator new( size_t, void * pMem ) throw() + { return pMem; } + inline static void SAL_CALL operator delete( void *, void * ) throw() + {} + + /** Default constructor: + Any holds no value; its type is void. + <br> + */ + inline Any(); + + /** Copy constructor: + Sets value of the given any. + <br> + @param rAny another any + */ + inline Any( const Any & rAny ); + + /** Constructor: + Sets a copy of the given data. + <br> + @param pData value + @param rType type of value + */ + inline Any( const void * pData, const Type & rType ); + + /** Constructor: + Sets a copy of the given data. + <br> + @param pData value + @param pTypeDescr type of value + */ + inline Any( const void * pData, typelib_TypeDescription * pTypeDescr ); + + /** Constructor: + Sets a copy of the given data. + <br> + @param pData value + @param pType type of value + */ + inline Any( const void * pData, typelib_TypeDescriptionReference * pType ); + + /** Destructor: + Destructs any content and frees memory. + <br> + */ + inline ~Any(); + + /** Assignment operator: + Sets the value of the given any. + <br> + @param rAny another any (right side) + @return this any + */ + inline Any & SAL_CALL operator = ( const Any & rAny ); + + /** Gets the type of the set value. + <br> + @return a Type object of the set value + */ + inline const Type & SAL_CALL getValueType() const + { return * reinterpret_cast< const Type * >( &pType ); } + /** Gets the type of the set value. + <br> + @return the <b>un</b>acquired type description reference of the set value + */ + inline typelib_TypeDescriptionReference * SAL_CALL getValueTypeRef() const + { return pType; } + + /** Gets the type description of the set value.<br> + Provides <b>ownership</b> of the type description! + Call an explicit typelib_typedescription_release() to release. + <br> + @param a pointer to type description pointer + */ + inline void SAL_CALL getValueTypeDescription( typelib_TypeDescription ** ppTypeDescr ) const + { ::typelib_typedescriptionreference_getDescription( ppTypeDescr, getValueTypeRef() ); } + + /** Gets the type class of the set value. + <br> + @return the type class of the set value + */ + inline TypeClass SAL_CALL getValueTypeClass() const + { return (TypeClass)pType->eTypeClass; } + + /** Gets the type name of the set value. + <br> + @return the type name of the set value + */ + inline ::rtl::OUString SAL_CALL getValueTypeName() const + { return ::rtl::OUString( pType->pTypeName ); } + + /** Tests if any contains a value. + <br> + @return true if any has a value, false otherwise + */ + inline sal_Bool SAL_CALL hasValue() const + { return (TypeClass_VOID != getValueTypeClass()); } + + /** Gets a pointer to the set value. + <br> + @return a pointer to the set value + */ + inline const void * SAL_CALL getValue() const + { return pData; } + + /** Sets a value. If the any already contains a value, that value will be destructed + and its memory freed. + <br> + @param pData pointer to value + @param rType type of value + */ + inline void SAL_CALL setValue( const void * pData, const Type & rType ); + /** Sets a value. If the any already contains a value, that value will be destructed + and its memory freed. + <br> + @param pData pointer to value + @param pType type of value + */ + inline void SAL_CALL setValue( const void * pData, typelib_TypeDescriptionReference * pType ); + /** Sets a value. If the any already contains a value, that value will be destructed + and its memory freed. + <br> + @param pData pointer to value + @param pTypeDescr type description of value + */ + inline void SAL_CALL setValue( const void * pData, typelib_TypeDescription * pTypeDescr ); + + /** Clears this any. If the any already contains a value, that value will be destructed + and its memory freed. After this has been called, the any does not contain a value. + <br> + */ + inline void SAL_CALL clear(); + + /** Equality operator: compares two anys.<br> + The values need not be of equal type, e.g. a short integer is compared to + a long integer. + <br> + @param rAny another any (right side) + @return true if both any contains equal values + */ + inline sal_Bool SAL_CALL operator == ( const Any & rAny ) const; + /** Unequality operator: compares two anys.<br> + The values need not be of equal type, e.g. a short integer is compared to + a long integer. + <br> + @param rAny another any (right side) + @return true if both any contains unequal values + */ + inline sal_Bool SAL_CALL operator != ( const Any & rAny ) const + { return (! operator == ( rAny )); } + + // test the binary compatibility + friend class BinaryCompatible_Impl; +}; + +/** Template function to generically construct an any from a C++ value. + <br> + @param value a value + @return an any + */ +template< class C > +inline Any SAL_CALL makeAny( const C & value ); + +class BaseReference; +class Type; + +/** Template binary <<= operator to set the value of an any. + <br> + @param rAny destination any (left side) + @param value source value (right side) + */ +template< class C > +inline void SAL_CALL operator <<= ( ::com::sun::star::uno::Any & rAny, const C & value ); +/** Template binary >>= operator to assign a value from an any.<br> + If the any does not contain a value that can be assigned <b>without</b> + data loss, this operation will fail returning false. + <br> + @param rAny source any (left side) + @param value destination value (right side) + @return true if assignment was possible without data loss + */ +template< class C > +inline sal_Bool SAL_CALL operator >>= ( const ::com::sun::star::uno::Any & rAny, C & value ); + +/** Template equality operator: compares set value of left side any to right side value.<br> + The values need not be of equal type, e.g. a short integer is compared to + a long integer.<br> + This operator can be implemented as template member function, if + all supported compilers can cope with template member functions. + <br> + @param rAny another any (left side) + @param value a value (right side) + @return true if values are equal, false otherwise +*/ +template< class C > +inline sal_Bool SAL_CALL operator == ( const ::com::sun::star::uno::Any & rAny, const C & value ); +/** Template unequality operator: compares set value of left side any to right side value.<br> + The values need not be of equal type, e.g. a short integer is compared to + a long integer.<br> + This operator can be implemented as template member function, if + all supported compilers can cope with template member functions. + <br> + @param rAny another any (left side) + @param value a value (right side) + @return true if values are unequal, false otherwise +*/ +template< class C > +inline sal_Bool SAL_CALL operator != ( const ::com::sun::star::uno::Any & rAny, const C & value ) +{ + return (! operator == ( rAny, value )); +} + +// additional specialized >>= and == operators +// bool +inline sal_Bool SAL_CALL operator >>= ( const ::com::sun::star::uno::Any & rAny, sal_Bool & value ); +inline sal_Bool SAL_CALL operator == ( const ::com::sun::star::uno::Any & rAny, const sal_Bool & value ); +// byte +inline sal_Bool SAL_CALL operator >>= ( const ::com::sun::star::uno::Any & rAny, sal_Int8 & value ); +// short +inline sal_Bool SAL_CALL operator >>= ( const ::com::sun::star::uno::Any & rAny, sal_Int16 & value ); +inline sal_Bool SAL_CALL operator >>= ( const ::com::sun::star::uno::Any & rAny, sal_uInt16 & value ); +// long +inline sal_Bool SAL_CALL operator >>= ( const ::com::sun::star::uno::Any & rAny, sal_Int32 & value ); +inline sal_Bool SAL_CALL operator >>= ( const ::com::sun::star::uno::Any & rAny, sal_uInt32 & value ); +// hyper +inline sal_Bool SAL_CALL operator >>= ( const ::com::sun::star::uno::Any & rAny, sal_Int64 & value ); +inline sal_Bool SAL_CALL operator >>= ( const ::com::sun::star::uno::Any & rAny, sal_uInt64 & value ); +// float +inline sal_Bool SAL_CALL operator >>= ( const ::com::sun::star::uno::Any & rAny, float & value ); +// double +inline sal_Bool SAL_CALL operator >>= ( const ::com::sun::star::uno::Any & rAny, double & value ); +// string +inline sal_Bool SAL_CALL operator >>= ( const ::com::sun::star::uno::Any & rAny, ::rtl::OUString & value ); +inline sal_Bool SAL_CALL operator == ( const ::com::sun::star::uno::Any & rAny, const ::rtl::OUString & value ); +// type +inline sal_Bool SAL_CALL operator >>= ( const ::com::sun::star::uno::Any & rAny, ::com::sun::star::uno::Type & value ); +inline sal_Bool SAL_CALL operator == ( const ::com::sun::star::uno::Any & rAny, const ::com::sun::star::uno::Type & value ); +// any +inline sal_Bool SAL_CALL operator >>= ( const ::com::sun::star::uno::Any & rAny, ::com::sun::star::uno::Any & value ); +// interface +inline sal_Bool SAL_CALL operator == ( const ::com::sun::star::uno::Any & rAny, const ::com::sun::star::uno::BaseReference & value ); + +} +} +} +} + +/** Gets the meta type of IDL type <b>any</b>. + <br> + @param dummy typed pointer for function signature + @return type of IDL type <b>any</b> +*/ +inline const ::com::sun::star::uno::Type & SAL_CALL getCppuType( const ::com::sun::star::uno::Any * ) +{ + return * reinterpret_cast< const ::com::sun::star::uno::Type * >( + ::typelib_static_type_getByTypeClass( typelib_TypeClass_ANY ) ); +} + +#endif diff --git a/cppu/inc/com/sun/star/uno/Any.hxx b/cppu/inc/com/sun/star/uno/Any.hxx new file mode 100644 index 000000000000..f73cfdf28b08 --- /dev/null +++ b/cppu/inc/com/sun/star/uno/Any.hxx @@ -0,0 +1,487 @@ +/************************************************************************* + * + * $RCSfile: Any.hxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 15:25:50 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ +#ifndef _COM_SUN_STAR_UNO_ANY_HXX_ +#define _COM_SUN_STAR_UNO_ANY_HXX_ + +#ifndef _COM_SUN_STAR_UNO_ANY_H_ +#include <com/sun/star/uno/Any.h> +#endif +#ifndef _UNO_DATA_H_ +#include <uno/data.h> +#endif +#ifndef _UNO_ANY2_H_ +#include <uno/any2.h> +#endif +#ifndef _COM_SUN_STAR_UNO_TYPE_HXX_ +#include <com/sun/star/uno/Type.hxx> +#endif +#ifndef _COM_SUN_STAR_UNO_XINTERFACE_HPP_ +#include <com/sun/star/uno/XInterface.hpp> +#endif +#ifndef _COM_SUN_STAR_UNO_GENFUNC_HXX_ +#include <com/sun/star/uno/genfunc.hxx> +#endif + + +/** */ //for docpp +namespace com +{ +/** */ //for docpp +namespace sun +{ +/** */ //for docpp +namespace star +{ +/** */ //for docpp +namespace uno +{ + +//__________________________________________________________________________________________________ +inline Any::Any() +{ + ::uno_any_construct( this, 0, 0, cpp_acquire ); +} +//__________________________________________________________________________________________________ +inline Any::Any( const Any & rAny ) +{ + ::uno_type_any_construct( this, rAny.pData, rAny.getValueTypeRef(), cpp_acquire ); +} +//__________________________________________________________________________________________________ +inline Any::Any( const void * pData, const Type & rType ) +{ + ::uno_type_any_construct( this, const_cast< void * >( pData ), rType.getTypeLibType(), cpp_acquire ); +} +//__________________________________________________________________________________________________ +inline Any::Any( const void * pData, typelib_TypeDescription * pTypeDescr ) +{ + ::uno_any_construct( this, const_cast< void * >( pData ), pTypeDescr, cpp_acquire ); +} +//__________________________________________________________________________________________________ +inline Any::Any( const void * pData, typelib_TypeDescriptionReference * pType ) +{ + ::uno_type_any_construct( this, const_cast< void * >( pData ), pType, cpp_acquire ); +} +//__________________________________________________________________________________________________ +inline Any::~Any() +{ + ::uno_any_destruct( this, cpp_release ); +} +//__________________________________________________________________________________________________ +inline Any & Any::operator = ( const Any & rAny ) +{ + if (this != &rAny) + setValue( rAny.getValue(), rAny.getValueTypeRef() ); + return *this; +} +//__________________________________________________________________________________________________ +inline void Any::setValue( const void * pData, const Type & rType ) +{ + ::uno_any_destruct( this, cpp_release ); + ::uno_type_any_construct( this, const_cast< void * >( pData ), rType.getTypeLibType(), cpp_acquire ); +} +//__________________________________________________________________________________________________ +inline void Any::setValue( const void * pData, typelib_TypeDescriptionReference * pType ) +{ + ::uno_any_destruct( this, cpp_release ); + ::uno_type_any_construct( this, const_cast< void * >( pData ), pType, cpp_acquire ); +} +//__________________________________________________________________________________________________ +inline void Any::setValue( const void * pData, typelib_TypeDescription * pTypeDescr ) +{ + ::uno_any_destruct( this, cpp_release ); + ::uno_any_construct( this, const_cast< void * >( pData ), pTypeDescr, cpp_acquire ); +} +//__________________________________________________________________________________________________ +inline void Any::clear() +{ + ::uno_any_destruct( this, cpp_release ); + ::uno_any_construct( this, 0, 0, cpp_acquire ); +} +//__________________________________________________________________________________________________ +inline sal_Bool Any::operator == ( const Any & rAny ) const +{ + const Type & rType = ::getCppuType( this ); + return ::uno_type_equalData( + const_cast< void * >( getValue() ), getValueTypeRef(), + const_cast< void * >( rAny.getValue() ), rAny.getValueTypeRef(), + cpp_queryInterface, cpp_release ); +} + +//__________________________________________________________________________________________________ +template< class C > +inline Any SAL_CALL makeAny( const C & value ) +{ + return Any( &value, ::getCppuType( &value ) ); +} + +//__________________________________________________________________________________________________ +template< class C > +inline void SAL_CALL operator <<= ( ::com::sun::star::uno::Any & rAny, const C & value ) +{ + rAny.setValue( &value, ::getCppuType( &value ) ); +} + +//__________________________________________________________________________________________________ +template< class C > +inline sal_Bool SAL_CALL operator >>= ( const ::com::sun::star::uno::Any & rAny, C & value ) +{ + const ::com::sun::star::uno::Type & rType = ::getCppuType( &value ); + return ::uno_type_assignData( + &value, rType.getTypeLibType(), + const_cast< void * >( rAny.getValue() ), rAny.getValueTypeRef(), + ::com::sun::star::uno::cpp_queryInterface, + ::com::sun::star::uno::cpp_acquire, + ::com::sun::star::uno::cpp_release ); +} + +// bool +//__________________________________________________________________________________________________ +inline sal_Bool SAL_CALL operator >>= ( const ::com::sun::star::uno::Any & rAny, sal_Bool & value ) +{ + if (::com::sun::star::uno::TypeClass_BOOLEAN == rAny.getValueTypeClass()) + { + value = (* reinterpret_cast< const sal_Bool * >( rAny.getValue() ) != sal_False); + return sal_True; + } + return sal_False; +} +//__________________________________________________________________________________________________ +inline sal_Bool SAL_CALL operator == ( const ::com::sun::star::uno::Any & rAny, const sal_Bool & value ) +{ + return (::com::sun::star::uno::TypeClass_BOOLEAN == rAny.getValueTypeClass() && + (value != sal_False) == (* reinterpret_cast< const sal_Bool * >( rAny.getValue() ) != sal_False)); +} +// byte +//__________________________________________________________________________________________________ +inline sal_Bool SAL_CALL operator >>= ( const ::com::sun::star::uno::Any & rAny, sal_Int8 & value ) +{ + if (::com::sun::star::uno::TypeClass_BYTE == rAny.getValueTypeClass()) + { + value = * reinterpret_cast< const sal_Int8 * >( rAny.getValue() ); + return sal_True; + } + return sal_False; +} +// short +//__________________________________________________________________________________________________ +inline sal_Bool SAL_CALL operator >>= ( const ::com::sun::star::uno::Any & rAny, sal_Int16 & value ) +{ + switch (rAny.getValueTypeClass()) + { + case ::com::sun::star::uno::TypeClass_BYTE: + value = * reinterpret_cast< const sal_Int8 * >( rAny.getValue() ); + return sal_True; + case ::com::sun::star::uno::TypeClass_SHORT: + case ::com::sun::star::uno::TypeClass_UNSIGNED_SHORT: + value = * reinterpret_cast< const sal_Int16 * >( rAny.getValue() ); + return sal_True; + } + return sal_False; +} +//__________________________________________________________________________________________________ +inline sal_Bool SAL_CALL operator >>= ( const ::com::sun::star::uno::Any & rAny, sal_uInt16 & value ) +{ + switch (rAny.getValueTypeClass()) + { + case ::com::sun::star::uno::TypeClass_BYTE: + value = * reinterpret_cast< const sal_Int8 * >( rAny.getValue() ); + return sal_True; + case ::com::sun::star::uno::TypeClass_SHORT: + case ::com::sun::star::uno::TypeClass_UNSIGNED_SHORT: + value = * reinterpret_cast< const sal_uInt16 * >( rAny.getValue() ); + return sal_True; + } + return sal_False; +} +// long +//__________________________________________________________________________________________________ +inline sal_Bool SAL_CALL operator >>= ( const ::com::sun::star::uno::Any & rAny, sal_Int32 & value ) +{ + switch (rAny.getValueTypeClass()) + { + case ::com::sun::star::uno::TypeClass_BYTE: + value = * reinterpret_cast< const sal_Int8 * >( rAny.getValue() ); + return sal_True; + case ::com::sun::star::uno::TypeClass_SHORT: + value = * reinterpret_cast< const sal_Int16 * >( rAny.getValue() ); + return sal_True; + case ::com::sun::star::uno::TypeClass_UNSIGNED_SHORT: + value = * reinterpret_cast< const sal_uInt16 * >( rAny.getValue() ); + return sal_True; + case ::com::sun::star::uno::TypeClass_LONG: + case ::com::sun::star::uno::TypeClass_UNSIGNED_LONG: + value = * reinterpret_cast< const sal_Int32 * >( rAny.getValue() ); + return sal_True; + } + return sal_False; +} +//__________________________________________________________________________________________________ +inline sal_Bool SAL_CALL operator >>= ( const ::com::sun::star::uno::Any & rAny, sal_uInt32 & value ) +{ + switch (rAny.getValueTypeClass()) + { + case ::com::sun::star::uno::TypeClass_BYTE: + value = * reinterpret_cast< const sal_Int8 * >( rAny.getValue() ); + return sal_True; + case ::com::sun::star::uno::TypeClass_SHORT: + value = * reinterpret_cast< const sal_Int16 * >( rAny.getValue() ); + return sal_True; + case ::com::sun::star::uno::TypeClass_UNSIGNED_SHORT: + value = * reinterpret_cast< const sal_uInt16 * >( rAny.getValue() ); + return sal_True; + case ::com::sun::star::uno::TypeClass_LONG: + case ::com::sun::star::uno::TypeClass_UNSIGNED_LONG: + value = * reinterpret_cast< const sal_uInt32 * >( rAny.getValue() ); + return sal_True; + } + return sal_False; +} +// hyper +//__________________________________________________________________________________________________ +inline sal_Bool SAL_CALL operator >>= ( const ::com::sun::star::uno::Any & rAny, sal_Int64 & value ) +{ + switch (rAny.getValueTypeClass()) + { + case ::com::sun::star::uno::TypeClass_BYTE: + value = * reinterpret_cast< const sal_Int8 * >( rAny.getValue() ); + return sal_True; + case ::com::sun::star::uno::TypeClass_SHORT: + value = * reinterpret_cast< const sal_Int16 * >( rAny.getValue() ); + return sal_True; + case ::com::sun::star::uno::TypeClass_UNSIGNED_SHORT: + value = * reinterpret_cast< const sal_uInt16 * >( rAny.getValue() ); + return sal_True; + case ::com::sun::star::uno::TypeClass_LONG: + value = * reinterpret_cast< const sal_Int32 * >( rAny.getValue() ); + return sal_True; + case ::com::sun::star::uno::TypeClass_UNSIGNED_LONG: + value = * reinterpret_cast< const sal_uInt32 * >( rAny.getValue() ); + return sal_True; + case ::com::sun::star::uno::TypeClass_HYPER: + case ::com::sun::star::uno::TypeClass_UNSIGNED_HYPER: + value = * reinterpret_cast< const sal_Int64 * >( rAny.getValue() ); + return sal_True; + } + return sal_False; +} +//__________________________________________________________________________________________________ +inline sal_Bool SAL_CALL operator >>= ( const ::com::sun::star::uno::Any & rAny, sal_uInt64 & value ) +{ + switch (rAny.getValueTypeClass()) + { + case ::com::sun::star::uno::TypeClass_BYTE: + value = * reinterpret_cast< const sal_Int8 * >( rAny.getValue() ); + return sal_True; + case ::com::sun::star::uno::TypeClass_SHORT: + value = * reinterpret_cast< const sal_Int16 * >( rAny.getValue() ); + return sal_True; + case ::com::sun::star::uno::TypeClass_UNSIGNED_SHORT: + value = * reinterpret_cast< const sal_uInt16 * >( rAny.getValue() ); + return sal_True; + case ::com::sun::star::uno::TypeClass_LONG: + value = * reinterpret_cast< const sal_Int32 * >( rAny.getValue() ); + return sal_True; + case ::com::sun::star::uno::TypeClass_UNSIGNED_LONG: + value = * reinterpret_cast< const sal_uInt32 * >( rAny.getValue() ); + return sal_True; + case ::com::sun::star::uno::TypeClass_HYPER: + case ::com::sun::star::uno::TypeClass_UNSIGNED_HYPER: + value = * reinterpret_cast< const sal_uInt64 * >( rAny.getValue() ); + return sal_True; + } + return sal_False; +} +// float +//__________________________________________________________________________________________________ +inline sal_Bool SAL_CALL operator >>= ( const ::com::sun::star::uno::Any & rAny, float & value ) +{ + switch (rAny.getValueTypeClass()) + { + case ::com::sun::star::uno::TypeClass_BYTE: + value = * reinterpret_cast< const sal_Int8 * >( rAny.getValue() ); + return sal_True; + case ::com::sun::star::uno::TypeClass_SHORT: + value = * reinterpret_cast< const sal_Int16 * >( rAny.getValue() ); + return sal_True; + case ::com::sun::star::uno::TypeClass_UNSIGNED_SHORT: + value = * reinterpret_cast< const sal_uInt16 * >( rAny.getValue() ); + return sal_True; + case ::com::sun::star::uno::TypeClass_FLOAT: + value = * reinterpret_cast< const float * >( rAny.getValue() ); + return sal_True; + } + return sal_False; +} +// double +//__________________________________________________________________________________________________ +inline sal_Bool SAL_CALL operator >>= ( const ::com::sun::star::uno::Any & rAny, double & value ) +{ + switch (rAny.getValueTypeClass()) + { + case ::com::sun::star::uno::TypeClass_BYTE: + value = * reinterpret_cast< const sal_Int8 * >( rAny.getValue() ); + return sal_True; + case ::com::sun::star::uno::TypeClass_SHORT: + value = * reinterpret_cast< const sal_Int16 * >( rAny.getValue() ); + return sal_True; + case ::com::sun::star::uno::TypeClass_UNSIGNED_SHORT: + value = * reinterpret_cast< const sal_uInt16 * >( rAny.getValue() ); + return sal_True; + case ::com::sun::star::uno::TypeClass_LONG: + value = * reinterpret_cast< const sal_Int32 * >( rAny.getValue() ); + return sal_True; + case ::com::sun::star::uno::TypeClass_UNSIGNED_LONG: + value = * reinterpret_cast< const sal_uInt32 * >( rAny.getValue() ); + return sal_True; + case ::com::sun::star::uno::TypeClass_FLOAT: + value = * reinterpret_cast< const float * >( rAny.getValue() ); + return sal_True; + case ::com::sun::star::uno::TypeClass_DOUBLE: + value = * reinterpret_cast< const double * >( rAny.getValue() ); + return sal_True; + } + return sal_False; +} +// string +//__________________________________________________________________________________________________ +inline sal_Bool SAL_CALL operator >>= ( + const ::com::sun::star::uno::Any & rAny, ::rtl::OUString & value ) +{ + if (::com::sun::star::uno::TypeClass_STRING == rAny.getValueTypeClass()) + { + value = * reinterpret_cast< const ::rtl::OUString * >( rAny.getValue() ); + return sal_True; + } + return sal_False; +} +//__________________________________________________________________________________________________ +inline sal_Bool SAL_CALL operator == ( + const ::com::sun::star::uno::Any & rAny, const ::rtl::OUString & value ) +{ + return (::com::sun::star::uno::TypeClass_STRING == rAny.getValueTypeClass() && + value == * reinterpret_cast< const ::rtl::OUString * >( rAny.getValue() )); +} +// type +//__________________________________________________________________________________________________ +inline sal_Bool SAL_CALL operator >>= ( + const ::com::sun::star::uno::Any & rAny, ::com::sun::star::uno::Type & value ) +{ + if (::com::sun::star::uno::TypeClass_TYPE == rAny.getValueTypeClass()) + { + value = * reinterpret_cast< const ::com::sun::star::uno::Type * >( rAny.getValue() ); + return sal_True; + } + return sal_False; +} +//__________________________________________________________________________________________________ +inline sal_Bool SAL_CALL operator == ( + const ::com::sun::star::uno::Any & rAny, const ::com::sun::star::uno::Type & value ) +{ + return (::com::sun::star::uno::TypeClass_TYPE == rAny.getValueTypeClass() && + value == * reinterpret_cast< const ::com::sun::star::uno::Type * >( rAny.getValue() )); +} +// any +//__________________________________________________________________________________________________ +inline sal_Bool SAL_CALL operator >>= ( + const ::com::sun::star::uno::Any & rAny, ::com::sun::star::uno::Any & value ) +{ + value = rAny; + return sal_True; +} +// interface +//__________________________________________________________________________________________________ +inline sal_Bool SAL_CALL operator == ( + const ::com::sun::star::uno::Any & rAny, const ::com::sun::star::uno::BaseReference & value ) +{ + if (::com::sun::star::uno::TypeClass_INTERFACE == rAny.getValueTypeClass()) + { + ::com::sun::star::uno::XInterface * p1 = + * reinterpret_cast< ::com::sun::star::uno::XInterface * const * >( rAny.getValue() ); + if (p1 && p1 == value.get()) + return sal_True; + ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > xI1( + p1, ::com::sun::star::uno::UNO_QUERY ); + ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > xI2( + value.get(), ::com::sun::star::uno::UNO_QUERY ); + return (xI1.is() && xI1.get() == xI2.get()); + } + return sal_False; +} + +// operator to compare to an any. +//__________________________________________________________________________________________________ +template< class C > +inline sal_Bool SAL_CALL operator == ( const ::com::sun::star::uno::Any & rAny, const C & value ) +{ + const ::com::sun::star::uno::Type & rType = ::getCppuType( &value ); + return ::uno_type_equalData( + const_cast< void * >( rAny.getValue() ), rAny.getValueTypeRef(), + const_cast< C * >( &value ), rType.getTypeLibType(), + ::com::sun::star::uno::cpp_queryInterface, + ::com::sun::star::uno::cpp_release ); +} + +} +} +} +} + +#endif diff --git a/cppu/inc/com/sun/star/uno/Reference.h b/cppu/inc/com/sun/star/uno/Reference.h new file mode 100644 index 000000000000..4db47ad47402 --- /dev/null +++ b/cppu/inc/com/sun/star/uno/Reference.h @@ -0,0 +1,342 @@ +/************************************************************************* + * + * $RCSfile: Reference.h,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 15:25:51 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ +#ifndef _COM_SUN_STAR_UNO_REFERENCE_H_ +#define _COM_SUN_STAR_UNO_REFERENCE_H_ + +#ifndef _RTL_ALLOC_H_ +#include <rtl/alloc.h> +#endif + + +/** */ //for docpp +namespace com +{ +/** */ //for docpp +namespace sun +{ +/** */ //for docpp +namespace star +{ +/** */ //for docpp +namespace uno +{ + +class XInterface; + +/** Enum defining UNO_REF_NO_ACQUIRE for setting reference without acquiring a given interface. + <br> +*/ +enum __UnoReference_NoAcquire +{ + /** This enum value can be used for creating a reference granting a given + interface, i.e. transferring ownership to it. + <br> + */ + UNO_REF_NO_ACQUIRE = 0xbebeef +}; + +/** Base reference class holding/ acquiring an interface.<br> + Constructors acquire an interface while the destructor releases it. + This class serves as a base class for all template reference classes and + has been introduced due to compiler problems with templated operators ==, =!. + <br> +*/ +class BaseReference +{ + /** the interface pointer<br> + */ + XInterface * _pInterface; + +protected: + /** Default Constructor: + Sets null reference. + <br> + */ + inline BaseReference(); + /** Constructor: + Sets given interface pointer. + <br> + @param pInterface an interface pointer + */ + inline BaseReference( XInterface * pInterface ); + /** Constructor: + Sets reference to given interface pointer without acquiring it. + <br> + @param pInterface interface pointer + @param dummy UNO_REF_NO_ACQUIRE to force obvious distinction to other constructors + */ + inline BaseReference( XInterface * pInterface, __UnoReference_NoAcquire ); + /** Copy constructor: + Copies interface reference. + <br> + @param rRef another reference + */ + inline BaseReference( const BaseReference & rRef ); + /** Destructor: + Releases interface reference. + <br> + */ + inline ~BaseReference(); + +public: + // these are here to force memory de/allocation to sal lib. + inline static void * SAL_CALL operator new( size_t nSize ) throw() + { return ::rtl_allocateMemory( nSize ); } + inline static void SAL_CALL operator delete( void * pMem ) throw() + { ::rtl_freeMemory( pMem ); } + inline static void * SAL_CALL operator new( size_t, void * pMem ) throw() + { return pMem; } + inline static void SAL_CALL operator delete( void *, void * ) throw() + {} + + /** Sets interface pointer. An interface already set will be released. + <br> + @param pInterface an interface pointer + */ + inline void SAL_CALL set( XInterface * pInterface ); + /** Clears reference, i.e. releases interface. + Reference is null after clear() call. + <br> + */ + inline void SAL_CALL clear(); + /** Gets interface pointer. + This call does <b>not</b> acquire the interface. + <br> + @return <b>un</b>acquired interface pointer + */ + inline XInterface * SAL_CALL get() const + { return _pInterface; } + /** Checks if reference is null. + <br> + @return true if reference acquires an interface, i.e. is not null + */ + inline sal_Bool SAL_CALL is() const + { return (_pInterface != 0); } + /** Equality operator: compares two interfaces<br> + Checks if both references are null or refer to the same object. + <br> + @param rRef another reference + @return true if both references are null or refer to the same object, false otherwise + */ + inline sal_Bool SAL_CALL operator == ( const BaseReference & rRef ) const; + /** Unequality operator: compares two interfaces<br> + Checks if both references are null or refer to the same object. + <br> + @param rRef another reference + @return false if both references are null or refer to the same object, true otherwise + */ + inline sal_Bool SAL_CALL operator != ( const BaseReference & rRef ) const + { return (! operator == ( rRef )); } + + // needed for stl container operations, though this makes no sense on pointers + inline sal_Bool SAL_CALL operator < ( const BaseReference& rRef ) const + { return (_pInterface < rRef._pInterface); } +}; + +/** Enum defining UNO_QUERY and UNO_REF_NO_ACQUIRE for query interface constructor + of reference template. + <br> +*/ +enum __UnoReference_Query +{ + /** This enum value can be used for querying interface constructor of reference template. + <br> + */ + UNO_REF_QUERY = 0xdb0e121e, + UNO_QUERY = 0xdb0 +}; + +/** Template reference class for interface type derived from BaseReference. + A special constructor given the UNO_QUERY or UNO_REF_QUERY identifier queries interfaces + for reference type. + <br> +*/ +template< class interface_type > +class Reference : public BaseReference +{ +public: + // these are here to force memory de/allocation to sal lib. + static void * SAL_CALL operator new( size_t nSize ) throw() + { return ::rtl_allocateMemory( nSize ); } + static void SAL_CALL operator delete( void * pMem ) throw() + { ::rtl_freeMemory( pMem ); } + static void * SAL_CALL operator new( size_t, void * pMem ) throw() + { return pMem; } + static void SAL_CALL operator delete( void *, void * ) throw() + {} + + /** Default Constructor: + Sets null reference. + <br> + */ + inline Reference() + : BaseReference() + {} + /** Copy constructor: + Copies interface reference. + <br> + @param rRef another reference + */ + inline Reference( const Reference< interface_type > & rRef ) + : BaseReference( rRef ) + {} + /** Constructor: + Sets given interface pointer. + <br> + @param pInterface an interface pointer + */ + inline Reference( interface_type * pInterface ) + : BaseReference( pInterface ) + {} + + /** Constructor: + Sets given interface pointer without acquiring it. + <br> + @param pInterface another reference + @param dummy UNO_REF_NO_ACQUIRE to force obvious distinction to other constructors + */ + inline Reference( XInterface * pInterface, __UnoReference_NoAcquire ) + : BaseReference( pInterface, UNO_REF_NO_ACQUIRE ) + {} + + /** Constructor: + Queries given interface for reference interface type (<b>interface_type</b>). + <br> + @param rRef another reference + @param dummy UNO_QUERY or UNO_REF_QUERY to force obvious distinction to other constructors + */ + inline Reference( const BaseReference & rRef, __UnoReference_Query ) + : BaseReference( query( rRef ) ) + {} + /** Constructor: + Queries given interface for reference interface type (<b>interface_type</b>). + <br> + @param pInterface an interface pointer + @param dummy UNO_QUERY to force obvious distinction to other constructors + */ + inline Reference( XInterface * pInterface, __UnoReference_Query ) + : BaseReference( query( pInterface ) ) + {} + + /** Assignment operator: + Acquires given interface pointer and sets reference. + An interface already set will be released. + <br> + @param pInterface an interface pointer + @return this reference + */ + inline Reference< interface_type > & SAL_CALL operator = ( interface_type * pInterface ); + /** Assignment operator: + Acquires given interface reference and sets reference. + An interface already set will be released. + <br> + @param rRef an interface reference + @return this reference + */ + inline Reference< interface_type > & SAL_CALL operator = ( const Reference< interface_type > & rRef ) + { return operator = ( rRef.get() ); } + + /** Queries given interface for type <b>interface_type</b>. + <br> + @param pInterface interface pointer + @return interface reference of demanded type (may be null) + */ + inline static Reference< interface_type > SAL_CALL query( XInterface * pInterface ); + /** Queries given interface reference for type <b>interface_type</b>. + <br> + @param rRef interface reference + @return interface reference of demanded type (may be null) + */ + inline static Reference< interface_type > SAL_CALL query( const BaseReference & rRef ) + { return query( rRef.get() ); } + + /** Cast operatory to Reference< XInterface >: + Reference objects are binary compatible and any interface must be derived + from com.sun.star.uno.XInterface. + This a useful direct cast possibility. + <br> + */ + inline SAL_CALL operator const Reference< XInterface > & () const + { return * reinterpret_cast< const Reference< XInterface > * >( this ); } + + /** Dereference operator: + Used to call interface methods. + <br> + @return <b>un</b>acquired interface pointer + */ + interface_type * SAL_CALL operator -> () const + { return static_cast< interface_type * >( BaseReference::get() ); } + + /** Gets interface pointer. + This call does <b>not</b> acquire the interface. + <br> + @return <b>un</b>acquired interface pointer + */ + interface_type * SAL_CALL get() const + { return static_cast< interface_type * >( BaseReference::get() ); } +}; + +} +} +} +} + +#endif diff --git a/cppu/inc/com/sun/star/uno/Reference.hxx b/cppu/inc/com/sun/star/uno/Reference.hxx new file mode 100644 index 000000000000..adcc32fd493f --- /dev/null +++ b/cppu/inc/com/sun/star/uno/Reference.hxx @@ -0,0 +1,170 @@ +/************************************************************************* + * + * $RCSfile: Reference.hxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 15:25:51 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ +#ifndef _COM_SUN_STAR_UNO_REFERENCE_HXX_ +#define _COM_SUN_STAR_UNO_REFERENCE_HXX_ + +#ifndef _COM_SUN_STAR_UNO_REFERENCE_H_ +#include <com/sun/star/uno/Reference.h> +#endif +#ifndef _COM_SUN_STAR_UNO_XINTERFACE_HDL_ +#include <com/sun/star/uno/XInterface.hdl> +#endif +#ifndef _COM_SUN_STAR_UNO_GENFUNC_HXX_ +#include <com/sun/star/uno/genfunc.hxx> +#endif + +/** */ //for docpp +namespace com +{ +/** */ //for docpp +namespace sun +{ +/** */ //for docpp +namespace star +{ +/** */ //for docpp +namespace uno +{ + +//__________________________________________________________________________________________________ +inline BaseReference::BaseReference() + : _pInterface( 0 ) +{ +} +//__________________________________________________________________________________________________ +inline BaseReference::BaseReference( XInterface * pInterface ) + : _pInterface( pInterface ) +{ + if (_pInterface) + _pInterface->acquire(); +} +//__________________________________________________________________________________________________ +inline BaseReference::BaseReference( XInterface * pInterface, __UnoReference_NoAcquire ) + : _pInterface( pInterface ) +{ +} +//__________________________________________________________________________________________________ +inline BaseReference::BaseReference( const BaseReference & rRef ) + : _pInterface( rRef._pInterface ) +{ + if (_pInterface) + _pInterface->acquire(); +} +//__________________________________________________________________________________________________ +inline BaseReference::~BaseReference() +{ + if (_pInterface) + _pInterface->release(); +} +//__________________________________________________________________________________________________ +inline sal_Bool BaseReference::operator == ( const BaseReference & rRef ) const +{ + if (_pInterface == rRef._pInterface) + return sal_True; + // only the query to XInterface must return the same pointer if they belong to same objects + Reference< XInterface > x1( _pInterface, UNO_QUERY ); + Reference< XInterface > x2( rRef, UNO_QUERY ); + return (x1.get() == x2.get()); +} +//__________________________________________________________________________________________________ +inline void BaseReference::set( XInterface * pInterface ) +{ + if (pInterface != _pInterface) + { + if (pInterface) + pInterface->acquire(); + if (_pInterface) + _pInterface->release(); + _pInterface = pInterface; + } +} +//__________________________________________________________________________________________________ +inline void BaseReference::clear() +{ + if (_pInterface) + { + _pInterface->release(); + _pInterface = 0; + } +} + +//__________________________________________________________________________________________________ +template< class interface_type > +inline Reference< interface_type > & Reference< interface_type >::operator = ( interface_type * pInterface ) +{ + BaseReference::set( pInterface ); + return *this; +} +//__________________________________________________________________________________________________ +template< class interface_type > +inline Reference< interface_type > Reference< interface_type >::query( XInterface * pInterface ) +{ + const Type & rType = ::getCppuType( (const Reference< interface_type > *)0 ); + return Reference< interface_type >( reinterpret_cast< XInterface * >( + cpp_queryInterface( pInterface, rType.getTypeLibType() ) ), UNO_REF_NO_ACQUIRE ); +} + +} +} +} +} + +#endif diff --git a/cppu/inc/com/sun/star/uno/Sequence.h b/cppu/inc/com/sun/star/uno/Sequence.h new file mode 100644 index 000000000000..f87e78122e74 --- /dev/null +++ b/cppu/inc/com/sun/star/uno/Sequence.h @@ -0,0 +1,291 @@ +/************************************************************************* + * + * $RCSfile: Sequence.h,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 15:25:51 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ +#ifndef _COM_SUN_STAR_UNO_SEQUENCE_H_ +#define _COM_SUN_STAR_UNO_SEQUENCE_H_ + +#ifndef _CPPU_MACROS_HXX_ +#include <cppu/macros.hxx> +#endif + +#ifndef _TYPELIB_TYPEDESCRIPTION_H_ +#include <typelib/typedescription.h> +#endif +#ifndef _UNO_SEQUENCE2_H_ +#include <uno/sequence2.h> +#endif +#ifndef _COM_SUN_STAR_UNO_TYPE_H_ +#include <com/sun/star/uno/Type.h> +#endif + +#ifndef _RTL_ALLOC_H_ +#include <rtl/alloc.h> +#endif + + +namespace rtl +{ +class ByteSequence; +} + +/** */ //for docpp +namespace com +{ +/** */ //for docpp +namespace sun +{ +/** */ //for docpp +namespace star +{ +/** */ //for docpp +namespace uno +{ + +/** Template C++ class representing an IDL sequence<>. Template argument is + sequence element type<br> + C++ Sequences are reference counted and shared, so the sequence keeps a handle + to its data. + To keep value semantics, copies are only generated if the sequence is to be modified + (new handle). + <br> +*/ +template< class E > +class Sequence +{ + /** sequence handle<br> + */ + uno_Sequence * _pSequence; + +public: + // these are here to force memory de/allocation to sal lib. + inline static void * SAL_CALL operator new( size_t nSize ) throw() + { return ::rtl_allocateMemory( nSize ); } + inline static void SAL_CALL operator delete( void * pMem ) throw() + { ::rtl_freeMemory( pMem ); } + inline static void * SAL_CALL operator new( size_t, void * pMem ) throw() + { return pMem; } + inline static void SAL_CALL operator delete( void *, void * ) throw() + {} + + /** typedefs the element type of the sequence + <br> + */ + typedef E ElementType; + + /** Default constructor: + Creates an empty sequence. + <br> + */ + inline Sequence< E >(); + /** Copy constructor: + Creates a copy of given sequence. + <br> + @param rSeq another sequence of same type + */ + inline Sequence< E >( const Sequence< E > & rSeq ); + /** Constructor: + Creates a copy of given elements. + <br> + @param pElement an array of elements + @param len length of array + */ + inline Sequence< E >( const E * pElements, sal_Int32 len ); + /** Constructor: + Creates a default constructed sequence of given length. + <br> + @param len initial sequence length + */ + inline Sequence< E >( sal_Int32 len ); + /** Destructor: + Releases sequence handle. Last handle will destruct elements and free memory. + <br> + */ + inline ~Sequence< E >(); + + /** Assignment operator: + Acquires given sequence handle and releases previously set handle. + <br> + @param rSeq another sequence of same type + @return this sequence + */ + inline Sequence< E > & SAL_CALL operator = ( const Sequence< E > & rSeq ); + + /** Gets type of elements. + <br> + @return type of element + */ + inline const Type & getElementType() const + { return ::getCppuType( (const ElementType *)0 ); } + /** Gets length of sequence. + <br> + @return length of sequence + */ + inline sal_Int32 SAL_CALL getLength() const + { return _pSequence->nElements; } + + /** Gets a pointer to elements array for <b>reading</b>. + If the sequence has a length of 0, then the returned pointer is undefined. + <br> + @return pointer to elements array + */ + inline const E * SAL_CALL getConstArray() const + { return reinterpret_cast< const E * >( _pSequence->elements ); } + /** Gets a pointer to elements array for <b>reading and writing</b>.<br> + In general if the sequence has a handle acquired by other sequences + (reference count > 1), then a new sequence is created copy constructing + all elements to keep value semantics!<br> + If the sequence has a length of 0, then the returned pointer is undefined. + <br> + @return pointer to elements array + */ + inline E * SAL_CALL getArray(); + + /** Non-const index operator: + Obtains a reference to element indexed at given position.<br> + The implementation does <b>not</b> check for array bounds!<br> + In general if the sequence has a handle acquired by other sequences + (reference count > 1), then a new sequence is created copy constructing + all elements to keep value semantics! + <br> + @param nIndex index + @return non-const C++ reference to element + */ + inline E & SAL_CALL operator [] ( sal_Int32 nIndex ) + { return getArray()[ nIndex ]; } + /** Const index operator: + Obtains a reference to element indexed at given position.<br> + The implementation does <b>not</b> check for array bounds!<br> + <br> + @param nIndex index + @return const C++ reference to element + */ + inline const E & SAL_CALL operator [] ( sal_Int32 nIndex ) const + { return getConstArray()[ nIndex ]; } + + /** Equality operator: + Compares two sequences. + <br> + @param rSeq another sequence of same type (right side) + @return true if both sequences are equal, false otherwise + */ + inline sal_Bool SAL_CALL operator == ( const Sequence< E > & rSeq ) const; + /** Unequality operator: + Compares two sequences. + <br> + @param rSeq another sequence of same type (right side) + @return false if both sequences are equal, true otherwise + */ + inline sal_Bool SAL_CALL operator != ( const Sequence< E > & rSeq ) const + { return (! operator == ( rSeq )); } + + /** Reallocates sequence to new length. + If the new length is smaller than the former, then upper elements + will be destructed (and their memory freed). + If the new length is greater than the former, then upper (new) elements + are default constructed.<br> + If the sequence has a handle acquired by other sequences + (reference count > 1), then the remaining elements are copy constructed + to a new sequence handle to keep value semantics! + <br> + @param nSize new size of sequence + */ + inline void SAL_CALL realloc( sal_Int32 nSize ); +}; + +/** Creates an UNO byte sequence from a SAL byte sequence. + <br> + @param rByteSequence a byte sequence + @return an UNO byte sequence +*/ +inline ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL toUnoSequence( + const ::rtl::ByteSequence & rByteSequence ); + +} +} +} +} + +/** Gets the meta type of IDL sequence. + <br> + @param dummy typed pointer for function signature + @return type of IDL sequence +*/ +template< class S > +#if (defined(__SUNPRO_CC) && (__SUNPRO_CC == 0x500)) || (defined(__GNUC__) && defined(__APPLE__)) +inline const ::com::sun::star::uno::Type +#else +inline const ::com::sun::star::uno::Type & +#endif +SAL_CALL getCppuType( const ::com::sun::star::uno::Sequence< S > * ); + +/** Gets the meta type of IDL <b>sequence< char ></b>. + This function has been introduced due to ambiguities with unsigned short. + <br> + @param dummy typed pointer for function signature + @return type of IDL <b>sequence< char ></b> +*/ +#if (defined(__SUNPRO_CC) && (__SUNPRO_CC == 0x500)) || (defined(__GNUC__) && defined(__APPLE__)) +inline const ::com::sun::star::uno::Type +#else +inline const ::com::sun::star::uno::Type & +#endif +SAL_CALL getCharSequenceCppuType(); + +#endif diff --git a/cppu/inc/com/sun/star/uno/Sequence.hxx b/cppu/inc/com/sun/star/uno/Sequence.hxx new file mode 100644 index 000000000000..7b9e3065571e --- /dev/null +++ b/cppu/inc/com/sun/star/uno/Sequence.hxx @@ -0,0 +1,236 @@ +/************************************************************************* + * + * $RCSfile: Sequence.hxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 15:25:51 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ +#ifndef _COM_SUN_STAR_UNO_SEQUENCE_HXX_ +#define _COM_SUN_STAR_UNO_SEQUENCE_HXX_ + +#ifndef _CPPU_MACROS_HXX_ +#include <cppu/macros.hxx> +#endif + +#ifndef _OSL_INTERLCK_H_ +#include <osl/interlck.h> +#endif +#ifndef _COM_SUN_STAR_UNO_SEQUENCE_H_ +#include <com/sun/star/uno/Sequence.h> +#endif +#ifndef _TYPELIB_TYPEDESCRIPTION_H_ +#include <typelib/typedescription.h> +#endif +#ifndef _UNO_DATA_H_ +#include <uno/data.h> +#endif +#ifndef _COM_SUN_STAR_UNO_GENFUNC_HXX_ +#include <com/sun/star/uno/genfunc.hxx> +#endif + + +/** */ //for docpp +namespace com +{ +/** */ //for docpp +namespace sun +{ +/** */ //for docpp +namespace star +{ +/** */ //for docpp +namespace uno +{ + +//__________________________________________________________________________________________________ +template< class E > +inline Sequence< E >::Sequence() +{ + const Type & rType = ::getCppuType( this ); + ::uno_type_sequence_construct( &_pSequence, rType.getTypeLibType(), 0, 0, cpp_acquire ); +} +//__________________________________________________________________________________________________ +template< class E > +inline Sequence< E >::Sequence( const Sequence< E > & rSeq ) +{ + ::osl_incrementInterlockedCount( &rSeq._pSequence->nRefCount ); + _pSequence = rSeq._pSequence; +} +//__________________________________________________________________________________________________ +template< class E > +inline Sequence< E >::Sequence( const E * pElements, sal_Int32 len ) + : _pSequence( 0 ) +{ + const Type & rType = ::getCppuType( this ); + ::uno_type_sequence_construct( &_pSequence, rType.getTypeLibType(), + const_cast< E * >( pElements ), len, cpp_acquire ); +} +//__________________________________________________________________________________________________ +template< class E > +inline Sequence< E >::Sequence( sal_Int32 len ) + : _pSequence( 0 ) +{ + const Type & rType = ::getCppuType( this ); + ::uno_type_sequence_construct( &_pSequence, rType.getTypeLibType(), 0, len, cpp_acquire ); +} +//__________________________________________________________________________________________________ +template< class E > +inline Sequence< E >::~Sequence() +{ + const Type & rType = ::getCppuType( this ); + ::uno_type_destructData( this, rType.getTypeLibType(), cpp_release ); +} +//__________________________________________________________________________________________________ +template< class E > +inline Sequence< E > & Sequence< E >::operator = ( const Sequence< E > & rSeq ) +{ + const Type & rType = ::getCppuType( this ); + ::uno_type_sequence_assign( &_pSequence, rSeq._pSequence, rType.getTypeLibType(), cpp_release ); + return *this; +} +//__________________________________________________________________________________________________ +template< class E > +inline sal_Bool Sequence< E >::operator == ( const Sequence< E > & rSeq ) const +{ + if (_pSequence == rSeq._pSequence) + return sal_True; + const Type & rType = ::getCppuType( this ); + return ::uno_type_equalData( const_cast< Sequence< E > * >( this ), rType.getTypeLibType(), + const_cast< Sequence< E > * >( &rSeq ), rType.getTypeLibType(), + cpp_queryInterface, cpp_release ); +} +//__________________________________________________________________________________________________ +template< class E > +inline E * Sequence< E >::getArray() +{ + const Type & rType = ::getCppuType( this ); + ::uno_type_sequence_reference2One( &_pSequence, rType.getTypeLibType(), cpp_acquire, cpp_release ); + return reinterpret_cast< E * >( _pSequence->elements ); +} +//__________________________________________________________________________________________________ +template< class E > +inline void Sequence< E >::realloc( sal_Int32 nSize ) +{ + const Type & rType = ::getCppuType( this ); + ::uno_type_sequence_realloc( &_pSequence, rType.getTypeLibType(), nSize, cpp_acquire, cpp_release ); +} + +//-------------------------------------------------------------------------------------------------- +inline ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL toUnoSequence( + const ::rtl::ByteSequence & rByteSequence ) +{ + return ::com::sun::star::uno::Sequence< sal_Int8 >( + * reinterpret_cast< const ::com::sun::star::uno::Sequence< sal_Int8 > * >( &rByteSequence ) ); +} + +} +} +} +} + +// generic sequence template +template< class S > +#if (defined(__SUNPRO_CC) && (__SUNPRO_CC == 0x500)) || (defined(__GNUC__) && defined(__APPLE__)) +inline const ::com::sun::star::uno::Type +#else +inline const ::com::sun::star::uno::Type & +#endif +SAL_CALL getCppuType( const ::com::sun::star::uno::Sequence< S > * ) +{ +#if (defined(__SUNPRO_CC) && (__SUNPRO_CC == 0x500)) || (defined(__GNUC__) && defined(__APPLE__)) + typelib_TypeDescriptionReference * s_pType = 0; +#else + static typelib_TypeDescriptionReference * s_pType = 0; + if (! s_pType) + { +#endif + const ::com::sun::star::uno::Type & rElementType = ::getCppuType( + (::com::sun::star::uno::Sequence< S >::ElementType *)0 ); + ::typelib_static_sequence_type_init( &s_pType, rElementType.getTypeLibType() ); +#if !( (defined(__SUNPRO_CC) && (__SUNPRO_CC == 0x500)) || (defined(__GNUC__) && defined(__APPLE__))) + } + return * reinterpret_cast< const ::com::sun::star::uno::Type * >( &s_pType ); +#else + return ::com::sun::star::uno::Type( s_pType ); +#endif +} + +// char sequence +#if (defined(__SUNPRO_CC) && (__SUNPRO_CC == 0x500)) || (defined(__GNUC__) && defined(__APPLE__)) +inline const ::com::sun::star::uno::Type +#else +inline const ::com::sun::star::uno::Type & +#endif +SAL_CALL getCharSequenceCppuType() +{ +#if (defined(__SUNPRO_CC) && (__SUNPRO_CC == 0x500)) || (defined(__GNUC__) && defined(__APPLE__)) + typelib_TypeDescriptionReference * s_pType = 0; +#else + static typelib_TypeDescriptionReference * s_pType = 0; + if (! s_pType) + { +#endif + const ::com::sun::star::uno::Type & rElementType = ::getCharCppuType(); + ::typelib_static_sequence_type_init( &s_pType, rElementType.getTypeLibType() ); +#if ! ((defined(__SUNPRO_CC) && (__SUNPRO_CC == 0x500)) || (defined(__GNUC__) && defined(__APPLE__))) + } + return * reinterpret_cast< const ::com::sun::star::uno::Type * >( &s_pType ); +#else + return ::com::sun::star::uno::Type( s_pType ); +#endif +} + +#endif diff --git a/cppu/inc/com/sun/star/uno/Type.h b/cppu/inc/com/sun/star/uno/Type.h new file mode 100644 index 000000000000..7765d4e910ce --- /dev/null +++ b/cppu/inc/com/sun/star/uno/Type.h @@ -0,0 +1,364 @@ +/************************************************************************* + * + * $RCSfile: Type.h,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 15:25:51 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ +#ifndef _COM_SUN_STAR_UNO_TYPE_H_ +#define _COM_SUN_STAR_UNO_TYPE_H_ + +#ifndef _TYPELIB_TYPEDESCRIPTION_H_ +#include <typelib/typedescription.h> +#endif +#ifndef _COM_SUN_STAR_UNO_TYPECLASS_HDL_ +#include <com/sun/star/uno/TypeClass.hdl> +#endif +#ifndef _CPPU_MACROS_HXX_ +#include <cppu/macros.hxx> +#endif +#ifndef _RTL_USTRING_HXX_ +#include <rtl/ustring.hxx> +#endif + +#ifndef _RTL_ALLOC_H_ +#include <rtl/alloc.h> +#endif + + +/** */ //for docpp +namespace com +{ +/** */ //for docpp +namespace sun +{ +/** */ //for docpp +namespace star +{ +/** */ //for docpp +namespace uno +{ + +/** Enum defining UNO_TYPE_NO_ACQUIRE for type description reference transfer. + <br> +*/ +enum __UnoType_NoAcquire +{ + /** This enum value can be used for creating a Type object granting a given + type description reference, i.e. transferring ownership to it. + <br> + */ + UNO_TYPE_NO_ACQUIRE = 0xbebeef1e +}; + +/** C++ class representing an IDL meta type. + This class is used to represent a a type, i.e. a type name and its type class.<br> + Internally the type holds a C type description reference of the runtime. + You can obtain a full type description of a type by calling member function + getDescription(). + <br> +*/ +class Type +{ + /** the C typelib reference pointer<br> + */ + typelib_TypeDescriptionReference * _pType; + +public: + // these are here to force memory de/allocation to sal lib. + inline static void * SAL_CALL operator new( size_t nSize ) throw() + { return ::rtl_allocateMemory( nSize ); } + inline static void SAL_CALL operator delete( void * pMem ) throw() + { ::rtl_freeMemory( pMem ); } + inline static void * SAL_CALL operator new( size_t, void * pMem ) throw() + { return pMem; } + inline static void SAL_CALL operator delete( void *, void * ) throw() + {} + + /** Default Constructor: + Type is set to void. + <br> + */ + inline Type(); + + /** Constructor: + Type is constructed by given name and type class. + <br> + @param eTypeClass type class of type + @param rTypeName name of type + */ + inline Type( TypeClass eTypeClass, const ::rtl::OUString & rTypeName ); + + /** Constructor: + Type is constructed by given name and type class. + <br> + @param eTypeClass type class of type + @param pTypeName name of type + */ + inline Type( TypeClass eTypeClass, const sal_Char * pTypeName ); + + /** Constructor: + Type is (copy) constructed by given C type description reference. + <br> + @param pType C type description reference + */ + inline Type( typelib_TypeDescriptionReference * pType ); + + /** Constructor: + Type is (copy) constructed by given C type description reference without acquiring it. + <br> + @param pType C type description reference + @param dummy UNO_TYPE_NO_ACQUIRE to force obvious distinction to other constructors + */ + inline Type( typelib_TypeDescriptionReference * pType, __UnoType_NoAcquire ); + + /** Copy constructor: + Type is copy constructed by given type. + <br> + @param rType another type + */ + inline Type( const Type & rType ); + + /** Destructor: + Releases acquired C type description reference. + <br> + */ + inline ~Type() + { ::typelib_typedescriptionreference_release( _pType ); } + + /** Assignment operator: + Acquires right side type and releases previously set type. + <br> + @param rType another type (right side) + @return this type + */ + inline Type & SAL_CALL operator = ( const Type & rType ); + + /** Gets the type class of set type. + <br> + @return type class of set type + */ + inline TypeClass SAL_CALL getTypeClass() const + { return (TypeClass)_pType->eTypeClass; } + + /** Gets the name of the set type. + <br> + @return name of the set type + */ + inline ::rtl::OUString SAL_CALL getTypeName() const + { return ::rtl::OUString( _pType->pTypeName ); } + + /** Obtains a full type description of set type. + <br> + @param ppDescr [inout] type description + */ + inline void SAL_CALL getDescription( typelib_TypeDescription ** ppDescr ) const + { ::typelib_typedescriptionreference_getDescription( ppDescr, _pType ); } + + /** Gets the C typelib type description reference pointer. + Does <b>not</b> acquire the reference! + <br> + @return <b>un</b>acquired type description reference + */ + inline typelib_TypeDescriptionReference * SAL_CALL getTypeLibType() const + { return _pType; } + + /** Compares two types. + <br> + @param rType another type + @return true if both types refer the same type, false otherwise + */ + inline sal_Bool SAL_CALL equals( const Type & rType ) const + { return ::typelib_typedescriptionreference_equals( _pType, rType._pType ); } + /** Equality operator: + Compares two types. + <br> + @param rType another type + @return true if both types refer the same type, false otherwise + */ + inline sal_Bool SAL_CALL operator == ( const Type & rType ) const + { return equals( rType ); } + /** Unequality operator: + Compares two types. + <br> + @param rType another type + @return false if both types refer the same type, true otherwise + */ + inline sal_Bool SAL_CALL operator != ( const Type & rType ) const + { return (! equals( rType )); } +}; + +} +} +} +} + +/** Gets the meta type of IDL type <b>type</b>. + <br> + @param dummy typed pointer for function signature + @return type of IDL type <b>type</b> +*/ +inline const ::com::sun::star::uno::Type & SAL_CALL getCppuType( const ::com::sun::star::uno::Type * ); + +/** Gets the meta type of IDL type <b>void</b>. + @return type of IDL type <b>void</b> +*/ +inline const ::com::sun::star::uno::Type & SAL_CALL getCppuVoidType(); +/** Gets the meta type of IDL type <b>void</b>. + <br> + @return type of IDL type <b>void</b> +*/ +inline const ::com::sun::star::uno::Type & SAL_CALL getVoidCppuType(); + +/** Gets the meta type of IDL type <b>boolean</b>. + <br> + @return type of IDL type <b>boolean</b> +*/ +inline const ::com::sun::star::uno::Type & SAL_CALL getCppuBooleanType(); +/** Gets the meta type of IDL type <b>boolean</b>. + <br> + @return type of IDL type <b>boolean</b> +*/ +inline const ::com::sun::star::uno::Type & SAL_CALL getBooleanCppuType(); +/** Gets the meta type of IDL type <b>boolean</b>. + <br> + @param dummy typed pointer for function signature + @return type of IDL type <b>boolean</b> +*/ +inline const ::com::sun::star::uno::Type & SAL_CALL getCppuType( const sal_Bool * ); + +/** Gets the meta type of IDL type <b>char</b>. + <br> + @return type of IDL type <b>char</b> +*/ +inline const ::com::sun::star::uno::Type & SAL_CALL getCharCppuType(); +/** Gets the meta type of IDL type <b>char</b>. + <br> + @return type of IDL type <b>char</b> +*/ +inline const ::com::sun::star::uno::Type & SAL_CALL getCppuCharType(); + +/** Gets the meta type of IDL type <b>byte</b>. + <br> + @param dummy typed pointer for function signature + @return type of IDL type <b>byte</b> +*/ +inline const ::com::sun::star::uno::Type & SAL_CALL getCppuType( const sal_Int8 * ); + +/** Gets the meta type of IDL type <b>string</b>. + <br> + @param dummy typed pointer for function signature + @return type of IDL type <b>string</b> +*/ +inline const ::com::sun::star::uno::Type & SAL_CALL getCppuType( const ::rtl::OUString * ); + +/** Gets the meta type of IDL type <b>short</b>. + <br> + @param dummy typed pointer for function signature + @return type of IDL type <b>short</b> +*/ +inline const ::com::sun::star::uno::Type & SAL_CALL getCppuType( const sal_Int16 * ); + +/** Gets the meta type of IDL type <b>unsigned short</b>. + <br> + @param dummy typed pointer for function signature + @return type of IDL type <b>unsigned short</b> +*/ +inline const ::com::sun::star::uno::Type & SAL_CALL getCppuType( const sal_uInt16 * ); + +/** Gets the meta type of IDL type <b>long</b>. + <br> + @param dummy typed pointer for function signature + @return type of IDL type <b>long</b> +*/ +inline const ::com::sun::star::uno::Type & SAL_CALL getCppuType( const sal_Int32 * ); + +/** Gets the meta type of IDL type <b>unsigned long</b>. + <br> + @param dummy typed pointer for function signature + @return type of IDL type <b>unsigned long</b> +*/ +inline const ::com::sun::star::uno::Type & SAL_CALL getCppuType( const sal_uInt32 * ); + +/** Gets the meta type of IDL type <b>hyper</b>. + <br> + @param dummy typed pointer for function signature + @return type of IDL type <b>hyper</b> +*/ +inline const ::com::sun::star::uno::Type & SAL_CALL getCppuType( const sal_Int64 * ); + +/** Gets the meta type of IDL type <b>unsigned hyper</b>. + <br> + @param dummy typed pointer for function signature + @return type of IDL type <b>unsigned hyper</b> +*/ +inline const ::com::sun::star::uno::Type & SAL_CALL getCppuType( const sal_uInt64 * ); + +/** Gets the meta type of IDL type <b>float</b>. + <br> + @param dummy typed pointer for function signature + @return type of IDL type <b>float</b> +*/ +inline const ::com::sun::star::uno::Type & SAL_CALL getCppuType( const float * ); + +/** Gets the meta type of IDL type <b>double</b>. + <br> + @param dummy typed pointer for function signature + @return type of IDL type <b>double</b> +*/ +inline const ::com::sun::star::uno::Type & SAL_CALL getCppuType( const double * ); + +#endif diff --git a/cppu/inc/com/sun/star/uno/Type.hxx b/cppu/inc/com/sun/star/uno/Type.hxx new file mode 100644 index 000000000000..f40eb7fb602d --- /dev/null +++ b/cppu/inc/com/sun/star/uno/Type.hxx @@ -0,0 +1,238 @@ +/************************************************************************* + * + * $RCSfile: Type.hxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 15:25:51 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ +#ifndef _COM_SUN_STAR_UNO_TYPE_HXX_ +#define _COM_SUN_STAR_UNO_TYPE_HXX_ + +#ifndef _OSL_MUTEX_HXX_ +#include <osl/mutex.hxx> +#endif + +#ifndef _COM_SUN_STAR_UNO_TYPE_H_ +#include <com/sun/star/uno/Type.h> +#endif + + +/** */ //for docpp +namespace com +{ +/** */ //for docpp +namespace sun +{ +/** */ //for docpp +namespace star +{ +/** */ //for docpp +namespace uno +{ + +//__________________________________________________________________________________________________ +inline Type::Type() +{ + _pType = reinterpret_cast< const ::com::sun::star::uno::Type * >( + ::typelib_static_type_getByTypeClass( typelib_TypeClass_VOID ) )->getTypeLibType(); + ::typelib_typedescriptionreference_acquire( _pType ); +} +//__________________________________________________________________________________________________ +inline Type::Type( TypeClass eTypeClass, const ::rtl::OUString & rTypeName ) + : _pType( 0 ) +{ + ::typelib_typedescriptionreference_new( &_pType, (typelib_TypeClass)eTypeClass, rTypeName.pData ); +} +//__________________________________________________________________________________________________ +inline Type::Type( TypeClass eTypeClass, const sal_Char * pTypeName ) + : _pType( 0 ) +{ + ::typelib_typedescriptionreference_newByAsciiName( &_pType, (typelib_TypeClass)eTypeClass, pTypeName ); +} +//__________________________________________________________________________________________________ +inline Type::Type( typelib_TypeDescriptionReference * pType ) + : _pType( pType ) +{ + ::typelib_typedescriptionreference_acquire( _pType ); +} +//__________________________________________________________________________________________________ +inline Type::Type( typelib_TypeDescriptionReference * pType, __UnoType_NoAcquire ) + : _pType( pType ) +{ +} +//__________________________________________________________________________________________________ +inline Type::Type( const Type & rType ) + : _pType( rType._pType ) +{ + ::typelib_typedescriptionreference_acquire( _pType ); +} +//__________________________________________________________________________________________________ +inline Type & Type::operator = ( const Type & rType ) +{ + ::typelib_typedescriptionreference_assign( &_pType, rType._pType ); + return *this; +} + +} +} +} +} + +inline const ::com::sun::star::uno::Type & SAL_CALL getCppuType( const ::com::sun::star::uno::Type * ) +{ + return * reinterpret_cast< const ::com::sun::star::uno::Type * >( + ::typelib_static_type_getByTypeClass( typelib_TypeClass_TYPE ) ); +} + +inline const ::com::sun::star::uno::Type & SAL_CALL getCppuVoidType() +{ + return * reinterpret_cast< const ::com::sun::star::uno::Type * >( + ::typelib_static_type_getByTypeClass( typelib_TypeClass_VOID ) ); +} +inline const ::com::sun::star::uno::Type & SAL_CALL getVoidCppuType() +{ + return * reinterpret_cast< const ::com::sun::star::uno::Type * >( + ::typelib_static_type_getByTypeClass( typelib_TypeClass_VOID ) ); +} + +inline const ::com::sun::star::uno::Type & SAL_CALL getCppuBooleanType() +{ + return * reinterpret_cast< const ::com::sun::star::uno::Type * >( + ::typelib_static_type_getByTypeClass( typelib_TypeClass_BOOLEAN ) ); +} +inline const ::com::sun::star::uno::Type & SAL_CALL getBooleanCppuType() +{ + return * reinterpret_cast< const ::com::sun::star::uno::Type * >( + ::typelib_static_type_getByTypeClass( typelib_TypeClass_BOOLEAN ) ); +} +inline const ::com::sun::star::uno::Type & SAL_CALL getCppuType( const sal_Bool * ) +{ + return * reinterpret_cast< const ::com::sun::star::uno::Type * >( + ::typelib_static_type_getByTypeClass( typelib_TypeClass_BOOLEAN ) ); +} + +inline const ::com::sun::star::uno::Type & SAL_CALL getCharCppuType() +{ + return * reinterpret_cast< const ::com::sun::star::uno::Type * >( + ::typelib_static_type_getByTypeClass( typelib_TypeClass_CHAR ) ); +} +inline const ::com::sun::star::uno::Type & SAL_CALL getCppuCharType() +{ + return * reinterpret_cast< const ::com::sun::star::uno::Type * >( + ::typelib_static_type_getByTypeClass( typelib_TypeClass_CHAR ) ); +} + +inline const ::com::sun::star::uno::Type & SAL_CALL getCppuType( const sal_Int8 * ) +{ + return * reinterpret_cast< const ::com::sun::star::uno::Type * >( + ::typelib_static_type_getByTypeClass( typelib_TypeClass_BYTE ) ); +} + +inline const ::com::sun::star::uno::Type & SAL_CALL getCppuType( const ::rtl::OUString * ) +{ + return * reinterpret_cast< const ::com::sun::star::uno::Type * >( + ::typelib_static_type_getByTypeClass( typelib_TypeClass_STRING ) ); +} + +inline const ::com::sun::star::uno::Type & SAL_CALL getCppuType( const sal_Int16 * ) +{ + return * reinterpret_cast< const ::com::sun::star::uno::Type * >( + ::typelib_static_type_getByTypeClass( typelib_TypeClass_SHORT ) ); +} + +inline const ::com::sun::star::uno::Type & SAL_CALL getCppuType( const sal_uInt16 * ) +{ + return * reinterpret_cast< const ::com::sun::star::uno::Type * >( + ::typelib_static_type_getByTypeClass( typelib_TypeClass_UNSIGNED_SHORT ) ); +} + +inline const ::com::sun::star::uno::Type & SAL_CALL getCppuType( const sal_Int32 * ) +{ + return * reinterpret_cast< const ::com::sun::star::uno::Type * >( + ::typelib_static_type_getByTypeClass( typelib_TypeClass_LONG ) ); +} + +inline const ::com::sun::star::uno::Type & SAL_CALL getCppuType( const sal_uInt32 * ) +{ + return * reinterpret_cast< const ::com::sun::star::uno::Type * >( + ::typelib_static_type_getByTypeClass( typelib_TypeClass_UNSIGNED_LONG ) ); +} + +inline const ::com::sun::star::uno::Type & SAL_CALL getCppuType( const sal_Int64 * ) +{ + return * reinterpret_cast< const ::com::sun::star::uno::Type * >( + ::typelib_static_type_getByTypeClass( typelib_TypeClass_HYPER ) ); +} + +inline const ::com::sun::star::uno::Type & SAL_CALL getCppuType( const sal_uInt64 * ) +{ + return * reinterpret_cast< const ::com::sun::star::uno::Type * >( + ::typelib_static_type_getByTypeClass( typelib_TypeClass_UNSIGNED_HYPER ) ); +} + +inline const ::com::sun::star::uno::Type & SAL_CALL getCppuType( const float * ) +{ + return * reinterpret_cast< const ::com::sun::star::uno::Type * >( + ::typelib_static_type_getByTypeClass( typelib_TypeClass_FLOAT ) ); +} + +inline const ::com::sun::star::uno::Type & SAL_CALL getCppuType( const double * ) +{ + return * reinterpret_cast< const ::com::sun::star::uno::Type * >( + ::typelib_static_type_getByTypeClass( typelib_TypeClass_DOUBLE ) ); +} + +#endif diff --git a/cppu/inc/com/sun/star/uno/genfunc.h b/cppu/inc/com/sun/star/uno/genfunc.h new file mode 100644 index 000000000000..853fb6828020 --- /dev/null +++ b/cppu/inc/com/sun/star/uno/genfunc.h @@ -0,0 +1,105 @@ +/************************************************************************* + * + * $RCSfile: genfunc.h,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 15:25:51 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ +#ifndef _COM_SUN_STAR_UNO_GENFUNC_H_ +#define _COM_SUN_STAR_UNO_GENFUNC_H_ + +typedef struct _typelib_TypeDescriptionReference typelib_TypeDescriptionReference; + +/** */ //for docpp +namespace com +{ +/** */ //for docpp +namespace sun +{ +/** */ //for docpp +namespace star +{ +/** */ //for docpp +namespace uno +{ + +extern "C" +{ +/** C function to acquire a C++ interface. + <br> + @param pCppI C++ interface pointer +*/ +inline void SAL_CALL cpp_acquire( void * pCppI ); +/** C function to release a C++ interface. + <br> + @param pCppI C++ interface pointer +*/ +inline void SAL_CALL cpp_release( void * pCppI ); +/** C function to query for a C++ interface. + <br> + @param pCppI C++ interface pointer + @param pType demanded interface type + @return acquired C++ interface pointer or null +*/ +inline void * SAL_CALL cpp_queryInterface( void * pCppI, typelib_TypeDescriptionReference * pType ); +} + +} +} +} +} + +#endif diff --git a/cppu/inc/com/sun/star/uno/genfunc.hxx b/cppu/inc/com/sun/star/uno/genfunc.hxx new file mode 100644 index 000000000000..e392126a76c9 --- /dev/null +++ b/cppu/inc/com/sun/star/uno/genfunc.hxx @@ -0,0 +1,120 @@ +/************************************************************************* + * + * $RCSfile: genfunc.hxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 15:25:51 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ +#ifndef _COM_SUN_STAR_UNO_GENFUNC_HXX_ +#define _COM_SUN_STAR_UNO_GENFUNC_HXX_ + +#ifndef _COM_SUN_STAR_UNO_GENFUNC_H_ +#include <com/sun/star/uno/genfunc.h> +#endif +#ifndef _COM_SUN_STAR_UNO_ANY_HXX_ +#include <com/sun/star/uno/Any.hxx> +#endif + + +/** */ //for docpp +namespace com +{ +/** */ //for docpp +namespace sun +{ +/** */ //for docpp +namespace star +{ +/** */ //for docpp +namespace uno +{ + +extern "C" +{ +//================================================================================================== +inline void SAL_CALL cpp_acquire( void * pCppI ) +{ + reinterpret_cast< XInterface * >( pCppI )->acquire(); +} +//================================================================================================== +inline void SAL_CALL cpp_release( void * pCppI ) +{ + reinterpret_cast< XInterface * >( pCppI )->release(); +} +//================================================================================================== +inline void * SAL_CALL cpp_queryInterface( void * pCppI, typelib_TypeDescriptionReference * pType ) +{ + if (pCppI) + { + Any aRet( reinterpret_cast< XInterface * >( pCppI )->queryInterface( + * reinterpret_cast< const Type * >( &pType ) ) ); + if (aRet.hasValue()) + { + XInterface * pRet = * reinterpret_cast< XInterface * const * >( aRet.getValue() ); + pRet->acquire(); + return pRet; + } + } + return 0; +} +} + +} +} +} +} + +#endif |