LCOV - code coverage report
Current view: top level - solver/unxlngi6.pro/inc/cppuhelper - proptypehlp.hxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 43 162 26.5 %
Date: 2012-08-25 Functions: 8 19 42.1 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 21 106 19.8 %

           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 _CPPUHELPER_PROPTYPEHLP_HXX
      20                 :            : #define _CPPUHELPER_PROPTYPEHLP_HXX
      21                 :            : 
      22                 :            : #include <cppuhelper/proptypehlp.h>
      23                 :            : 
      24                 :            : namespace cppu
      25                 :            : {
      26                 :            : 
      27                 :            : /** Converts the value stored in an any to a concrete C++ type.
      28                 :            :     The function does the same as the operator >>= () at the
      29                 :            :     Any class, except that it throws an IllegalArgumentException in case of
      30                 :            :     failures (the value cannot be extracted without data loss )
      31                 :            : 
      32                 :            :    @exception com::sun::star::lang::IllegalArgumentException when the type could not be converted.
      33                 :            :  */
      34                 :            : template < class target >
      35                 :        538 : inline void SAL_CALL convertPropertyValue( target &value , const  ::com::sun::star::uno::Any & a)
      36                 :            : {
      37                 :            : 
      38 [ -  + ][ -  + ]:        538 :     if( !( a >>= value ) ) {
         [ #  # ][ #  # ]
      39 [ #  # ][ #  # ]:          0 :         throw ::com::sun::star::lang::IllegalArgumentException();
         [ #  # ][ #  # ]
      40                 :            :     }
      41                 :        538 : }
      42                 :            : 
      43                 :            : 
      44                 :            : // This template is needed at least for msci4 compiler
      45                 :            : template < class target >
      46                 :            : inline void SAL_CALL convertPropertyValue( target &value ,  ::com::sun::star::uno::Any & a)
      47                 :            : {
      48                 :            :     convertPropertyValue( value ,  (const ::com::sun::star::uno::Any & )  a );
      49                 :            : }
      50                 :            : 
      51                 :            : /**
      52                 :            :   conversion of basic types
      53                 :            : */
      54                 :       3794 : inline void SAL_CALL convertPropertyValue( sal_Bool & b   , const ::com::sun::star::uno::Any & a )
      55                 :            :     SAL_THROW( (::com::sun::star::lang::IllegalArgumentException) )
      56                 :            : {
      57                 :       3794 :     const enum ::com::sun::star::uno::TypeClass tc = a.getValueType().getTypeClass();
      58                 :            : 
      59         [ -  + ]:       3794 :     if( ::com::sun::star::uno::TypeClass_LONG == tc ) {
      60                 :          0 :         sal_Int32 i32 = 0;
      61                 :          0 :         a >>= i32;
      62                 :          0 :         b = ( sal_Bool )i32;
      63                 :            :     }
      64         [ -  + ]:       3794 :     else if ( ::com::sun::star::uno::TypeClass_CHAR  == tc ) {
      65                 :          0 :         sal_Unicode c = *(sal_Unicode*) a.getValue();
      66                 :          0 :         b = ( sal_Bool ) c;
      67                 :            :     }
      68         [ -  + ]:       3794 :     else if ( ::com::sun::star::uno::TypeClass_SHORT == tc ) {
      69                 :          0 :         sal_Int16 i16 = 0;
      70                 :          0 :         a >>= i16;
      71                 :          0 :         b = ( sal_Bool ) i16;
      72                 :            :     }
      73         [ +  - ]:       3794 :     else if ( ::com::sun::star::uno::TypeClass_BOOLEAN == tc ) {
      74                 :       3794 :         b = *((sal_Bool*)a.getValue());
      75                 :            :     }
      76         [ #  # ]:          0 :     else if ( ::com::sun::star::uno::TypeClass_BYTE == tc ) {
      77                 :          0 :         sal_Int8 i8 = 0;
      78                 :          0 :         a >>= i8;
      79                 :          0 :         b = ( sal_Bool ) i8;
      80                 :            :     }
      81         [ #  # ]:          0 :     else if ( ::com::sun::star::uno::TypeClass_UNSIGNED_SHORT == tc ) {
      82                 :          0 :         sal_uInt16 i16 = 0;
      83                 :          0 :         a >>= i16;
      84                 :          0 :         b = ( sal_Bool  ) i16;
      85                 :            :     }
      86         [ #  # ]:          0 :     else if ( ::com::sun::star::uno::TypeClass_UNSIGNED_LONG == tc ) {
      87                 :          0 :         sal_uInt32 i32 = 0;
      88                 :          0 :         a >>= i32;
      89                 :          0 :         b = ( sal_Bool ) i32;
      90                 :            :     }
      91                 :            :     else {
      92         [ #  # ]:          0 :         throw ::com::sun::star::lang::IllegalArgumentException();
      93                 :            :     }
      94                 :       3794 : }
      95                 :            : 
      96                 :          0 : inline void SAL_CALL convertPropertyValue( sal_Int64 & i  , const ::com::sun::star::uno::Any & a )
      97                 :            :     SAL_THROW( (::com::sun::star::lang::IllegalArgumentException) )
      98                 :            : {
      99                 :          0 :     const enum ::com::sun::star::uno::TypeClass tc = a.getValueType().getTypeClass();
     100                 :            : 
     101         [ #  # ]:          0 :     if( ::com::sun::star::uno::TypeClass_HYPER == tc ) {
     102                 :          0 :         a >>= i;
     103                 :            :     }
     104         [ #  # ]:          0 :     else if( ::com::sun::star::uno::TypeClass_UNSIGNED_HYPER == tc ) {
     105                 :          0 :         sal_uInt64 i64 = 0;
     106                 :          0 :         a >>= i64;
     107                 :          0 :         i = ( sal_Int64 ) i64;
     108                 :            :     }
     109         [ #  # ]:          0 :     else if( ::com::sun::star::uno::TypeClass_LONG == tc ) {
     110                 :          0 :         sal_Int32 i32 = 0;
     111                 :          0 :         a >>= i32;
     112                 :          0 :         i = ( sal_Int64 )i32;
     113                 :            :     }
     114         [ #  # ]:          0 :     else if ( ::com::sun::star::uno::TypeClass_CHAR  == tc ) {
     115                 :            :         sal_Unicode c;
     116                 :          0 :         c = *(sal_Unicode *)a.getValue();
     117                 :          0 :         i = ( sal_Int64 ) c;
     118                 :            :     }
     119         [ #  # ]:          0 :     else if ( ::com::sun::star::uno::TypeClass_SHORT == tc ) {
     120                 :          0 :         sal_Int16 i16 = 0;
     121                 :          0 :         a >>= i16;
     122                 :          0 :         i = ( sal_Int64 ) i16;
     123                 :            :     }
     124         [ #  # ]:          0 :     else if ( ::com::sun::star::uno::TypeClass_BOOLEAN == tc ) {
     125                 :            :         sal_Bool b;
     126                 :          0 :         b =  *((sal_Bool * )a.getValue());
     127                 :          0 :         i = ( sal_Int64 ) b;
     128                 :            :     }
     129         [ #  # ]:          0 :     else if ( ::com::sun::star::uno::TypeClass_BYTE == tc ) {
     130                 :          0 :         sal_Int8 i8 = 0;
     131                 :          0 :         a >>= i8;
     132                 :          0 :         i = ( sal_Int64 ) i8;
     133                 :            :     }
     134         [ #  # ]:          0 :     else if ( ::com::sun::star::uno::TypeClass_UNSIGNED_SHORT == tc ) {
     135                 :          0 :         sal_uInt16 i16 = 0;
     136                 :          0 :         a >>= i16;
     137                 :          0 :         i = ( sal_Int64 ) i16;
     138                 :            :     }
     139         [ #  # ]:          0 :     else if ( ::com::sun::star::uno::TypeClass_UNSIGNED_LONG == tc ) {
     140                 :          0 :         sal_uInt32 i32 = 0;
     141                 :          0 :         a >>= i32;
     142                 :          0 :         i = ( sal_Int64 ) i32;
     143                 :            :     }
     144                 :            :     else {
     145         [ #  # ]:          0 :         throw ::com::sun::star::lang::IllegalArgumentException();
     146                 :            :     }
     147                 :          0 : }
     148                 :            : 
     149                 :            : 
     150                 :            : inline void SAL_CALL convertPropertyValue( sal_uInt64 & i  , const ::com::sun::star::uno::Any & a )
     151                 :            :     SAL_THROW( (::com::sun::star::lang::IllegalArgumentException) )
     152                 :            : {
     153                 :            :     const enum ::com::sun::star::uno::TypeClass tc = a.getValueType().getTypeClass();
     154                 :            : 
     155                 :            :     if( ::com::sun::star::uno::TypeClass_UNSIGNED_HYPER == tc ) {
     156                 :            :         a >>= i;
     157                 :            :     }
     158                 :            :     if( ::com::sun::star::uno::TypeClass_HYPER == tc ) {
     159                 :            :         sal_Int64 i64;
     160                 :            :         a >>= i64;
     161                 :            :         i = ( sal_uInt64 ) i64;
     162                 :            :     }
     163                 :            :     else if( ::com::sun::star::uno::TypeClass_LONG == tc ) {
     164                 :            :         sal_Int32 i32;
     165                 :            :         a >>= i32;
     166                 :            :         i = ( sal_uInt64 )i32;
     167                 :            :     }
     168                 :            :     else if ( ::com::sun::star::uno::TypeClass_CHAR  == tc ) {
     169                 :            :         sal_Unicode c;
     170                 :            :         c = *( sal_Unicode * ) a.getValue() ;
     171                 :            :         i = ( sal_uInt64 ) c;
     172                 :            :     }
     173                 :            :     else if ( ::com::sun::star::uno::TypeClass_SHORT == tc ) {
     174                 :            :         sal_Int16 i16;
     175                 :            :         a >>= i16;
     176                 :            :         i = ( sal_uInt64 ) i16;
     177                 :            :     }
     178                 :            :     else if ( ::com::sun::star::uno::TypeClass_BOOLEAN == tc ) {
     179                 :            :         sal_Bool b;
     180                 :            :         b =  *((sal_Bool * )a.getValue());
     181                 :            :         i = ( sal_uInt64 ) b;
     182                 :            :     }
     183                 :            :     else if ( ::com::sun::star::uno::TypeClass_BYTE == tc ) {
     184                 :            :         sal_Int8 i8;
     185                 :            :         a >>= i8;
     186                 :            :         i = ( sal_uInt64 ) i8;
     187                 :            :     }
     188                 :            :     else if ( ::com::sun::star::uno::TypeClass_UNSIGNED_SHORT == tc ) {
     189                 :            :         sal_uInt16 i16;
     190                 :            :         a >>= i16;
     191                 :            :         i = ( sal_uInt64    ) i16;
     192                 :            :     }
     193                 :            :     else if ( ::com::sun::star::uno::TypeClass_UNSIGNED_LONG == tc ) {
     194                 :            :         sal_uInt32 i32;
     195                 :            :         a >>= i32;
     196                 :            :         i = ( sal_uInt64 ) i32;
     197                 :            :     }
     198                 :            :     else {
     199                 :            :         throw ::com::sun::star::lang::IllegalArgumentException();
     200                 :            :     }
     201                 :            : }
     202                 :            : 
     203                 :            : // the basic types
     204                 :            : // sal_Int32
     205                 :        112 : inline void SAL_CALL convertPropertyValue( sal_Int32 & i  , const ::com::sun::star::uno::Any & a )
     206                 :            :     SAL_THROW( (::com::sun::star::lang::IllegalArgumentException) )
     207                 :            : {
     208                 :        112 :     const enum ::com::sun::star::uno::TypeClass tc = a.getValueType().getTypeClass();
     209                 :            : 
     210         [ +  - ]:        112 :     if( ::com::sun::star::uno::TypeClass_LONG == tc ) {
     211                 :        112 :         a >>= i;
     212                 :            :     }
     213         [ #  # ]:          0 :     else if ( ::com::sun::star::uno::TypeClass_CHAR  == tc ) {
     214                 :            :         sal_Unicode c;
     215                 :          0 :         c = *(sal_Unicode*) a.getValue();
     216                 :          0 :         i = ( sal_Int32 ) c;
     217                 :            :     }
     218         [ #  # ]:          0 :     else if ( ::com::sun::star::uno::TypeClass_SHORT == tc ) {
     219                 :          0 :         sal_Int16 i16 = 0;
     220                 :          0 :         a >>= i16;
     221                 :          0 :         i = ( sal_Int32 ) i16;
     222                 :            :     }
     223         [ #  # ]:          0 :     else if ( ::com::sun::star::uno::TypeClass_BOOLEAN == tc ) {
     224                 :            :         sal_Bool b;
     225                 :          0 :         b =  *((sal_Bool * )a.getValue());
     226                 :          0 :         i = ( sal_Int32 ) b;
     227                 :            :     }
     228         [ #  # ]:          0 :     else if ( ::com::sun::star::uno::TypeClass_BYTE == tc ) {
     229                 :          0 :         sal_Int8 i8 = 0;
     230                 :          0 :         a >>= i8;
     231                 :          0 :         i = ( sal_Int32 ) i8;
     232                 :            :     }
     233         [ #  # ]:          0 :     else if ( ::com::sun::star::uno::TypeClass_UNSIGNED_SHORT == tc ) {
     234                 :          0 :         sal_uInt16 i16 = 0;
     235                 :          0 :         a >>= i16;
     236                 :          0 :         i = ( sal_Int32 ) i16;
     237                 :            :     }
     238         [ #  # ]:          0 :     else if ( ::com::sun::star::uno::TypeClass_UNSIGNED_LONG == tc ) {
     239                 :          0 :         sal_uInt32 i32 = 0;
     240                 :          0 :         a >>= i32;
     241                 :          0 :         i = ( sal_Int32 ) i32;
     242                 :            :     }
     243                 :            :     else {
     244         [ #  # ]:          0 :         throw ::com::sun::star::lang::IllegalArgumentException();
     245                 :            :     }
     246                 :        112 : }
     247                 :            : 
     248                 :            : inline void SAL_CALL convertPropertyValue( sal_uInt32 & i  , const ::com::sun::star::uno::Any & a )
     249                 :            :     SAL_THROW( (::com::sun::star::lang::IllegalArgumentException) )
     250                 :            : {
     251                 :            :     const enum ::com::sun::star::uno::TypeClass tc = a.getValueType().getTypeClass();
     252                 :            : 
     253                 :            :     if ( ::com::sun::star::uno::TypeClass_UNSIGNED_LONG == tc ) {
     254                 :            :         a >>= i;
     255                 :            :     }
     256                 :            :     else if( ::com::sun::star::uno::TypeClass_LONG == tc ) {
     257                 :            :         sal_Int32 i32;
     258                 :            :         a >>= i32;
     259                 :            :         i = (sal_uInt32 ) i32;
     260                 :            :     }
     261                 :            :     else if ( ::com::sun::star::uno::TypeClass_CHAR  == tc ) {
     262                 :            :         sal_Unicode c;
     263                 :            :         c = *(sal_Unicode*) a.getValue();
     264                 :            :         i = ( sal_uInt32 ) c;
     265                 :            :     }
     266                 :            :     else if ( ::com::sun::star::uno::TypeClass_SHORT == tc ) {
     267                 :            :         sal_Int16 i16;
     268                 :            :         a >>= i16;
     269                 :            :         i = ( sal_uInt32 ) i16;
     270                 :            :     }
     271                 :            :     else if ( ::com::sun::star::uno::TypeClass_BOOLEAN == tc ) {
     272                 :            :         sal_Bool b;
     273                 :            :         b =  *((sal_Bool * )a.getValue());
     274                 :            :         i = ( sal_uInt32 ) b;
     275                 :            :     }
     276                 :            :     else if ( ::com::sun::star::uno::TypeClass_BYTE == tc ) {
     277                 :            :         sal_Int8 i8;
     278                 :            :         a >>= i8;
     279                 :            :         i = ( sal_uInt32 ) i8;
     280                 :            :     }
     281                 :            :     else if ( ::com::sun::star::uno::TypeClass_UNSIGNED_SHORT == tc ) {
     282                 :            :         sal_uInt16 i16;
     283                 :            :         a >>= i16;
     284                 :            :         i = ( sal_uInt32    ) i16;
     285                 :            :     }
     286                 :            :     else {
     287                 :            :         throw ::com::sun::star::lang::IllegalArgumentException();
     288                 :            :     }
     289                 :            : }
     290                 :            : 
     291                 :            : 
     292                 :       2335 : inline void SAL_CALL convertPropertyValue( sal_Int16 & i  , const ::com::sun::star::uno::Any & a )
     293                 :            :     SAL_THROW( (::com::sun::star::lang::IllegalArgumentException) )
     294                 :            : {
     295                 :       2335 :     const enum ::com::sun::star::uno::TypeClass tc = a.getValueType().getTypeClass();
     296                 :            : 
     297         [ +  + ]:       2335 :     if ( ::com::sun::star::uno::TypeClass_SHORT == tc ) {
     298                 :       2323 :         a >>= i;
     299                 :            :     }
     300         [ -  + ]:         12 :     else if ( ::com::sun::star::uno::TypeClass_CHAR  == tc ) {
     301                 :            :         sal_Unicode c;
     302                 :          0 :         c = *(sal_Unicode*) a.getValue();
     303                 :          0 :         i = ( sal_Int16 ) c;
     304                 :            :     }
     305         [ +  - ]:         12 :     else if ( ::com::sun::star::uno::TypeClass_BOOLEAN == tc ) {
     306                 :            :         sal_Bool b;
     307                 :         12 :         b =  *((sal_Bool * )a.getValue());
     308                 :         12 :         i = ( sal_Int16 ) b;
     309                 :            :     }
     310         [ #  # ]:          0 :     else if ( ::com::sun::star::uno::TypeClass_BYTE == tc ) {
     311                 :          0 :         sal_Int8 i8 = 0;
     312                 :          0 :         a >>= i8;
     313                 :          0 :         i = ( sal_Int16 ) i8;
     314                 :            :     }
     315         [ #  # ]:          0 :     else if ( ::com::sun::star::uno::TypeClass_UNSIGNED_SHORT == tc ) {
     316                 :          0 :         sal_uInt16 i16 = 0;
     317                 :          0 :         a >>= i16;
     318                 :          0 :         i = ( sal_Int16 ) i16;
     319                 :            :     }
     320                 :            :     else {
     321         [ #  # ]:          0 :         throw ::com::sun::star::lang::IllegalArgumentException();
     322                 :            :     }
     323                 :       2335 : }
     324                 :            : 
     325                 :            : inline void SAL_CALL convertPropertyValue( sal_uInt16 & i  , const ::com::sun::star::uno::Any & a )
     326                 :            :     SAL_THROW( (::com::sun::star::lang::IllegalArgumentException) )
     327                 :            : {
     328                 :            :     const enum ::com::sun::star::uno::TypeClass tc = a.getValueType().getTypeClass();
     329                 :            : 
     330                 :            :     if ( ::com::sun::star::uno::TypeClass_UNSIGNED_SHORT == tc ) {
     331                 :            :         a >>= i;
     332                 :            :     }
     333                 :            :     else if ( ::com::sun::star::uno::TypeClass_CHAR  == tc ) {
     334                 :            :         sal_Unicode c;
     335                 :            :         c = *(sal_Unicode *) a.getValue();
     336                 :            :         i = ( sal_Int16 ) c;
     337                 :            :     }
     338                 :            :     else if ( ::com::sun::star::uno::TypeClass_BOOLEAN == tc ) {
     339                 :            :         sal_Bool b;
     340                 :            :         b =  *((sal_Bool * )a.getValue());
     341                 :            :         i = ( sal_Int16 ) b;
     342                 :            :     }
     343                 :            :     else if ( ::com::sun::star::uno::TypeClass_BYTE == tc ) {
     344                 :            :         sal_Int8 i8 = 0;
     345                 :            :         a >>= i8;
     346                 :            :         i = ( sal_Int16 ) i8;
     347                 :            :     }
     348                 :            :     else if ( ::com::sun::star::uno::TypeClass_SHORT == tc ) {
     349                 :            :         sal_Int16 i16 = 0;
     350                 :            :         a >>= i16;
     351                 :            :         i = ( sal_Int16 ) i16;
     352                 :            :     }
     353                 :            :     else {
     354                 :            :         throw ::com::sun::star::lang::IllegalArgumentException();
     355                 :            :     }
     356                 :            : }
     357                 :            : 
     358                 :            : inline void SAL_CALL convertPropertyValue( sal_Int8 & i  , const ::com::sun::star::uno::Any & a )
     359                 :            :     SAL_THROW( (::com::sun::star::lang::IllegalArgumentException) )
     360                 :            : {
     361                 :            :     const enum ::com::sun::star::uno::TypeClass tc = a.getValueType().getTypeClass();
     362                 :            : 
     363                 :            :     if ( ::com::sun::star::uno::TypeClass_BYTE == tc ) {
     364                 :            :         a >>= i;
     365                 :            :     }
     366                 :            :     else if ( ::com::sun::star::uno::TypeClass_BOOLEAN == tc ) {
     367                 :            :         sal_Bool b;
     368                 :            :         b =  *((sal_Bool * )a.getValue());
     369                 :            :         i = ( sal_Int8 ) b;
     370                 :            :     }
     371                 :            :     else {
     372                 :            :         throw ::com::sun::star::lang::IllegalArgumentException();
     373                 :            :     }
     374                 :            : }
     375                 :            : 
     376                 :         70 : inline void SAL_CALL convertPropertyValue( float &f , const ::com::sun::star::uno::Any &a )
     377                 :            :     SAL_THROW( (::com::sun::star::lang::IllegalArgumentException) )
     378                 :            : {
     379                 :         70 :     const enum ::com::sun::star::uno::TypeClass tc = a.getValueType().getTypeClass();
     380                 :            : 
     381         [ +  + ]:         70 :     if ( ::com::sun::star::uno::TypeClass_FLOAT == tc ) {
     382                 :         67 :         a >>= f;
     383                 :            :     }
     384         [ -  + ]:          3 :     else if( ::com::sun::star::uno::TypeClass_DOUBLE == tc ) {
     385                 :          0 :          double d = 0;
     386                 :          0 :          a >>= d;
     387                 :          0 :          f = ( float ) d;
     388                 :            :     }
     389         [ -  + ]:          3 :     else if( ::com::sun::star::uno::TypeClass_HYPER == tc ) {
     390                 :          0 :         sal_Int64 i64 = 0;
     391                 :          0 :         a >>= i64;
     392                 :          0 :         f = ( float ) i64;
     393                 :            :     }
     394                 :            :     // msci 4 does not support this conversion
     395                 :            : /*  else if( ::com::sun::star::uno::TypeClass_UNSIGNED_HYPER == tc ) {
     396                 :            :         sal_uInt64 i64;
     397                 :            :         a >>= i64;
     398                 :            :         f = ( float ) i64;
     399                 :            :     }
     400         [ -  + ]:          3 : */  else if( ::com::sun::star::uno::TypeClass_LONG == tc ) {
     401                 :          0 :         sal_Int32 i32 = 0;
     402                 :          0 :         a >>= i32;
     403                 :          0 :         f = ( float )i32;
     404                 :            :     }
     405         [ -  + ]:          3 :     else if ( ::com::sun::star::uno::TypeClass_CHAR  == tc ) {
     406                 :            :         sal_Unicode c;
     407                 :          0 :         c = *(sal_Unicode*) a.getValue();
     408                 :          0 :         f = ( float ) c;
     409                 :            :     }
     410         [ +  - ]:          3 :     else if ( ::com::sun::star::uno::TypeClass_SHORT == tc ) {
     411                 :          3 :         sal_Int16 i16 = 0;
     412                 :          3 :         a >>= i16;
     413                 :          3 :         f = ( float ) i16;
     414                 :            :     }
     415         [ #  # ]:          0 :     else if ( ::com::sun::star::uno::TypeClass_BOOLEAN == tc ) {
     416                 :            :         sal_Bool b;
     417                 :          0 :         b =  *((sal_Bool * )a.getValue());
     418                 :          0 :         f = ( float ) b;
     419                 :            :     }
     420         [ #  # ]:          0 :     else if ( ::com::sun::star::uno::TypeClass_BYTE == tc ) {
     421                 :          0 :         sal_Int8 i8 = 0;
     422                 :          0 :         a >>= i8;
     423                 :          0 :         f = ( float ) i8;
     424                 :            :     }
     425         [ #  # ]:          0 :     else if ( ::com::sun::star::uno::TypeClass_UNSIGNED_SHORT == tc ) {
     426                 :          0 :         sal_uInt16 i16 = 0;
     427                 :          0 :         a >>= i16;
     428                 :          0 :         f = ( float ) i16;
     429                 :            :     }
     430         [ #  # ]:          0 :     else if ( ::com::sun::star::uno::TypeClass_UNSIGNED_LONG == tc ) {
     431                 :          0 :         sal_uInt32 i32 = 0;
     432                 :          0 :         a >>= i32;
     433                 :          0 :         f = ( float ) i32;
     434                 :            :     }
     435                 :            :     else {
     436         [ #  # ]:          0 :         throw ::com::sun::star::lang::IllegalArgumentException();
     437                 :            :     }
     438                 :         70 : }
     439                 :            : 
     440                 :            : 
     441                 :            : inline void SAL_CALL convertPropertyValue( double &d , const ::com::sun::star::uno::Any &a )
     442                 :            :     SAL_THROW( (::com::sun::star::lang::IllegalArgumentException) )
     443                 :            : {
     444                 :            :     const enum ::com::sun::star::uno::TypeClass tc = a.getValueType().getTypeClass();
     445                 :            : 
     446                 :            :     if( ::com::sun::star::uno::TypeClass_DOUBLE == tc ) {
     447                 :            :          float f;
     448                 :            :          a >>= f;
     449                 :            :          d = ( double ) f;
     450                 :            :     }
     451                 :            :     else if ( ::com::sun::star::uno::TypeClass_FLOAT == tc ) {
     452                 :            :         float f;
     453                 :            :         a >>= f;
     454                 :            :         d = (double) f;
     455                 :            :     }
     456                 :            :     else if( ::com::sun::star::uno::TypeClass_HYPER == tc ) {
     457                 :            :         sal_Int64 i64;
     458                 :            :         a >>= i64;
     459                 :            :         d = (double) i64;
     460                 :            :     }
     461                 :            :     // msci 4 does not support this
     462                 :            : /*  else if( ::com::sun::star::uno::TypeClass_UNSIGNED_HYPER == tc ) {
     463                 :            :         sal_uInt64 i64;
     464                 :            :         a >>= i64;
     465                 :            :         d = (double) i64;
     466                 :            :     }
     467                 :            : */  else if( ::com::sun::star::uno::TypeClass_LONG == tc ) {
     468                 :            :         sal_Int32 i32;
     469                 :            :         a >>= i32;
     470                 :            :         d = (double)i32;
     471                 :            :     }
     472                 :            :     else if ( ::com::sun::star::uno::TypeClass_CHAR  == tc ) {
     473                 :            :         sal_Unicode c;
     474                 :            :         c = *(sal_Unicode*) a.getValue();
     475                 :            :         d = (double) c;
     476                 :            :     }
     477                 :            :     else if ( ::com::sun::star::uno::TypeClass_SHORT == tc ) {
     478                 :            :         sal_Int16 i16;
     479                 :            :         a >>= i16;
     480                 :            :         d = (double) i16;
     481                 :            :     }
     482                 :            :     else if ( ::com::sun::star::uno::TypeClass_BOOLEAN == tc ) {
     483                 :            :         sal_Bool b;
     484                 :            :         b =  *((sal_Bool * )a.getValue());
     485                 :            :         d = (double) b;
     486                 :            :     }
     487                 :            :     else if ( ::com::sun::star::uno::TypeClass_BYTE == tc ) {
     488                 :            :         sal_Int8 i8;
     489                 :            :         a >>= i8;
     490                 :            :         d = (double) i8;
     491                 :            :     }
     492                 :            :     else if ( ::com::sun::star::uno::TypeClass_UNSIGNED_SHORT == tc ) {
     493                 :            :         sal_uInt16 i16;
     494                 :            :         a >>= i16;
     495                 :            :         d = (double) i16;
     496                 :            :     }
     497                 :            :     else if ( ::com::sun::star::uno::TypeClass_UNSIGNED_LONG == tc ) {
     498                 :            :         sal_uInt32 i32;
     499                 :            :         a >>= i32;
     500                 :            :         d = (double) i32;
     501                 :            :     }
     502                 :            :     else {
     503                 :            :         throw ::com::sun::star::lang::IllegalArgumentException();
     504                 :            :     }
     505                 :            : }
     506                 :            : 
     507                 :       7293 : inline void SAL_CALL convertPropertyValue( ::rtl::OUString &ow , const ::com::sun::star::uno::Any &a )
     508                 :            :     SAL_THROW( (::com::sun::star::lang::IllegalArgumentException) )
     509                 :            : {
     510         [ +  + ]:       7293 :     if( ::com::sun::star::uno::TypeClass_STRING == a.getValueType().getTypeClass() ) {
     511                 :       7289 :         a >>= ow;
     512                 :            :     }
     513                 :            :     else {
     514         [ +  - ]:          4 :         throw ::com::sun::star::lang::IllegalArgumentException();
     515                 :            :     }
     516                 :       7289 : }
     517                 :            : 
     518                 :            : }     // end namespace cppu
     519                 :            : 
     520                 :            : #endif
     521                 :            : 
     522                 :            : 
     523                 :            : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10