UDK 3.2.7 C/C++ API Reference

typelib/typedescription.hxx

Go to the documentation of this file.
00001 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
00002 /*
00003  * This file is part of the LibreOffice project.
00004  *
00005  * This Source Code Form is subject to the terms of the Mozilla Public
00006  * License, v. 2.0. If a copy of the MPL was not distributed with this
00007  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
00008  *
00009  * This file incorporates work covered by the following license notice:
00010  *
00011  *   Licensed to the Apache Software Foundation (ASF) under one or more
00012  *   contributor license agreements. See the NOTICE file distributed
00013  *   with this work for additional information regarding copyright
00014  *   ownership. The ASF licenses this file to you under the Apache
00015  *   License, Version 2.0 (the "License"); you may not use this file
00016  *   except in compliance with the License. You may obtain a copy of
00017  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
00018  */
00019 #ifndef _TYPELIB_TYPEDESCRIPTION_HXX_
00020 #define _TYPELIB_TYPEDESCRIPTION_HXX_
00021 
00022 #include <rtl/alloc.h>
00023 #include <rtl/ustring.hxx>
00024 #include <com/sun/star/uno/Type.h>
00025 #include <typelib/typedescription.h>
00026 
00027 
00028 namespace com
00029 {
00030 namespace sun
00031 {
00032 namespace star
00033 {
00034 namespace uno
00035 {
00036 
00042 class TypeDescription
00043 {
00046     mutable typelib_TypeDescription * _pTypeDescr;
00047 
00048 public:
00050     // these are here to force memory de/allocation to sal lib.
00051     inline static void * SAL_CALL operator new ( size_t nSize ) SAL_THROW(())
00052         { return ::rtl_allocateMemory( nSize ); }
00053     inline static void SAL_CALL operator delete ( void * pMem ) SAL_THROW(())
00054         { ::rtl_freeMemory( pMem ); }
00055     inline static void * SAL_CALL operator new ( size_t, void * pMem ) SAL_THROW(())
00056         { return pMem; }
00057     inline static void SAL_CALL operator delete ( void *, void * ) SAL_THROW(())
00058         {}
00060 
00065     inline TypeDescription( typelib_TypeDescription * pTypeDescr = 0 ) SAL_THROW(());
00070     inline TypeDescription( typelib_TypeDescriptionReference * pTypeDescrRef ) SAL_THROW(());
00075     inline TypeDescription( const ::com::sun::star::uno::Type & rType ) SAL_THROW(());
00080     inline TypeDescription( const TypeDescription & rDescr ) SAL_THROW(());
00085     inline TypeDescription( rtl_uString * pTypeName ) SAL_THROW(());
00090     inline TypeDescription( const ::rtl::OUString & rTypeName ) SAL_THROW(());
00093     inline ~TypeDescription() SAL_THROW(());
00094 
00100     inline TypeDescription & SAL_CALL operator = ( typelib_TypeDescription * pTypeDescr ) SAL_THROW(());
00106     inline TypeDescription & SAL_CALL operator =( const TypeDescription & rTypeDescr ) SAL_THROW(())
00107         { return this->operator =( rTypeDescr.get() ); }
00108 
00114     inline sal_Bool SAL_CALL equals( const typelib_TypeDescription * pTypeDescr ) const SAL_THROW(());
00120     inline sal_Bool SAL_CALL equals( const TypeDescription & rTypeDescr ) const SAL_THROW(())
00121         { return equals( rTypeDescr._pTypeDescr ); }
00122 
00125     inline void SAL_CALL makeComplete() const SAL_THROW(());
00126 
00131     inline typelib_TypeDescription * SAL_CALL get() const SAL_THROW(())
00132         { return _pTypeDescr; }
00137     inline sal_Bool SAL_CALL is() const SAL_THROW(())
00138         { return (_pTypeDescr != 0); }
00139 };
00140 //__________________________________________________________________________________________________
00141 inline TypeDescription::TypeDescription( typelib_TypeDescription * pTypeDescr ) SAL_THROW(())
00142     : _pTypeDescr( pTypeDescr )
00143 {
00144     if (_pTypeDescr)
00145         typelib_typedescription_acquire( _pTypeDescr );
00146 }
00147 //__________________________________________________________________________________________________
00148 inline TypeDescription::TypeDescription( typelib_TypeDescriptionReference * pTypeDescrRef ) SAL_THROW(())
00149     : _pTypeDescr( 0 )
00150 {
00151     if (pTypeDescrRef)
00152         typelib_typedescriptionreference_getDescription( &_pTypeDescr, pTypeDescrRef );
00153 }
00154 //__________________________________________________________________________________________________
00155 inline TypeDescription::TypeDescription( const ::com::sun::star::uno::Type & rType ) SAL_THROW(())
00156     : _pTypeDescr( 0 )
00157 {
00158     if (rType.getTypeLibType())
00159         typelib_typedescriptionreference_getDescription( &_pTypeDescr, rType.getTypeLibType() );
00160 }
00161 //__________________________________________________________________________________________________
00162 inline TypeDescription::TypeDescription( const TypeDescription & rTypeDescr ) SAL_THROW(())
00163     : _pTypeDescr( rTypeDescr._pTypeDescr )
00164 {
00165     if (_pTypeDescr)
00166         typelib_typedescription_acquire( _pTypeDescr );
00167 }
00168 //__________________________________________________________________________________________________
00169 inline TypeDescription::TypeDescription( rtl_uString * pTypeName ) SAL_THROW(())
00170     : _pTypeDescr( 0 )
00171 {
00172     typelib_typedescription_getByName( &_pTypeDescr , pTypeName );
00173 }
00174 //__________________________________________________________________________________________________
00175 inline TypeDescription::TypeDescription( const ::rtl::OUString & rTypeName ) SAL_THROW(())
00176     : _pTypeDescr( 0 )
00177 {
00178     typelib_typedescription_getByName( &_pTypeDescr , rTypeName.pData );
00179 }
00180 //__________________________________________________________________________________________________
00181 inline TypeDescription::~TypeDescription() SAL_THROW(())
00182 {
00183     if (_pTypeDescr)
00184         typelib_typedescription_release( _pTypeDescr );
00185 }
00186 //__________________________________________________________________________________________________
00187 inline TypeDescription & TypeDescription::operator = ( typelib_TypeDescription * pTypeDescr ) SAL_THROW(())
00188 {
00189     if (pTypeDescr)
00190         typelib_typedescription_acquire( pTypeDescr );
00191     if (_pTypeDescr)
00192         typelib_typedescription_release( _pTypeDescr );
00193     _pTypeDescr = pTypeDescr;
00194     return *this;
00195 }
00196 //__________________________________________________________________________________________________
00197 inline sal_Bool TypeDescription::equals( const typelib_TypeDescription * pTypeDescr ) const SAL_THROW(())
00198 {
00199     return (_pTypeDescr && pTypeDescr &&
00200             typelib_typedescription_equals( _pTypeDescr, pTypeDescr ));
00201 }
00202 //__________________________________________________________________________________________________
00203 inline void TypeDescription::makeComplete() const SAL_THROW(())
00204 {
00205     if (_pTypeDescr && !_pTypeDescr->bComplete)
00206         ::typelib_typedescription_complete( &_pTypeDescr );
00207 }
00208 
00209 }
00210 }
00211 }
00212 }
00213 
00214 #endif
00215 
00216 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines