LCOV - code coverage report
Current view: top level - libreoffice/solver/unxlngi6.pro/inc/typelib - typedescription.hxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 47 53 88.7 %
Date: 2012-12-27 Functions: 13 14 92.9 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
       2             : /*
       3             :  * This file is part of the LibreOffice project.
       4             :  *
       5             :  * This Source Code Form is subject to the terms of the Mozilla Public
       6             :  * License, v. 2.0. If a copy of the MPL was not distributed with this
       7             :  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
       8             :  *
       9             :  * This file incorporates work covered by the following license notice:
      10             :  *
      11             :  *   Licensed to the Apache Software Foundation (ASF) under one or more
      12             :  *   contributor license agreements. See the NOTICE file distributed
      13             :  *   with this work for additional information regarding copyright
      14             :  *   ownership. The ASF licenses this file to you under the Apache
      15             :  *   License, Version 2.0 (the "License"); you may not use this file
      16             :  *   except in compliance with the License. You may obtain a copy of
      17             :  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
      18             :  */
      19             : #ifndef _TYPELIB_TYPEDESCRIPTION_HXX_
      20             : #define _TYPELIB_TYPEDESCRIPTION_HXX_
      21             : 
      22             : #include <rtl/alloc.h>
      23             : #include <rtl/ustring.hxx>
      24             : #include <com/sun/star/uno/Type.h>
      25             : #include <typelib/typedescription.h>
      26             : 
      27             : 
      28             : namespace com
      29             : {
      30             : namespace sun
      31             : {
      32             : namespace star
      33             : {
      34             : namespace uno
      35             : {
      36             : 
      37             : /** C++ wrapper for typelib_TypeDescription.
      38             :     Constructors by name, type, type description reference will get the full type description.
      39             : 
      40             :     @see typelib_TypeDescription
      41             : */
      42             : class TypeDescription
      43             : {
      44             :     /** C typelib type description
      45             :     */
      46             :     mutable typelib_TypeDescription * _pTypeDescr;
      47             : 
      48             : public:
      49             :     /// @cond INTERNAL
      50             :     // these are here to force memory de/allocation to sal lib.
      51             :     inline static void * SAL_CALL operator new ( size_t nSize ) SAL_THROW(())
      52             :         { return ::rtl_allocateMemory( nSize ); }
      53             :     inline static void SAL_CALL operator delete ( void * pMem ) SAL_THROW(())
      54             :         { ::rtl_freeMemory( pMem ); }
      55             :     inline static void * SAL_CALL operator new ( size_t, void * pMem ) SAL_THROW(())
      56             :         { return pMem; }
      57             :     inline static void SAL_CALL operator delete ( void *, void * ) SAL_THROW(())
      58             :         {}
      59             :     /// @endcond
      60             : 
      61             :     /** Constructor:
      62             : 
      63             :         @param pTypeDescr a type description
      64             :     */
      65             :     inline TypeDescription( typelib_TypeDescription * pTypeDescr = 0 ) SAL_THROW(());
      66             :     /** Constructor:
      67             : 
      68             :         @param pTypeDescrRef a type description reference
      69             :     */
      70             :     inline TypeDescription( typelib_TypeDescriptionReference * pTypeDescrRef ) SAL_THROW(());
      71             :     /** Constructor:
      72             : 
      73             :         @param rType a type
      74             :     */
      75             :     inline TypeDescription( const ::com::sun::star::uno::Type & rType ) SAL_THROW(());
      76             :     /** Copy constructor:
      77             : 
      78             :         @param rDescr another TypeDescription
      79             :     */
      80             :     inline TypeDescription( const TypeDescription & rDescr ) SAL_THROW(());
      81             :     /** Constructor:
      82             : 
      83             :         @param pTypeName a type name
      84             :     */
      85             :     inline TypeDescription( rtl_uString * pTypeName ) SAL_THROW(());
      86             :     /** Constructor:
      87             : 
      88             :         @param rTypeName a type name
      89             :     */
      90             :     inline TypeDescription( const ::rtl::OUString & rTypeName ) SAL_THROW(());
      91             :     /** Destructor: releases type description
      92             :     */
      93             :     inline ~TypeDescription() SAL_THROW(());
      94             : 
      95             :     /** Assignment operator: acquires given type description and releases a set one.
      96             : 
      97             :         @param pTypeDescr another type description
      98             :         @return this TypeDescription
      99             :     */
     100             :     inline TypeDescription & SAL_CALL operator = ( typelib_TypeDescription * pTypeDescr ) SAL_THROW(());
     101             :     /** Assignment operator: acquires given type description and releases a set one.
     102             : 
     103             :         @param rTypeDescr another type description
     104             :         @return this TypeDescription
     105             :     */
     106           2 :     inline TypeDescription & SAL_CALL operator =( const TypeDescription & rTypeDescr ) SAL_THROW(())
     107           2 :         { return this->operator =( rTypeDescr.get() ); }
     108             : 
     109             :     /** Tests whether two type descriptions are equal.
     110             : 
     111             :         @param pTypeDescr another type description
     112             :         @return true, if both type descriptions are equal, false otherwise
     113             :     */
     114             :     inline sal_Bool SAL_CALL equals( const typelib_TypeDescription * pTypeDescr ) const SAL_THROW(());
     115             :     /** Tests whether two type descriptions are equal.
     116             : 
     117             :         @param rTypeDescr another type description
     118             :         @return true, if both type descriptions are equal, false otherwise
     119             :     */
     120           1 :     inline sal_Bool SAL_CALL equals( const TypeDescription & rTypeDescr ) const SAL_THROW(())
     121           1 :         { return equals( rTypeDescr._pTypeDescr ); }
     122             : 
     123             :     /** Makes stored type description complete.
     124             :     */
     125             :     inline void SAL_CALL makeComplete() const SAL_THROW(());
     126             : 
     127             :     /** Gets the UNacquired type description pointer.
     128             : 
     129             :         @return stored pointer of type description
     130             :     */
     131       12199 :     inline typelib_TypeDescription * SAL_CALL get() const SAL_THROW(())
     132       12199 :         { return _pTypeDescr; }
     133             :     /** Tests if a type description is set.
     134             : 
     135             :         @return true, if a type description is set, false otherwise
     136             :     */
     137           4 :     inline sal_Bool SAL_CALL is() const SAL_THROW(())
     138           4 :         { return (_pTypeDescr != 0); }
     139             : };
     140             : //__________________________________________________________________________________________________
     141         512 : inline TypeDescription::TypeDescription( typelib_TypeDescription * pTypeDescr ) SAL_THROW(())
     142         512 :     : _pTypeDescr( pTypeDescr )
     143             : {
     144         512 :     if (_pTypeDescr)
     145           0 :         typelib_typedescription_acquire( _pTypeDescr );
     146         512 : }
     147             : //__________________________________________________________________________________________________
     148        4297 : inline TypeDescription::TypeDescription( typelib_TypeDescriptionReference * pTypeDescrRef ) SAL_THROW(())
     149        4297 :     : _pTypeDescr( 0 )
     150             : {
     151        4297 :     if (pTypeDescrRef)
     152        4297 :         typelib_typedescriptionreference_getDescription( &_pTypeDescr, pTypeDescrRef );
     153        4297 : }
     154             : //__________________________________________________________________________________________________
     155          16 : inline TypeDescription::TypeDescription( const ::com::sun::star::uno::Type & rType ) SAL_THROW(())
     156          16 :     : _pTypeDescr( 0 )
     157             : {
     158          16 :     if (rType.getTypeLibType())
     159          16 :         typelib_typedescriptionreference_getDescription( &_pTypeDescr, rType.getTypeLibType() );
     160          16 : }
     161             : //__________________________________________________________________________________________________
     162           3 : inline TypeDescription::TypeDescription( const TypeDescription & rTypeDescr ) SAL_THROW(())
     163           3 :     : _pTypeDescr( rTypeDescr._pTypeDescr )
     164             : {
     165           3 :     if (_pTypeDescr)
     166           3 :         typelib_typedescription_acquire( _pTypeDescr );
     167           3 : }
     168             : //__________________________________________________________________________________________________
     169           0 : inline TypeDescription::TypeDescription( rtl_uString * pTypeName ) SAL_THROW(())
     170           0 :     : _pTypeDescr( 0 )
     171             : {
     172           0 :     typelib_typedescription_getByName( &_pTypeDescr , pTypeName );
     173           0 : }
     174             : //__________________________________________________________________________________________________
     175           2 : inline TypeDescription::TypeDescription( const ::rtl::OUString & rTypeName ) SAL_THROW(())
     176           2 :     : _pTypeDescr( 0 )
     177             : {
     178           2 :     typelib_typedescription_getByName( &_pTypeDescr , rTypeName.pData );
     179           2 : }
     180             : //__________________________________________________________________________________________________
     181        4830 : inline TypeDescription::~TypeDescription() SAL_THROW(())
     182             : {
     183        4830 :     if (_pTypeDescr)
     184        4318 :         typelib_typedescription_release( _pTypeDescr );
     185        4830 : }
     186             : //__________________________________________________________________________________________________
     187           2 : inline TypeDescription & TypeDescription::operator = ( typelib_TypeDescription * pTypeDescr ) SAL_THROW(())
     188             : {
     189           2 :     if (pTypeDescr)
     190           2 :         typelib_typedescription_acquire( pTypeDescr );
     191           2 :     if (_pTypeDescr)
     192           2 :         typelib_typedescription_release( _pTypeDescr );
     193           2 :     _pTypeDescr = pTypeDescr;
     194           2 :     return *this;
     195             : }
     196             : //__________________________________________________________________________________________________
     197           1 : inline sal_Bool TypeDescription::equals( const typelib_TypeDescription * pTypeDescr ) const SAL_THROW(())
     198             : {
     199             :     return (_pTypeDescr && pTypeDescr &&
     200           1 :             typelib_typedescription_equals( _pTypeDescr, pTypeDescr ));
     201             : }
     202             : //__________________________________________________________________________________________________
     203          17 : inline void TypeDescription::makeComplete() const SAL_THROW(())
     204             : {
     205          17 :     if (_pTypeDescr && !_pTypeDescr->bComplete)
     206           0 :         ::typelib_typedescription_complete( &_pTypeDescr );
     207          17 : }
     208             : 
     209             : }
     210             : }
     211             : }
     212             : }
     213             : 
     214             : #endif
     215             : 
     216             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10