LCOV - code coverage report
Current view: top level - solver/unxlngi6.pro/inc/typelib - typedescription.hxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 49 49 100.0 %
Date: 2012-08-25 Functions: 13 13 100.0 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 19 24 79.2 %

           Branch data     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                 :    1891725 :     inline TypeDescription & SAL_CALL operator =( const TypeDescription & rTypeDescr ) SAL_THROW(())
     107                 :    1891725 :         { 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                 :      46027 :     inline sal_Bool SAL_CALL equals( const TypeDescription & rTypeDescr ) const SAL_THROW(())
     121                 :      46027 :         { 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                 :   23829020 :     inline typelib_TypeDescription * SAL_CALL get() const SAL_THROW(())
     132                 :   23829020 :         { return _pTypeDescr; }
     133                 :            :     /** Tests if a type description is set.
     134                 :            : 
     135                 :            :         @return true, if a type description is set, false otherwise
     136                 :            :     */
     137                 :     937137 :     inline sal_Bool SAL_CALL is() const SAL_THROW(())
     138                 :     937137 :         { return (_pTypeDescr != 0); }
     139                 :            : };
     140                 :            : //__________________________________________________________________________________________________
     141                 :    2059835 : inline TypeDescription::TypeDescription( typelib_TypeDescription * pTypeDescr ) SAL_THROW(())
     142                 :    2059835 :     : _pTypeDescr( pTypeDescr )
     143                 :            : {
     144         [ +  + ]:    2059835 :     if (_pTypeDescr)
     145                 :      42581 :         typelib_typedescription_acquire( _pTypeDescr );
     146                 :    2059835 : }
     147                 :            : //__________________________________________________________________________________________________
     148                 :    2932519 : inline TypeDescription::TypeDescription( typelib_TypeDescriptionReference * pTypeDescrRef ) SAL_THROW(())
     149                 :    2932519 :     : _pTypeDescr( 0 )
     150                 :            : {
     151         [ +  - ]:    2932519 :     if (pTypeDescrRef)
     152                 :    2932519 :         typelib_typedescriptionreference_getDescription( &_pTypeDescr, pTypeDescrRef );
     153                 :    2932519 : }
     154                 :            : //__________________________________________________________________________________________________
     155                 :     611361 : inline TypeDescription::TypeDescription( const ::com::sun::star::uno::Type & rType ) SAL_THROW(())
     156                 :     611361 :     : _pTypeDescr( 0 )
     157                 :            : {
     158         [ +  - ]:     611361 :     if (rType.getTypeLibType())
     159                 :     611361 :         typelib_typedescriptionreference_getDescription( &_pTypeDescr, rType.getTypeLibType() );
     160                 :     611361 : }
     161                 :            : //__________________________________________________________________________________________________
     162                 :    2689867 : inline TypeDescription::TypeDescription( const TypeDescription & rTypeDescr ) SAL_THROW(())
     163                 :    2689867 :     : _pTypeDescr( rTypeDescr._pTypeDescr )
     164                 :            : {
     165         [ +  + ]:    2689867 :     if (_pTypeDescr)
     166                 :    2282332 :         typelib_typedescription_acquire( _pTypeDescr );
     167                 :    2689867 : }
     168                 :            : //__________________________________________________________________________________________________
     169                 :            : inline TypeDescription::TypeDescription( rtl_uString * pTypeName ) SAL_THROW(())
     170                 :            :     : _pTypeDescr( 0 )
     171                 :            : {
     172                 :            :     typelib_typedescription_getByName( &_pTypeDescr , pTypeName );
     173                 :            : }
     174                 :            : //__________________________________________________________________________________________________
     175                 :      55460 : inline TypeDescription::TypeDescription( const ::rtl::OUString & rTypeName ) SAL_THROW(())
     176                 :      55460 :     : _pTypeDescr( 0 )
     177                 :            : {
     178                 :      55460 :     typelib_typedescription_getByName( &_pTypeDescr , rTypeName.pData );
     179                 :      55460 : }
     180                 :            : //__________________________________________________________________________________________________
     181                 :    8347960 : inline TypeDescription::~TypeDescription() SAL_THROW(())
     182                 :            : {
     183         [ +  + ]:    8347960 :     if (_pTypeDescr)
     184                 :    7166112 :         typelib_typedescription_release( _pTypeDescr );
     185                 :    8347977 : }
     186                 :            : //__________________________________________________________________________________________________
     187                 :    1891725 : inline TypeDescription & TypeDescription::operator = ( typelib_TypeDescription * pTypeDescr ) SAL_THROW(())
     188                 :            : {
     189         [ +  + ]:    1891725 :     if (pTypeDescr)
     190                 :    1511402 :         typelib_typedescription_acquire( pTypeDescr );
     191         [ +  + ]:    1891725 :     if (_pTypeDescr)
     192                 :     266191 :         typelib_typedescription_release( _pTypeDescr );
     193                 :    1891725 :     _pTypeDescr = pTypeDescr;
     194                 :    1891725 :     return *this;
     195                 :            : }
     196                 :            : //__________________________________________________________________________________________________
     197                 :      46027 : inline sal_Bool TypeDescription::equals( const typelib_TypeDescription * pTypeDescr ) const SAL_THROW(())
     198                 :            : {
     199                 :            :     return (_pTypeDescr && pTypeDescr &&
     200 [ +  - ][ +  - ]:      46027 :             typelib_typedescription_equals( _pTypeDescr, pTypeDescr ));
                 [ +  + ]
     201                 :            : }
     202                 :            : //__________________________________________________________________________________________________
     203                 :    2675312 : inline void TypeDescription::makeComplete() const SAL_THROW(())
     204                 :            : {
     205 [ +  - ][ +  + ]:    2675312 :     if (_pTypeDescr && !_pTypeDescr->bComplete)
     206                 :        317 :         ::typelib_typedescription_complete( &_pTypeDescr );
     207                 :    2675312 : }
     208                 :            : 
     209                 :            : }
     210                 :            : }
     211                 :            : }
     212                 :            : }
     213                 :            : 
     214                 :            : #endif
     215                 :            : 
     216                 :            : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10