LCOV - code coverage report
Current view: top level - libreoffice/solver/unxlngi6.pro/inc/com/sun/star/uno - Any.hxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 201 210 95.7 %
Date: 2012-12-27 Functions: 765 1940 39.4 %
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 _COM_SUN_STAR_UNO_ANY_HXX_
      20             : #define _COM_SUN_STAR_UNO_ANY_HXX_
      21             : 
      22             : #include <com/sun/star/uno/Any.h>
      23             : #include <uno/data.h>
      24             : #include <com/sun/star/uno/Type.hxx>
      25             : #include <com/sun/star/uno/XInterface.hpp>
      26             : #include <com/sun/star/uno/genfunc.hxx>
      27             : #include "cppu/unotype.hxx"
      28             : 
      29             : namespace com
      30             : {
      31             : namespace sun
      32             : {
      33             : namespace star
      34             : {
      35             : namespace uno
      36             : {
      37             : 
      38             : //__________________________________________________________________________________________________
      39     3300089 : inline Any::Any() SAL_THROW(())
      40             : {
      41     3300089 :     ::uno_any_construct( this, 0, 0, (uno_AcquireFunc)cpp_acquire );
      42     3300089 : }
      43             : 
      44             : //______________________________________________________________________________
      45             : template <typename T>
      46       15266 : inline Any::Any( T const & value )
      47             : {
      48       15266 :     ::uno_type_any_construct(
      49             :         this, const_cast<T *>(&value),
      50             :         ::cppu::getTypeFavourUnsigned(&value).getTypeLibType(),
      51             :         (uno_AcquireFunc) cpp_acquire );
      52       15266 : }
      53             : //______________________________________________________________________________
      54         311 : inline Any::Any( bool value )
      55             : {
      56         311 :     sal_Bool b = value;
      57             :     ::uno_type_any_construct(
      58         311 :         this, &b, ::getCppuBooleanType().getTypeLibType(),
      59         311 :         (uno_AcquireFunc) cpp_acquire );
      60         311 : }
      61             : 
      62             : //__________________________________________________________________________________________________
      63     2689040 : inline Any::Any( const Any & rAny ) SAL_THROW(())
      64             : {
      65     2689040 :     ::uno_type_any_construct( this, rAny.pData, rAny.pType, (uno_AcquireFunc)cpp_acquire );
      66     2689040 : }
      67             : //__________________________________________________________________________________________________
      68     1839576 : inline Any::Any( const void * pData_, const Type & rType ) SAL_THROW(())
      69             : {
      70             :     ::uno_type_any_construct(
      71             :         this, const_cast< void * >( pData_ ), rType.getTypeLibType(),
      72     1839576 :         (uno_AcquireFunc)cpp_acquire );
      73     1839576 : }
      74             : //__________________________________________________________________________________________________
      75           0 : inline Any::Any( const void * pData_, typelib_TypeDescription * pTypeDescr ) SAL_THROW(())
      76             : {
      77             :     ::uno_any_construct(
      78           0 :         this, const_cast< void * >( pData_ ), pTypeDescr, (uno_AcquireFunc)cpp_acquire );
      79           0 : }
      80             : //__________________________________________________________________________________________________
      81      936164 : inline Any::Any( const void * pData_, typelib_TypeDescriptionReference * pType_ ) SAL_THROW(())
      82             : {
      83             :     ::uno_type_any_construct(
      84      936164 :         this, const_cast< void * >( pData_ ), pType_, (uno_AcquireFunc)cpp_acquire );
      85      936164 : }
      86             : //__________________________________________________________________________________________________
      87     8852864 : inline Any::~Any() SAL_THROW(())
      88             : {
      89             :     ::uno_any_destruct(
      90     8852864 :         this, (uno_ReleaseFunc)cpp_release );
      91     8852864 : }
      92             : //__________________________________________________________________________________________________
      93     2750430 : inline Any & Any::operator = ( const Any & rAny ) SAL_THROW(())
      94             : {
      95     2750430 :     if (this != &rAny)
      96             :     {
      97             :         ::uno_type_any_assign(
      98             :             this, rAny.pData, rAny.pType,
      99     2750368 :             (uno_AcquireFunc)cpp_acquire, (uno_ReleaseFunc)cpp_release );
     100             :     }
     101     2750430 :     return *this;
     102             : }
     103             : //__________________________________________________________________________________________________
     104          16 : inline ::rtl::OUString Any::getValueTypeName() const SAL_THROW(())
     105             : {
     106          16 :     return ::rtl::OUString( pType->pTypeName );
     107             : }
     108             : //__________________________________________________________________________________________________
     109       13972 : inline void Any::setValue( const void * pData_, const Type & rType ) SAL_THROW(())
     110             : {
     111             :     ::uno_type_any_assign(
     112             :         this, const_cast< void * >( pData_ ), rType.getTypeLibType(),
     113       13972 :         (uno_AcquireFunc)cpp_acquire, (uno_ReleaseFunc)cpp_release );
     114       13972 : }
     115             : //__________________________________________________________________________________________________
     116             : inline void Any::setValue( const void * pData_, typelib_TypeDescriptionReference * pType_ ) SAL_THROW(())
     117             : {
     118             :     ::uno_type_any_assign(
     119             :         this, const_cast< void * >( pData_ ), pType_,
     120             :         (uno_AcquireFunc)cpp_acquire, (uno_ReleaseFunc)cpp_release );
     121             : }
     122             : //__________________________________________________________________________________________________
     123           0 : inline void Any::setValue( const void * pData_, typelib_TypeDescription * pTypeDescr ) SAL_THROW(())
     124             : {
     125             :     ::uno_any_assign(
     126             :         this, const_cast< void * >( pData_ ), pTypeDescr,
     127           0 :         (uno_AcquireFunc)cpp_acquire, (uno_ReleaseFunc)cpp_release );
     128           0 : }
     129             : //__________________________________________________________________________________________________
     130         677 : inline void Any::clear() SAL_THROW(())
     131             : {
     132             :     ::uno_any_clear(
     133         677 :         this, (uno_ReleaseFunc)cpp_release );
     134         677 : }
     135             : //__________________________________________________________________________________________________
     136        4210 : inline sal_Bool Any::isExtractableTo( const Type & rType ) const SAL_THROW(())
     137             : {
     138             :     return ::uno_type_isAssignableFromData(
     139             :         rType.getTypeLibType(), pData, pType,
     140        4210 :         (uno_QueryInterfaceFunc)cpp_queryInterface, (uno_ReleaseFunc)cpp_release );
     141             : }
     142             : 
     143             : //______________________________________________________________________________
     144             : template <typename T>
     145         101 : inline bool Any::has() const
     146             : {
     147         101 :     Type const & rType = ::cppu::getTypeFavourUnsigned(static_cast< T * >(0));
     148             :     return ::uno_type_isAssignableFromData(
     149             :         rType.getTypeLibType(), pData, pType,
     150             :         (uno_QueryInterfaceFunc) cpp_queryInterface,
     151         101 :         (uno_ReleaseFunc) cpp_release );
     152             : }
     153             : #if ! defined(__SUNPRO_CC)
     154             : // not impl: forbid use with ambiguous type (sal_Unicode, sal_uInt16)
     155             : template <>
     156             : bool Any::has<sal_uInt16>() const;
     157             : #endif // ! defined(__SUNPRO_CC)
     158             : 
     159             : //__________________________________________________________________________________________________
     160       70769 : inline sal_Bool Any::operator == ( const Any & rAny ) const SAL_THROW(())
     161             : {
     162             :     return ::uno_type_equalData(
     163             :         pData, pType, rAny.pData, rAny.pType,
     164       70769 :         (uno_QueryInterfaceFunc)cpp_queryInterface, (uno_ReleaseFunc)cpp_release );
     165             : }
     166             : //__________________________________________________________________________________________________
     167         142 : inline sal_Bool Any::operator != ( const Any & rAny ) const SAL_THROW(())
     168             : {
     169             :     return (! ::uno_type_equalData(
     170             :         pData, pType, rAny.pData, rAny.pType,
     171         142 :         (uno_QueryInterfaceFunc)cpp_queryInterface, (uno_ReleaseFunc)cpp_release ));
     172             : }
     173             : 
     174             : //__________________________________________________________________________________________________
     175             : template< class C >
     176     1011487 : inline Any SAL_CALL makeAny( const C & value ) SAL_THROW(())
     177             : {
     178     1011487 :     return Any( &value, ::cppu::getTypeFavourUnsigned(&value) );
     179             : }
     180             : 
     181             : // additionally specialized for C++ bool
     182             : //______________________________________________________________________________
     183             : template<>
     184       95938 : inline Any SAL_CALL makeAny( bool const & value ) SAL_THROW(())
     185             : {
     186       95938 :     const sal_Bool b = value;
     187       95938 :     return Any( &b, ::getCppuBooleanType() );
     188             : }
     189             : 
     190             : //__________________________________________________________________________________________________
     191             : #ifdef RTL_FAST_STRING
     192             : template< class C1, class C2 >
     193        1714 : inline Any SAL_CALL makeAny( const rtl::OUStringConcat< C1, C2 >& value ) SAL_THROW(())
     194             : {
     195        1714 :     const rtl::OUString str( value );
     196        1714 :     return Any( &str, ::cppu::getTypeFavourUnsigned(&str) );
     197             : }
     198             : #endif
     199             : //__________________________________________________________________________________________________
     200             : template< class C >
     201      455271 : inline void SAL_CALL operator <<= ( Any & rAny, const C & value ) SAL_THROW(())
     202             : {
     203      455271 :     const Type & rType = ::cppu::getTypeFavourUnsigned(&value);
     204      455271 :     ::uno_type_any_assign(
     205             :         &rAny, const_cast< C * >( &value ), rType.getTypeLibType(),
     206             :         (uno_AcquireFunc)cpp_acquire, (uno_ReleaseFunc)cpp_release );
     207      455271 : }
     208             : 
     209             : // additionally for C++ bool:
     210             : //______________________________________________________________________________
     211        3034 : inline void SAL_CALL operator <<= ( Any & rAny, bool const & value )
     212             :     SAL_THROW(())
     213             : {
     214        3034 :     sal_Bool b = value;
     215             :     ::uno_type_any_assign(
     216        3034 :         &rAny, &b, ::getCppuBooleanType().getTypeLibType(),
     217        3034 :         (uno_AcquireFunc) cpp_acquire, (uno_ReleaseFunc) cpp_release );
     218        3034 : }
     219             : 
     220             : //______________________________________________________________________________
     221             : #ifdef RTL_FAST_STRING
     222             : template< class C1, class C2 >
     223          40 : inline void SAL_CALL operator <<= ( Any & rAny, const rtl::OUStringConcat< C1, C2 >& value )
     224             :     SAL_THROW(())
     225             : {
     226          40 :     const rtl::OUString str( value );
     227          40 :     const Type & rType = ::cppu::getTypeFavourUnsigned(&str);
     228             :     ::uno_type_any_assign(
     229             :         &rAny, const_cast< rtl::OUString * >( &str ), rType.getTypeLibType(),
     230          40 :         (uno_AcquireFunc)cpp_acquire, (uno_ReleaseFunc)cpp_release );
     231          40 : }
     232             : #endif
     233             : //__________________________________________________________________________________________________
     234             : template< class C >
     235      371921 : inline sal_Bool SAL_CALL operator >>= ( const Any & rAny, C & value ) SAL_THROW(())
     236             : {
     237      371921 :     const Type & rType = ::cppu::getTypeFavourUnsigned(&value);
     238             :     return ::uno_type_assignData(
     239             :         &value, rType.getTypeLibType(),
     240             :         rAny.pData, rAny.pType,
     241             :         (uno_QueryInterfaceFunc)cpp_queryInterface,
     242      371921 :         (uno_AcquireFunc)cpp_acquire, (uno_ReleaseFunc)cpp_release );
     243             : }
     244             : 
     245             : // bool
     246             : //__________________________________________________________________________________________________
     247      159914 : inline sal_Bool SAL_CALL operator >>= ( const ::com::sun::star::uno::Any & rAny, sal_Bool & value ) SAL_THROW(())
     248             : {
     249      159914 :     if (typelib_TypeClass_BOOLEAN == rAny.pType->eTypeClass)
     250             :     {
     251      155423 :         value = (* reinterpret_cast< const sal_Bool * >( rAny.pData ) != sal_False);
     252      155423 :         return sal_True;
     253             :     }
     254        4491 :     return sal_False;
     255             : }
     256             : //__________________________________________________________________________________________________
     257           0 : inline sal_Bool SAL_CALL operator == ( const Any & rAny, const sal_Bool & value ) SAL_THROW(())
     258             : {
     259             :     return (typelib_TypeClass_BOOLEAN == rAny.pType->eTypeClass &&
     260           0 :             (value != sal_False) == (* reinterpret_cast< const sal_Bool * >( rAny.pData ) != sal_False));
     261             : }
     262             : 
     263             : //______________________________________________________________________________
     264             : template<>
     265        7853 : inline sal_Bool SAL_CALL operator >>= ( Any const & rAny, bool & value )
     266             :     SAL_THROW(())
     267             : {
     268        7853 :     if (rAny.pType->eTypeClass == typelib_TypeClass_BOOLEAN)
     269             :     {
     270             :         value = *reinterpret_cast< sal_Bool const * >(
     271        7402 :             rAny.pData ) != sal_False;
     272        7402 :         return true;
     273             :     }
     274         451 :     return false;
     275             : }
     276             : 
     277             : //______________________________________________________________________________
     278             : template<>
     279             : inline sal_Bool SAL_CALL operator == ( Any const & rAny, bool const & value )
     280             :     SAL_THROW(())
     281             : {
     282             :     return (rAny.pType->eTypeClass == typelib_TypeClass_BOOLEAN &&
     283             :             (value ==
     284             :              (*reinterpret_cast< sal_Bool const * >( rAny.pData )
     285             :               != sal_False)));
     286             : }
     287             : 
     288             : // byte
     289             : //__________________________________________________________________________________________________
     290         683 : inline sal_Bool SAL_CALL operator >>= ( const ::com::sun::star::uno::Any & rAny, sal_Int8 & value ) SAL_THROW(())
     291             : {
     292         683 :     if (typelib_TypeClass_BYTE == rAny.pType->eTypeClass)
     293             :     {
     294         636 :         value = * reinterpret_cast< const sal_Int8 * >( rAny.pData );
     295         636 :         return sal_True;
     296             :     }
     297          47 :     return sal_False;
     298             : }
     299             : // short
     300             : //__________________________________________________________________________________________________
     301       50694 : inline sal_Bool SAL_CALL operator >>= ( const Any & rAny, sal_Int16 & value ) SAL_THROW(())
     302             : {
     303       50694 :     switch (rAny.pType->eTypeClass)
     304             :     {
     305             :     case typelib_TypeClass_BYTE:
     306          19 :         value = * reinterpret_cast< const sal_Int8 * >( rAny.pData );
     307          19 :         return sal_True;
     308             :     case typelib_TypeClass_SHORT:
     309             :     case typelib_TypeClass_UNSIGNED_SHORT:
     310       39155 :         value = * reinterpret_cast< const sal_Int16 * >( rAny.pData );
     311       39155 :         return sal_True;
     312             :     default:
     313       11520 :         return sal_False;
     314             :     }
     315             : }
     316             : //__________________________________________________________________________________________________
     317         331 : inline sal_Bool SAL_CALL operator >>= ( const Any & rAny, sal_uInt16 & value ) SAL_THROW(())
     318             : {
     319         331 :     switch (rAny.pType->eTypeClass)
     320             :     {
     321             :     case typelib_TypeClass_BYTE:
     322           2 :         value = (sal_uInt16)( * reinterpret_cast< const sal_Int8 * >( rAny.pData ) );
     323           2 :         return sal_True;
     324             :     case typelib_TypeClass_SHORT:
     325             :     case typelib_TypeClass_UNSIGNED_SHORT:
     326         295 :         value = * reinterpret_cast< const sal_uInt16 * >( rAny.pData );
     327         295 :         return sal_True;
     328             :     default:
     329          34 :         return sal_False;
     330             :     }
     331             : }
     332             : // long
     333             : //__________________________________________________________________________________________________
     334       75402 : inline sal_Bool SAL_CALL operator >>= ( const Any & rAny, sal_Int32 & value ) SAL_THROW(())
     335             : {
     336       75402 :     switch (rAny.pType->eTypeClass)
     337             :     {
     338             :     case typelib_TypeClass_BYTE:
     339          15 :         value = * reinterpret_cast< const sal_Int8 * >( rAny.pData );
     340          15 :         return sal_True;
     341             :     case typelib_TypeClass_SHORT:
     342       22753 :         value = * reinterpret_cast< const sal_Int16 * >( rAny.pData );
     343       22753 :         return sal_True;
     344             :     case typelib_TypeClass_UNSIGNED_SHORT:
     345           1 :         value = * reinterpret_cast< const sal_uInt16 * >( rAny.pData );
     346           1 :         return sal_True;
     347             :     case typelib_TypeClass_LONG:
     348             :     case typelib_TypeClass_UNSIGNED_LONG:
     349       51007 :         value = * reinterpret_cast< const sal_Int32 * >( rAny.pData );
     350       51007 :         return sal_True;
     351             :     default:
     352        1626 :         return sal_False;
     353             :     }
     354             : }
     355             : //__________________________________________________________________________________________________
     356        1250 : inline sal_Bool SAL_CALL operator >>= ( const Any & rAny, sal_uInt32 & value ) SAL_THROW(())
     357             : {
     358        1250 :     switch (rAny.pType->eTypeClass)
     359             :     {
     360             :     case typelib_TypeClass_BYTE:
     361           1 :         value = (sal_uInt32)( * reinterpret_cast< const sal_Int8 * >( rAny.pData ) );
     362           1 :         return sal_True;
     363             :     case typelib_TypeClass_SHORT:
     364           1 :         value = (sal_uInt32)( * reinterpret_cast< const sal_Int16 * >( rAny.pData ) );
     365           1 :         return sal_True;
     366             :     case typelib_TypeClass_UNSIGNED_SHORT:
     367           1 :         value = * reinterpret_cast< const sal_uInt16 * >( rAny.pData );
     368           1 :         return sal_True;
     369             :     case typelib_TypeClass_LONG:
     370             :     case typelib_TypeClass_UNSIGNED_LONG:
     371         918 :         value = * reinterpret_cast< const sal_uInt32 * >( rAny.pData );
     372         918 :         return sal_True;
     373             :     default:
     374         329 :         return sal_False;
     375             :     }
     376             : }
     377             : // hyper
     378             : //__________________________________________________________________________________________________
     379         442 : inline sal_Bool SAL_CALL operator >>= ( const Any & rAny, sal_Int64 & value ) SAL_THROW(())
     380             : {
     381         442 :     switch (rAny.pType->eTypeClass)
     382             :     {
     383             :     case typelib_TypeClass_BYTE:
     384           1 :         value = * reinterpret_cast< const sal_Int8 * >( rAny.pData );
     385           1 :         return sal_True;
     386             :     case typelib_TypeClass_SHORT:
     387           1 :         value = * reinterpret_cast< const sal_Int16 * >( rAny.pData );
     388           1 :         return sal_True;
     389             :     case typelib_TypeClass_UNSIGNED_SHORT:
     390           1 :         value = * reinterpret_cast< const sal_uInt16 * >( rAny.pData );
     391           1 :         return sal_True;
     392             :     case typelib_TypeClass_LONG:
     393          33 :         value = * reinterpret_cast< const sal_Int32 * >( rAny.pData );
     394          33 :         return sal_True;
     395             :     case typelib_TypeClass_UNSIGNED_LONG:
     396           1 :         value = * reinterpret_cast< const sal_uInt32 * >( rAny.pData );
     397           1 :         return sal_True;
     398             :     case typelib_TypeClass_HYPER:
     399             :     case typelib_TypeClass_UNSIGNED_HYPER:
     400         289 :         value = * reinterpret_cast< const sal_Int64 * >( rAny.pData );
     401         289 :         return sal_True;
     402             :     default:
     403         116 :         return sal_False;
     404             :     }
     405             : }
     406             : //__________________________________________________________________________________________________
     407          22 : inline sal_Bool SAL_CALL operator >>= ( const Any & rAny, sal_uInt64 & value ) SAL_THROW(())
     408             : {
     409          22 :     switch (rAny.pType->eTypeClass)
     410             :     {
     411             :     case typelib_TypeClass_BYTE:
     412           1 :         value = (sal_uInt64)( * reinterpret_cast< const sal_Int8 * >( rAny.pData ) );
     413           1 :         return sal_True;
     414             :     case typelib_TypeClass_SHORT:
     415           1 :         value = (sal_uInt64)( * reinterpret_cast< const sal_Int16 * >( rAny.pData ) );
     416           1 :         return sal_True;
     417             :     case typelib_TypeClass_UNSIGNED_SHORT:
     418           1 :         value = * reinterpret_cast< const sal_uInt16 * >( rAny.pData );
     419           1 :         return sal_True;
     420             :     case typelib_TypeClass_LONG:
     421           1 :         value = (sal_uInt64)( * reinterpret_cast< const sal_Int32 * >( rAny.pData ) );
     422           1 :         return sal_True;
     423             :     case typelib_TypeClass_UNSIGNED_LONG:
     424           1 :         value = * reinterpret_cast< const sal_uInt32 * >( rAny.pData );
     425           1 :         return sal_True;
     426             :     case typelib_TypeClass_HYPER:
     427             :     case typelib_TypeClass_UNSIGNED_HYPER:
     428           4 :         value = * reinterpret_cast< const sal_uInt64 * >( rAny.pData );
     429           4 :         return sal_True;
     430             :     default:
     431          13 :         return sal_False;
     432             :     }
     433             : }
     434             : // float
     435             : //__________________________________________________________________________________________________
     436         181 : inline sal_Bool SAL_CALL operator >>= ( const Any & rAny, float & value ) SAL_THROW(())
     437             : {
     438         181 :     switch (rAny.pType->eTypeClass)
     439             :     {
     440             :     case typelib_TypeClass_BYTE:
     441           1 :         value = * reinterpret_cast< const sal_Int8 * >( rAny.pData );
     442           1 :         return sal_True;
     443             :     case typelib_TypeClass_SHORT:
     444          10 :         value = * reinterpret_cast< const sal_Int16 * >( rAny.pData );
     445          10 :         return sal_True;
     446             :     case typelib_TypeClass_UNSIGNED_SHORT:
     447           1 :         value = * reinterpret_cast< const sal_uInt16 * >( rAny.pData );
     448           1 :         return sal_True;
     449             :     case typelib_TypeClass_FLOAT:
     450         153 :         value = * reinterpret_cast< const float * >( rAny.pData );
     451         153 :         return sal_True;
     452             :     default:
     453          16 :         return sal_False;
     454             :     }
     455             : }
     456             : // double
     457             : //__________________________________________________________________________________________________
     458       12046 : inline sal_Bool SAL_CALL operator >>= ( const Any & rAny, double & value ) SAL_THROW(())
     459             : {
     460       12046 :     switch (rAny.pType->eTypeClass)
     461             :     {
     462             :     case typelib_TypeClass_BYTE:
     463           1 :         value = * reinterpret_cast< const sal_Int8 * >( rAny.pData );
     464           1 :         return sal_True;
     465             :     case typelib_TypeClass_SHORT:
     466           1 :         value = * reinterpret_cast< const sal_Int16 * >( rAny.pData );
     467           1 :         return sal_True;
     468             :     case typelib_TypeClass_UNSIGNED_SHORT:
     469           1 :         value = * reinterpret_cast< const sal_uInt16 * >( rAny.pData );
     470           1 :         return sal_True;
     471             :     case typelib_TypeClass_LONG:
     472          16 :         value = * reinterpret_cast< const sal_Int32 * >( rAny.pData );
     473          16 :         return sal_True;
     474             :     case typelib_TypeClass_UNSIGNED_LONG:
     475           1 :         value = * reinterpret_cast< const sal_uInt32 * >( rAny.pData );
     476           1 :         return sal_True;
     477             :     case typelib_TypeClass_FLOAT:
     478        7569 :         value = * reinterpret_cast< const float * >( rAny.pData );
     479        7569 :         return sal_True;
     480             :     case typelib_TypeClass_DOUBLE:
     481        2066 :         value = * reinterpret_cast< const double * >( rAny.pData );
     482        2066 :         return sal_True;
     483             :     default:
     484        2391 :         return sal_False;
     485             :     }
     486             : }
     487             : // string
     488             : //__________________________________________________________________________________________________
     489      546559 : inline sal_Bool SAL_CALL operator >>= ( const Any & rAny, ::rtl::OUString & value ) SAL_THROW(())
     490             : {
     491      546559 :     if (typelib_TypeClass_STRING == rAny.pType->eTypeClass)
     492             :     {
     493      528112 :         value = * reinterpret_cast< const ::rtl::OUString * >( rAny.pData );
     494      528112 :         return sal_True;
     495             :     }
     496       18447 :     return sal_False;
     497             : }
     498             : //__________________________________________________________________________________________________
     499             : inline sal_Bool SAL_CALL operator == ( const Any & rAny, const ::rtl::OUString & value ) SAL_THROW(())
     500             : {
     501             :     return (typelib_TypeClass_STRING == rAny.pType->eTypeClass &&
     502             :             value.equals( * reinterpret_cast< const ::rtl::OUString * >( rAny.pData ) ));
     503             : }
     504             : // type
     505             : //__________________________________________________________________________________________________
     506          22 : inline sal_Bool SAL_CALL operator >>= ( const Any & rAny, Type & value ) SAL_THROW(())
     507             : {
     508          22 :     if (typelib_TypeClass_TYPE == rAny.pType->eTypeClass)
     509             :     {
     510           3 :         value = * reinterpret_cast< const Type * >( rAny.pData );
     511           3 :         return sal_True;
     512             :     }
     513          19 :     return sal_False;
     514             : }
     515             : //__________________________________________________________________________________________________
     516             : inline sal_Bool SAL_CALL operator == ( const Any & rAny, const Type & value ) SAL_THROW(())
     517             : {
     518             :     return (typelib_TypeClass_TYPE == rAny.pType->eTypeClass &&
     519             :             value.equals( * reinterpret_cast< const Type * >( rAny.pData ) ));
     520             : }
     521             : // any
     522             : //__________________________________________________________________________________________________
     523        2324 : inline sal_Bool SAL_CALL operator >>= ( const Any & rAny, Any & value ) SAL_THROW(())
     524             : {
     525        2324 :     if (&rAny != &value)
     526             :     {
     527             :         ::uno_type_any_assign(
     528             :             &value, rAny.pData, rAny.pType,
     529        2324 :             (uno_AcquireFunc)cpp_acquire, (uno_ReleaseFunc)cpp_release );
     530             :     }
     531        2324 :     return sal_True;
     532             : }
     533             : // interface
     534             : //__________________________________________________________________________________________________
     535             : inline sal_Bool SAL_CALL operator == ( const Any & rAny, const BaseReference & value ) SAL_THROW(())
     536             : {
     537             :     if (typelib_TypeClass_INTERFACE == rAny.pType->eTypeClass)
     538             :     {
     539             :         return reinterpret_cast< const BaseReference * >( rAny.pData )->operator == ( value );
     540             :     }
     541             :     return sal_False;
     542             : }
     543             : 
     544             : // operator to compare to an any.
     545             : //__________________________________________________________________________________________________
     546             : template< class C >
     547           3 : inline sal_Bool SAL_CALL operator == ( const Any & rAny, const C & value ) SAL_THROW(())
     548             : {
     549           3 :     const Type & rType = ::cppu::getTypeFavourUnsigned(&value);
     550             :     return ::uno_type_equalData(
     551             :         rAny.pData, rAny.pType,
     552             :         const_cast< C * >( &value ), rType.getTypeLibType(),
     553           3 :         (uno_QueryInterfaceFunc)cpp_queryInterface, (uno_ReleaseFunc)cpp_release );
     554             : }
     555             : // operator to compare to an any.  may use specialized operators ==.
     556             : //__________________________________________________________________________________________________
     557             : template< class C >
     558           1 : inline sal_Bool SAL_CALL operator != ( const Any & rAny, const C & value ) SAL_THROW(())
     559             : {
     560           1 :     return (! operator == ( rAny, value ));
     561             : }
     562             : 
     563             : #if ! defined(EXCEPTIONS_OFF)
     564             : extern "C" rtl_uString * SAL_CALL cppu_Any_extraction_failure_msg(
     565             :     uno_Any const * pAny, typelib_TypeDescriptionReference * pType )
     566             :     SAL_THROW_EXTERN_C();
     567             : 
     568             : //______________________________________________________________________________
     569             : template <typename T>
     570        7683 : T Any::get() const
     571             : {
     572        7683 :     T value = T();
     573        7683 :     if (! (*this >>= value)) {
     574             :         throw RuntimeException(
     575             :             ::rtl::OUString(
     576             :                 cppu_Any_extraction_failure_msg(
     577             :                     this,
     578             :                     ::cppu::getTypeFavourUnsigned(&value).getTypeLibType() ),
     579             :                 SAL_NO_ACQUIRE ),
     580           0 :             Reference<XInterface>() );
     581             :     }
     582        7683 :     return value;
     583             : }
     584             : // not impl: forbid use with ambiguous type (sal_Unicode, sal_uInt16)
     585             : template <>
     586             : sal_uInt16 Any::get<sal_uInt16>() const;
     587             : #endif // ! defined(EXCEPTIONS_OFF)
     588             : 
     589             : }
     590             : }
     591             : }
     592             : }
     593             : 
     594             : #endif
     595             : 
     596             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10