19 #ifndef INCLUDED_CPPUHELPER_PROPTYPEHLP_HXX 20 #define INCLUDED_CPPUHELPER_PROPTYPEHLP_HXX 23 #include <com/sun/star/lang/IllegalArgumentException.hpp> 24 #include <com/sun/star/uno/TypeClass.hpp> 36 template <
class target >
40 if( !( a >>= value ) ) {
41 throw css::lang::IllegalArgumentException();
51 const enum css::uno::TypeClass tc = a.getValueType().getTypeClass();
53 if( css::uno::TypeClass_LONG == tc ) {
58 else if ( css::uno::TypeClass_CHAR == tc ) {
62 else if ( css::uno::TypeClass_SHORT == tc ) {
67 else if ( css::uno::TypeClass_BOOLEAN == tc ) {
68 b = *
static_cast<sal_Bool const *
>(a.getValue());
70 else if ( css::uno::TypeClass_BYTE == tc ) {
75 else if ( css::uno::TypeClass_UNSIGNED_SHORT == tc ) {
80 else if ( css::uno::TypeClass_UNSIGNED_LONG == tc ) {
86 throw css::lang::IllegalArgumentException();
98 const enum css::uno::TypeClass tc = a.getValueType().getTypeClass();
100 if( css::uno::TypeClass_HYPER == tc ) {
103 else if( css::uno::TypeClass_UNSIGNED_HYPER == tc ) {
106 i = ( sal_Int64 ) i64;
108 else if( css::uno::TypeClass_LONG == tc ) {
111 i = ( sal_Int64 )i32;
113 else if ( css::uno::TypeClass_CHAR == tc ) {
115 c = *
static_cast<sal_Unicode const *
>(a.getValue());
118 else if ( css::uno::TypeClass_SHORT == tc ) {
121 i = ( sal_Int64 ) i16;
123 else if ( css::uno::TypeClass_BOOLEAN == tc ) {
125 b = *
static_cast<sal_Bool const *
>(a.getValue());
128 else if ( css::uno::TypeClass_BYTE == tc ) {
131 i = ( sal_Int64 ) i8;
133 else if ( css::uno::TypeClass_UNSIGNED_SHORT == tc ) {
136 i = ( sal_Int64 ) i16;
138 else if ( css::uno::TypeClass_UNSIGNED_LONG == tc ) {
141 i = ( sal_Int64 ) i32;
144 throw css::lang::IllegalArgumentException();
151 const enum css::uno::TypeClass tc = a.getValueType().getTypeClass();
153 if( css::uno::TypeClass_UNSIGNED_HYPER == tc ) {
156 if( css::uno::TypeClass_HYPER == tc ) {
159 i = ( sal_uInt64 ) i64;
161 else if( css::uno::TypeClass_LONG == tc ) {
164 i = ( sal_uInt64 )i32;
166 else if ( css::uno::TypeClass_CHAR == tc ) {
168 c = *
static_cast<sal_Unicode const *
>(a.getValue());
169 i = ( sal_uInt64 ) c;
171 else if ( css::uno::TypeClass_SHORT == tc ) {
174 i = ( sal_uInt64 ) i16;
176 else if ( css::uno::TypeClass_BOOLEAN == tc ) {
178 b = *
static_cast<sal_Bool const *
>(a.getValue());
179 i = ( sal_uInt64 ) b;
181 else if ( css::uno::TypeClass_BYTE == tc ) {
184 i = ( sal_uInt64 ) i8;
186 else if ( css::uno::TypeClass_UNSIGNED_SHORT == tc ) {
189 i = ( sal_uInt64 ) i16;
191 else if ( css::uno::TypeClass_UNSIGNED_LONG == tc ) {
194 i = ( sal_uInt64 ) i32;
197 throw css::lang::IllegalArgumentException();
205 const enum css::uno::TypeClass tc = a.getValueType().getTypeClass();
207 if( css::uno::TypeClass_LONG == tc ) {
210 else if ( css::uno::TypeClass_CHAR == tc ) {
212 c = *
static_cast<sal_Unicode const *
>(a.getValue());
215 else if ( css::uno::TypeClass_SHORT == tc ) {
218 i = ( sal_Int32 ) i16;
220 else if ( css::uno::TypeClass_BOOLEAN == tc ) {
222 b = *
static_cast<sal_Bool const *
>(a.getValue());
225 else if ( css::uno::TypeClass_BYTE == tc ) {
228 i = ( sal_Int32 ) i8;
230 else if ( css::uno::TypeClass_UNSIGNED_SHORT == tc ) {
233 i = ( sal_Int32 ) i16;
235 else if ( css::uno::TypeClass_UNSIGNED_LONG == tc ) {
238 i = ( sal_Int32 ) i32;
241 throw css::lang::IllegalArgumentException();
247 const enum css::uno::TypeClass tc = a.getValueType().getTypeClass();
249 if ( css::uno::TypeClass_UNSIGNED_LONG == tc ) {
252 else if( css::uno::TypeClass_LONG == tc ) {
255 i = (sal_uInt32 ) i32;
257 else if ( css::uno::TypeClass_CHAR == tc ) {
259 c = *
static_cast<sal_Unicode const *
>(a.getValue());
260 i = ( sal_uInt32 ) c;
262 else if ( css::uno::TypeClass_SHORT == tc ) {
265 i = ( sal_uInt32 ) i16;
267 else if ( css::uno::TypeClass_BOOLEAN == tc ) {
269 b = *
static_cast<sal_Bool const *
>(a.getValue());
270 i = ( sal_uInt32 ) b;
272 else if ( css::uno::TypeClass_BYTE == tc ) {
275 i = ( sal_uInt32 ) i8;
277 else if ( css::uno::TypeClass_UNSIGNED_SHORT == tc ) {
280 i = ( sal_uInt32 ) i16;
283 throw css::lang::IllegalArgumentException();
290 const enum css::uno::TypeClass tc = a.getValueType().getTypeClass();
292 if ( css::uno::TypeClass_SHORT == tc ) {
295 else if ( css::uno::TypeClass_CHAR == tc ) {
297 c = *
static_cast<sal_Unicode const *
>(a.getValue());
300 else if ( css::uno::TypeClass_BOOLEAN == tc ) {
302 b = *
static_cast<sal_Bool const *
>(a.getValue());
305 else if ( css::uno::TypeClass_BYTE == tc ) {
308 i = ( sal_Int16 ) i8;
310 else if ( css::uno::TypeClass_UNSIGNED_SHORT == tc ) {
313 i = ( sal_Int16 ) i16;
316 throw css::lang::IllegalArgumentException();
322 const enum css::uno::TypeClass tc = a.getValueType().getTypeClass();
324 if ( css::uno::TypeClass_UNSIGNED_SHORT == tc ) {
327 else if ( css::uno::TypeClass_CHAR == tc ) {
329 c = *
static_cast<sal_Unicode const *
>(a.getValue());
332 else if ( css::uno::TypeClass_BOOLEAN == tc ) {
334 b = *
static_cast<sal_Bool const *
>(a.getValue());
337 else if ( css::uno::TypeClass_BYTE == tc ) {
340 i = ( sal_Int16 ) i8;
342 else if ( css::uno::TypeClass_SHORT == tc ) {
345 i = ( sal_Int16 ) i16;
348 throw css::lang::IllegalArgumentException();
354 const enum css::uno::TypeClass tc = a.getValueType().getTypeClass();
356 if ( css::uno::TypeClass_BYTE == tc ) {
359 else if ( css::uno::TypeClass_BOOLEAN == tc ) {
361 b = *
static_cast<sal_Bool const *
>(a.getValue());
365 throw css::lang::IllegalArgumentException();
371 const enum css::uno::TypeClass tc = a.getValueType().getTypeClass();
373 if ( css::uno::TypeClass_FLOAT == tc ) {
376 else if( css::uno::TypeClass_DOUBLE == tc ) {
381 else if( css::uno::TypeClass_HYPER == tc ) {
386 else if( css::uno::TypeClass_UNSIGNED_HYPER == tc ) {
391 else if( css::uno::TypeClass_LONG == tc ) {
396 else if ( css::uno::TypeClass_CHAR == tc ) {
398 c = *
static_cast<sal_Unicode const *
>(a.getValue());
401 else if ( css::uno::TypeClass_SHORT == tc ) {
406 else if ( css::uno::TypeClass_BOOLEAN == tc ) {
408 b = *
static_cast<sal_Bool const *
>(a.getValue());
411 else if ( css::uno::TypeClass_BYTE == tc ) {
416 else if ( css::uno::TypeClass_UNSIGNED_SHORT == tc ) {
421 else if ( css::uno::TypeClass_UNSIGNED_LONG == tc ) {
427 throw css::lang::IllegalArgumentException();
434 const enum css::uno::TypeClass tc = a.getValueType().getTypeClass();
436 if( css::uno::TypeClass_DOUBLE == tc ) {
441 else if ( css::uno::TypeClass_FLOAT == tc ) {
446 else if( css::uno::TypeClass_HYPER == tc ) {
451 else if( css::uno::TypeClass_UNSIGNED_HYPER == tc ) {
456 else if( css::uno::TypeClass_LONG == tc ) {
461 else if ( css::uno::TypeClass_CHAR == tc ) {
463 c = *
static_cast<sal_Unicode const *
>(a.getValue());
466 else if ( css::uno::TypeClass_SHORT == tc ) {
471 else if ( css::uno::TypeClass_BOOLEAN == tc ) {
473 b = *
static_cast<sal_Bool const *
>(a.getValue());
476 else if ( css::uno::TypeClass_BYTE == tc ) {
481 else if ( css::uno::TypeClass_UNSIGNED_SHORT == tc ) {
486 else if ( css::uno::TypeClass_UNSIGNED_LONG == tc ) {
492 throw css::lang::IllegalArgumentException();
498 if( css::uno::TypeClass_STRING == a.getValueType().getTypeClass() ) {
502 throw css::lang::IllegalArgumentException();
void convertPropertyValue(target &value, const css::uno::Any &a)
Converts the value stored in an any to a concrete C++ type.
Definition: proptypehlp.hxx:37
Definition: Enterable.hxx:26
unsigned char sal_Bool
Definition: types.h:48
signed char sal_Int8
Definition: types.h:53
sal_uInt16 sal_Unicode
Definition: types.h:155
This String class provides base functionality for C++ like Unicode character array handling...
Definition: ustring.hxx:106