1 /************************************************************** 2 * 3 * Licensed to the Apache Software Foundation (ASF) under one 4 * or more contributor license agreements. See the NOTICE file 5 * distributed with this work for additional information 6 * regarding copyright ownership. The ASF licenses this file 7 * to you under the Apache License, Version 2.0 (the 8 * "License"); you may not use this file except in compliance 9 * with the License. You may obtain a copy of the License at 10 * 11 * http://www.apache.org/licenses/LICENSE-2.0 12 * 13 * Unless required by applicable law or agreed to in writing, 14 * software distributed under the License is distributed on an 15 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16 * KIND, either express or implied. See the License for the 17 * specific language governing permissions and limitations 18 * under the License. 19 * 20 *************************************************************/ 21 22 23 #ifndef _CPPUHELPER_PROPTYPEHLP_H 24 #define _CPPUHELPER_PROPTYPEHLP_H 25 26 #include <com/sun/star/lang/IllegalArgumentException.hpp> 27 #include <com/sun/star/uno/TypeClass.hpp> 28 29 30 namespace cppu { 31 32 /** Converts the value stored in an any to a concrete C++ type. 33 The function does the same as the operator >>= () at the 34 Any class, except that it throws an IllegalArgumentException in case of 35 failures (the value cannot be extracted without data loss ) 36 37 @exception com::sun::star::lang::IllegalArgumentException when the type could not be converted. 38 */ 39 template < class target > 40 inline void SAL_CALL convertPropertyValue( target &value , const ::com::sun::star::uno::Any & a); 41 42 template < class target > 43 inline void SAL_CALL convertPropertyValue( target &value , ::com::sun::star::uno::Any & a); 44 45 /** 46 conversion of basic types 47 */ 48 inline void SAL_CALL convertPropertyValue( sal_Int64 & target , const ::com::sun::star::uno::Any & source ) 49 SAL_THROW( (::com::sun::star::lang::IllegalArgumentException) ); 50 inline void SAL_CALL convertPropertyValue( sal_uInt64 & target, const ::com::sun::star::uno::Any & source ) 51 SAL_THROW( (::com::sun::star::lang::IllegalArgumentException) ); 52 inline void SAL_CALL convertPropertyValue( sal_Int32 & target , const ::com::sun::star::uno::Any & source ) 53 SAL_THROW( (::com::sun::star::lang::IllegalArgumentException) ); 54 inline void SAL_CALL convertPropertyValue( sal_uInt32 & target, const ::com::sun::star::uno::Any & source ) 55 SAL_THROW( (::com::sun::star::lang::IllegalArgumentException) ); 56 inline void SAL_CALL convertPropertyValue( sal_Int16 & target , const ::com::sun::star::uno::Any & source ) 57 SAL_THROW( (::com::sun::star::lang::IllegalArgumentException) ); 58 inline void SAL_CALL convertPropertyValue( sal_uInt16 & target, const ::com::sun::star::uno::Any & source ) 59 SAL_THROW( (::com::sun::star::lang::IllegalArgumentException) ); 60 inline void SAL_CALL convertPropertyValue( sal_Int8 & target , const ::com::sun::star::uno::Any & source ) 61 SAL_THROW( (::com::sun::star::lang::IllegalArgumentException) ); 62 inline void SAL_CALL convertPropertyValue( float & target , const ::com::sun::star::uno::Any & source ) 63 SAL_THROW( (::com::sun::star::lang::IllegalArgumentException) ); 64 inline void SAL_CALL convertPropertyValue( double &target , const ::com::sun::star::uno::Any &source ) 65 SAL_THROW( (::com::sun::star::lang::IllegalArgumentException) ); 66 inline void SAL_CALL convertPropertyValue( ::rtl::OUString &target , const ::com::sun::star::uno::Any &source ) 67 SAL_THROW( (::com::sun::star::lang::IllegalArgumentException) ); 68 69 } // end namespace cppu 70 71 72 #endif 73