19 #ifndef INCLUDED_CPPUHELPER_PROPTYPEHLP_HXX
20 #define INCLUDED_CPPUHELPER_PROPTYPEHLP_HXX
34 template <
class target >
38 if( !( a >>= value ) ) {
39 throw ::com::sun::star::lang::IllegalArgumentException();
45 template <
class target >
55 SAL_THROW( (::com::sun::star::lang::IllegalArgumentException) )
57 const enum ::com::sun::star::uno::TypeClass tc = a.getValueType().getTypeClass();
59 if( ::com::sun::star::uno::TypeClass_LONG == tc ) {
64 else if ( ::com::sun::star::uno::TypeClass_CHAR == tc ) {
68 else if ( ::com::sun::star::uno::TypeClass_SHORT == tc ) {
73 else if ( ::com::sun::star::uno::TypeClass_BOOLEAN == tc ) {
76 else if ( ::com::sun::star::uno::TypeClass_BYTE == tc ) {
81 else if ( ::com::sun::star::uno::TypeClass_UNSIGNED_SHORT == tc ) {
86 else if ( ::com::sun::star::uno::TypeClass_UNSIGNED_LONG == tc ) {
92 throw ::com::sun::star::lang::IllegalArgumentException();
97 SAL_THROW( (::com::sun::star::lang::IllegalArgumentException) )
99 const enum ::com::sun::star::uno::TypeClass tc = a.getValueType().getTypeClass();
101 if( ::com::sun::star::uno::TypeClass_HYPER == tc ) {
104 else if( ::com::sun::star::uno::TypeClass_UNSIGNED_HYPER == tc ) {
107 i = ( sal_Int64 ) i64;
109 else if( ::com::sun::star::uno::TypeClass_LONG == tc ) {
112 i = ( sal_Int64 )i32;
114 else if ( ::com::sun::star::uno::TypeClass_CHAR == tc ) {
119 else if ( ::com::sun::star::uno::TypeClass_SHORT == tc ) {
122 i = ( sal_Int64 ) i16;
124 else if ( ::com::sun::star::uno::TypeClass_BOOLEAN == tc ) {
129 else if ( ::com::sun::star::uno::TypeClass_BYTE == tc ) {
132 i = ( sal_Int64 ) i8;
134 else if ( ::com::sun::star::uno::TypeClass_UNSIGNED_SHORT == tc ) {
137 i = ( sal_Int64 ) i16;
139 else if ( ::com::sun::star::uno::TypeClass_UNSIGNED_LONG == tc ) {
142 i = ( sal_Int64 ) i32;
145 throw ::com::sun::star::lang::IllegalArgumentException();
151 SAL_THROW( (::com::sun::star::lang::IllegalArgumentException) )
153 const enum ::com::sun::star::uno::TypeClass tc = a.getValueType().getTypeClass();
155 if( ::com::sun::star::uno::TypeClass_UNSIGNED_HYPER == tc ) {
158 if( ::com::sun::star::uno::TypeClass_HYPER == tc ) {
161 i = ( sal_uInt64 ) i64;
163 else if( ::com::sun::star::uno::TypeClass_LONG == tc ) {
166 i = ( sal_uInt64 )i32;
168 else if ( ::com::sun::star::uno::TypeClass_CHAR == tc ) {
171 i = ( sal_uInt64 ) c;
173 else if ( ::com::sun::star::uno::TypeClass_SHORT == tc ) {
176 i = ( sal_uInt64 ) i16;
178 else if ( ::com::sun::star::uno::TypeClass_BOOLEAN == tc ) {
181 i = ( sal_uInt64 ) b;
183 else if ( ::com::sun::star::uno::TypeClass_BYTE == tc ) {
186 i = ( sal_uInt64 ) i8;
188 else if ( ::com::sun::star::uno::TypeClass_UNSIGNED_SHORT == tc ) {
191 i = ( sal_uInt64 ) i16;
193 else if ( ::com::sun::star::uno::TypeClass_UNSIGNED_LONG == tc ) {
196 i = ( sal_uInt64 ) i32;
199 throw ::com::sun::star::lang::IllegalArgumentException();
206 SAL_THROW( (::com::sun::star::lang::IllegalArgumentException) )
208 const enum ::com::sun::star::uno::TypeClass tc = a.getValueType().getTypeClass();
210 if( ::com::sun::star::uno::TypeClass_LONG == tc ) {
213 else if ( ::com::sun::star::uno::TypeClass_CHAR == tc ) {
218 else if ( ::com::sun::star::uno::TypeClass_SHORT == tc ) {
221 i = ( sal_Int32 ) i16;
223 else if ( ::com::sun::star::uno::TypeClass_BOOLEAN == tc ) {
228 else if ( ::com::sun::star::uno::TypeClass_BYTE == tc ) {
231 i = ( sal_Int32 ) i8;
233 else if ( ::com::sun::star::uno::TypeClass_UNSIGNED_SHORT == tc ) {
236 i = ( sal_Int32 ) i16;
238 else if ( ::com::sun::star::uno::TypeClass_UNSIGNED_LONG == tc ) {
241 i = ( sal_Int32 ) i32;
244 throw ::com::sun::star::lang::IllegalArgumentException();
249 SAL_THROW( (::com::sun::star::lang::IllegalArgumentException) )
251 const enum ::com::sun::star::uno::TypeClass tc = a.getValueType().getTypeClass();
253 if ( ::com::sun::star::uno::TypeClass_UNSIGNED_LONG == tc ) {
256 else if( ::com::sun::star::uno::TypeClass_LONG == tc ) {
259 i = (sal_uInt32 ) i32;
261 else if ( ::com::sun::star::uno::TypeClass_CHAR == tc ) {
264 i = ( sal_uInt32 ) c;
266 else if ( ::com::sun::star::uno::TypeClass_SHORT == tc ) {
269 i = ( sal_uInt32 ) i16;
271 else if ( ::com::sun::star::uno::TypeClass_BOOLEAN == tc ) {
274 i = ( sal_uInt32 ) b;
276 else if ( ::com::sun::star::uno::TypeClass_BYTE == tc ) {
279 i = ( sal_uInt32 ) i8;
281 else if ( ::com::sun::star::uno::TypeClass_UNSIGNED_SHORT == tc ) {
284 i = ( sal_uInt32 ) i16;
287 throw ::com::sun::star::lang::IllegalArgumentException();
293 SAL_THROW( (::com::sun::star::lang::IllegalArgumentException) )
295 const enum ::com::sun::star::uno::TypeClass tc = a.getValueType().getTypeClass();
297 if ( ::com::sun::star::uno::TypeClass_SHORT == tc ) {
300 else if ( ::com::sun::star::uno::TypeClass_CHAR == tc ) {
305 else if ( ::com::sun::star::uno::TypeClass_BOOLEAN == tc ) {
310 else if ( ::com::sun::star::uno::TypeClass_BYTE == tc ) {
313 i = ( sal_Int16 ) i8;
315 else if ( ::com::sun::star::uno::TypeClass_UNSIGNED_SHORT == tc ) {
318 i = ( sal_Int16 ) i16;
321 throw ::com::sun::star::lang::IllegalArgumentException();
326 SAL_THROW( (::com::sun::star::lang::IllegalArgumentException) )
328 const enum ::com::sun::star::uno::TypeClass tc = a.getValueType().getTypeClass();
330 if ( ::com::sun::star::uno::TypeClass_UNSIGNED_SHORT == tc ) {
333 else if ( ::com::sun::star::uno::TypeClass_CHAR == tc ) {
338 else if ( ::com::sun::star::uno::TypeClass_BOOLEAN == tc ) {
343 else if ( ::com::sun::star::uno::TypeClass_BYTE == tc ) {
346 i = ( sal_Int16 ) i8;
348 else if ( ::com::sun::star::uno::TypeClass_SHORT == tc ) {
351 i = ( sal_Int16 ) i16;
354 throw ::com::sun::star::lang::IllegalArgumentException();
359 SAL_THROW( (::com::sun::star::lang::IllegalArgumentException) )
361 const enum ::com::sun::star::uno::TypeClass tc = a.getValueType().getTypeClass();
363 if ( ::com::sun::star::uno::TypeClass_BYTE == tc ) {
366 else if ( ::com::sun::star::uno::TypeClass_BOOLEAN == tc ) {
372 throw ::com::sun::star::lang::IllegalArgumentException();
377 SAL_THROW( (::com::sun::star::lang::IllegalArgumentException) )
379 const enum ::com::sun::star::uno::TypeClass tc = a.getValueType().getTypeClass();
381 if ( ::com::sun::star::uno::TypeClass_FLOAT == tc ) {
384 else if( ::com::sun::star::uno::TypeClass_DOUBLE == tc ) {
389 else if( ::com::sun::star::uno::TypeClass_HYPER == tc ) {
400 else if( ::com::sun::star::uno::TypeClass_LONG == tc ) {
405 else if ( ::com::sun::star::uno::TypeClass_CHAR == tc ) {
410 else if ( ::com::sun::star::uno::TypeClass_SHORT == tc ) {
415 else if ( ::com::sun::star::uno::TypeClass_BOOLEAN == tc ) {
420 else if ( ::com::sun::star::uno::TypeClass_BYTE == tc ) {
425 else if ( ::com::sun::star::uno::TypeClass_UNSIGNED_SHORT == tc ) {
430 else if ( ::com::sun::star::uno::TypeClass_UNSIGNED_LONG == tc ) {
436 throw ::com::sun::star::lang::IllegalArgumentException();
442 SAL_THROW( (::com::sun::star::lang::IllegalArgumentException) )
444 const enum ::com::sun::star::uno::TypeClass tc = a.getValueType().getTypeClass();
446 if( ::com::sun::star::uno::TypeClass_DOUBLE == tc ) {
451 else if ( ::com::sun::star::uno::TypeClass_FLOAT == tc ) {
456 else if( ::com::sun::star::uno::TypeClass_HYPER == tc ) {
467 else if( ::com::sun::star::uno::TypeClass_LONG == tc ) {
472 else if ( ::com::sun::star::uno::TypeClass_CHAR == tc ) {
477 else if ( ::com::sun::star::uno::TypeClass_SHORT == tc ) {
482 else if ( ::com::sun::star::uno::TypeClass_BOOLEAN == tc ) {
487 else if ( ::com::sun::star::uno::TypeClass_BYTE == tc ) {
492 else if ( ::com::sun::star::uno::TypeClass_UNSIGNED_SHORT == tc ) {
497 else if ( ::com::sun::star::uno::TypeClass_UNSIGNED_LONG == tc ) {
503 throw ::com::sun::star::lang::IllegalArgumentException();
508 SAL_THROW( (::com::sun::star::lang::IllegalArgumentException) )
510 if( ::com::sun::star::uno::TypeClass_STRING == a.getValueType().getTypeClass() ) {
514 throw ::com::sun::star::lang::IllegalArgumentException();
This String class provides base functionality for C++ like Unicode character array handling...
Definition: ustring.hxx:82
sal_uInt16 sal_Unicode
Definition: types.h:136
void convertPropertyValue(target &value, const ::com::sun::star::uno::Any &a)
Converts the value stored in an any to a concrete C++ type.
Definition: proptypehlp.hxx:35
C++ class representing an IDL any.
Definition: Any.h:46
unsigned char sal_Bool
Definition: types.h:46
signed char sal_Int8
Definition: types.h:51
#define SAL_THROW(exc)
Definition of function throw clause macros.
Definition: types.h:358