LCOV - code coverage report
Current view: top level - include/typelib - typedescription.hxx (source / functions) Hit Total Coverage
Test: commit e02a6cb2c3e2b23b203b422e4e0680877f232636 Lines: 0 54 0.0 %
Date: 2014-04-14 Functions: 0 14 0.0 %
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 INCLUDED_TYPELIB_TYPEDESCRIPTION_HXX
      20             : #define INCLUDED_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           0 :     inline TypeDescription & SAL_CALL operator =( const TypeDescription & rTypeDescr ) SAL_THROW(())
     107           0 :         { 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 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           0 :     inline bool SAL_CALL equals( const TypeDescription & rTypeDescr ) const SAL_THROW(())
     121           0 :         { 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           0 :     inline typelib_TypeDescription * SAL_CALL get() const SAL_THROW(())
     132           0 :         { return _pTypeDescr; }
     133             :     /** Tests if a type description is set.
     134             : 
     135             :         @return true, if a type description is set, false otherwise
     136             :     */
     137           0 :     inline bool SAL_CALL is() const SAL_THROW(())
     138           0 :         { return (_pTypeDescr != 0); }
     139             : };
     140             : 
     141           0 : inline TypeDescription::TypeDescription( typelib_TypeDescription * pTypeDescr ) SAL_THROW(())
     142           0 :     : _pTypeDescr( pTypeDescr )
     143             : {
     144           0 :     if (_pTypeDescr)
     145           0 :         typelib_typedescription_acquire( _pTypeDescr );
     146           0 : }
     147             : 
     148           0 : inline TypeDescription::TypeDescription( typelib_TypeDescriptionReference * pTypeDescrRef ) SAL_THROW(())
     149           0 :     : _pTypeDescr( 0 )
     150             : {
     151           0 :     if (pTypeDescrRef)
     152           0 :         typelib_typedescriptionreference_getDescription( &_pTypeDescr, pTypeDescrRef );
     153           0 : }
     154             : 
     155           0 : inline TypeDescription::TypeDescription( const ::com::sun::star::uno::Type & rType ) SAL_THROW(())
     156           0 :     : _pTypeDescr( 0 )
     157             : {
     158           0 :     if (rType.getTypeLibType())
     159           0 :         typelib_typedescriptionreference_getDescription( &_pTypeDescr, rType.getTypeLibType() );
     160           0 : }
     161             : 
     162           0 : inline TypeDescription::TypeDescription( const TypeDescription & rTypeDescr ) SAL_THROW(())
     163           0 :     : _pTypeDescr( rTypeDescr._pTypeDescr )
     164             : {
     165           0 :     if (_pTypeDescr)
     166           0 :         typelib_typedescription_acquire( _pTypeDescr );
     167           0 : }
     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           0 : inline TypeDescription::TypeDescription( const ::rtl::OUString & rTypeName ) SAL_THROW(())
     176           0 :     : _pTypeDescr( 0 )
     177             : {
     178           0 :     typelib_typedescription_getByName( &_pTypeDescr , rTypeName.pData );
     179           0 : }
     180             : 
     181           0 : inline TypeDescription::~TypeDescription() SAL_THROW(())
     182             : {
     183           0 :     if (_pTypeDescr)
     184           0 :         typelib_typedescription_release( _pTypeDescr );
     185           0 : }
     186             : 
     187           0 : inline TypeDescription & TypeDescription::operator = ( typelib_TypeDescription * pTypeDescr ) SAL_THROW(())
     188             : {
     189           0 :     if (pTypeDescr)
     190           0 :         typelib_typedescription_acquire( pTypeDescr );
     191           0 :     if (_pTypeDescr)
     192           0 :         typelib_typedescription_release( _pTypeDescr );
     193           0 :     _pTypeDescr = pTypeDescr;
     194           0 :     return *this;
     195             : }
     196             : 
     197           0 : inline bool TypeDescription::equals( const typelib_TypeDescription * pTypeDescr ) const SAL_THROW(())
     198             : {
     199           0 :     return (_pTypeDescr && pTypeDescr &&
     200           0 :             typelib_typedescription_equals( _pTypeDescr, pTypeDescr ));
     201             : }
     202             : 
     203           0 : inline void TypeDescription::makeComplete() const SAL_THROW(())
     204             : {
     205           0 :     if (_pTypeDescr && !_pTypeDescr->bComplete)
     206           0 :         ::typelib_typedescription_complete( &_pTypeDescr );
     207           0 : }
     208             : 
     209             : }
     210             : }
     211             : }
     212             : }
     213             : 
     214             : #endif
     215             : 
     216             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10