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();
92 const enum css::uno::TypeClass tc = a.getValueType().getTypeClass();
94 if( css::uno::TypeClass_HYPER == tc ) {
97 else if( css::uno::TypeClass_UNSIGNED_HYPER == tc ) {
100 i = ( sal_Int64 ) i64;
102 else if( css::uno::TypeClass_LONG == tc ) {
105 i = ( sal_Int64 )i32;
107 else if ( css::uno::TypeClass_CHAR == tc ) {
109 c = *
static_cast<sal_Unicode const *
>(a.getValue());
112 else if ( css::uno::TypeClass_SHORT == tc ) {
115 i = ( sal_Int64 ) i16;
117 else if ( css::uno::TypeClass_BOOLEAN == tc ) {
119 b = *
static_cast<sal_Bool const *
>(a.getValue());
122 else if ( css::uno::TypeClass_BYTE == tc ) {
125 i = ( sal_Int64 ) i8;
127 else if ( css::uno::TypeClass_UNSIGNED_SHORT == tc ) {
130 i = ( sal_Int64 ) i16;
132 else if ( css::uno::TypeClass_UNSIGNED_LONG == tc ) {
135 i = ( sal_Int64 ) i32;
138 throw css::lang::IllegalArgumentException();
145 const enum css::uno::TypeClass tc = a.getValueType().getTypeClass();
147 if( css::uno::TypeClass_UNSIGNED_HYPER == tc ) {
150 if( css::uno::TypeClass_HYPER == tc ) {
153 i = ( sal_uInt64 ) i64;
155 else if( css::uno::TypeClass_LONG == tc ) {
158 i = ( sal_uInt64 )i32;
160 else if ( css::uno::TypeClass_CHAR == tc ) {
162 c = *
static_cast<sal_Unicode const *
>(a.getValue());
163 i = ( sal_uInt64 ) c;
165 else if ( css::uno::TypeClass_SHORT == tc ) {
168 i = ( sal_uInt64 ) i16;
170 else if ( css::uno::TypeClass_BOOLEAN == tc ) {
172 b = *
static_cast<sal_Bool const *
>(a.getValue());
173 i = ( sal_uInt64 ) b;
175 else if ( css::uno::TypeClass_BYTE == tc ) {
178 i = ( sal_uInt64 ) i8;
180 else if ( css::uno::TypeClass_UNSIGNED_SHORT == tc ) {
183 i = ( sal_uInt64 ) i16;
185 else if ( css::uno::TypeClass_UNSIGNED_LONG == tc ) {
188 i = ( sal_uInt64 ) i32;
191 throw css::lang::IllegalArgumentException();
199 const enum css::uno::TypeClass tc = a.getValueType().getTypeClass();
201 if( css::uno::TypeClass_LONG == tc ) {
204 else if ( css::uno::TypeClass_CHAR == tc ) {
206 c = *
static_cast<sal_Unicode const *
>(a.getValue());
209 else if ( css::uno::TypeClass_SHORT == tc ) {
212 i = ( sal_Int32 ) i16;
214 else if ( css::uno::TypeClass_BOOLEAN == tc ) {
216 b = *
static_cast<sal_Bool const *
>(a.getValue());
219 else if ( css::uno::TypeClass_BYTE == tc ) {
222 i = ( sal_Int32 ) i8;
224 else if ( css::uno::TypeClass_UNSIGNED_SHORT == tc ) {
227 i = ( sal_Int32 ) i16;
229 else if ( css::uno::TypeClass_UNSIGNED_LONG == tc ) {
232 i = ( sal_Int32 ) i32;
235 throw css::lang::IllegalArgumentException();
241 const enum css::uno::TypeClass tc = a.getValueType().getTypeClass();
243 if ( css::uno::TypeClass_UNSIGNED_LONG == tc ) {
246 else if( css::uno::TypeClass_LONG == tc ) {
249 i = (sal_uInt32 ) i32;
251 else if ( css::uno::TypeClass_CHAR == tc ) {
253 c = *
static_cast<sal_Unicode const *
>(a.getValue());
254 i = ( sal_uInt32 ) c;
256 else if ( css::uno::TypeClass_SHORT == tc ) {
259 i = ( sal_uInt32 ) i16;
261 else if ( css::uno::TypeClass_BOOLEAN == tc ) {
263 b = *
static_cast<sal_Bool const *
>(a.getValue());
264 i = ( sal_uInt32 ) b;
266 else if ( css::uno::TypeClass_BYTE == tc ) {
269 i = ( sal_uInt32 ) i8;
271 else if ( css::uno::TypeClass_UNSIGNED_SHORT == tc ) {
274 i = ( sal_uInt32 ) i16;
277 throw css::lang::IllegalArgumentException();
284 const enum css::uno::TypeClass tc = a.getValueType().getTypeClass();
286 if ( css::uno::TypeClass_SHORT == tc ) {
289 else if ( css::uno::TypeClass_CHAR == tc ) {
291 c = *
static_cast<sal_Unicode const *
>(a.getValue());
294 else if ( css::uno::TypeClass_BOOLEAN == tc ) {
296 b = *
static_cast<sal_Bool const *
>(a.getValue());
299 else if ( css::uno::TypeClass_BYTE == tc ) {
302 i = ( sal_Int16 ) i8;
304 else if ( css::uno::TypeClass_UNSIGNED_SHORT == tc ) {
307 i = ( sal_Int16 ) i16;
310 throw css::lang::IllegalArgumentException();
316 const enum css::uno::TypeClass tc = a.getValueType().getTypeClass();
318 if ( css::uno::TypeClass_UNSIGNED_SHORT == tc ) {
321 else if ( css::uno::TypeClass_CHAR == tc ) {
323 c = *
static_cast<sal_Unicode const *
>(a.getValue());
326 else if ( css::uno::TypeClass_BOOLEAN == tc ) {
328 b = *
static_cast<sal_Bool const *
>(a.getValue());
331 else if ( css::uno::TypeClass_BYTE == tc ) {
334 i = ( sal_Int16 ) i8;
336 else if ( css::uno::TypeClass_SHORT == tc ) {
339 i = ( sal_Int16 ) i16;
342 throw css::lang::IllegalArgumentException();
348 const enum css::uno::TypeClass tc = a.getValueType().getTypeClass();
350 if ( css::uno::TypeClass_BYTE == tc ) {
353 else if ( css::uno::TypeClass_BOOLEAN == tc ) {
355 b = *
static_cast<sal_Bool const *
>(a.getValue());
359 throw css::lang::IllegalArgumentException();
365 const enum css::uno::TypeClass tc = a.getValueType().getTypeClass();
367 if ( css::uno::TypeClass_FLOAT == tc ) {
370 else if( css::uno::TypeClass_DOUBLE == tc ) {
375 else if( css::uno::TypeClass_HYPER == tc ) {
380 else if( css::uno::TypeClass_UNSIGNED_HYPER == tc ) {
385 else if( css::uno::TypeClass_LONG == tc ) {
390 else if ( css::uno::TypeClass_CHAR == tc ) {
392 c = *
static_cast<sal_Unicode const *
>(a.getValue());
395 else if ( css::uno::TypeClass_SHORT == tc ) {
400 else if ( css::uno::TypeClass_BOOLEAN == tc ) {
402 b = *
static_cast<sal_Bool const *
>(a.getValue());
405 else if ( css::uno::TypeClass_BYTE == tc ) {
410 else if ( css::uno::TypeClass_UNSIGNED_SHORT == tc ) {
415 else if ( css::uno::TypeClass_UNSIGNED_LONG == tc ) {
421 throw css::lang::IllegalArgumentException();
428 const enum css::uno::TypeClass tc = a.getValueType().getTypeClass();
430 if( css::uno::TypeClass_DOUBLE == tc ) {
435 else if ( css::uno::TypeClass_FLOAT == tc ) {
440 else if( css::uno::TypeClass_HYPER == tc ) {
445 else if( css::uno::TypeClass_UNSIGNED_HYPER == tc ) {
450 else if( css::uno::TypeClass_LONG == tc ) {
455 else if ( css::uno::TypeClass_CHAR == tc ) {
457 c = *
static_cast<sal_Unicode const *
>(a.getValue());
460 else if ( css::uno::TypeClass_SHORT == tc ) {
465 else if ( css::uno::TypeClass_BOOLEAN == tc ) {
467 b = *
static_cast<sal_Bool const *
>(a.getValue());
470 else if ( css::uno::TypeClass_BYTE == tc ) {
475 else if ( css::uno::TypeClass_UNSIGNED_SHORT == tc ) {
480 else if ( css::uno::TypeClass_UNSIGNED_LONG == tc ) {
486 throw css::lang::IllegalArgumentException();
492 if( css::uno::TypeClass_STRING == a.getValueType().getTypeClass() ) {
496 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