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 ::com::sun::star::lang::IllegalArgumentException();
47 template <
class target >
58 const enum ::com::sun::star::uno::TypeClass tc = a.getValueType().getTypeClass();
60 if( ::com::sun::star::uno::TypeClass_LONG == tc ) {
65 else if ( ::com::sun::star::uno::TypeClass_CHAR == tc ) {
69 else if ( ::com::sun::star::uno::TypeClass_SHORT == tc ) {
74 else if ( ::com::sun::star::uno::TypeClass_BOOLEAN == tc ) {
75 b = *
static_cast<sal_Bool const *
>(a.getValue());
77 else if ( ::com::sun::star::uno::TypeClass_BYTE == tc ) {
82 else if ( ::com::sun::star::uno::TypeClass_UNSIGNED_SHORT == tc ) {
87 else if ( ::com::sun::star::uno::TypeClass_UNSIGNED_LONG == tc ) {
93 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 ) {
116 c = *
static_cast<sal_Unicode const *
>(a.getValue());
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 ) {
126 b = *
static_cast<sal_Bool const *
>(a.getValue());
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();
152 const enum ::com::sun::star::uno::TypeClass tc = a.getValueType().getTypeClass();
154 if( ::com::sun::star::uno::TypeClass_UNSIGNED_HYPER == tc ) {
157 if( ::com::sun::star::uno::TypeClass_HYPER == tc ) {
160 i = ( sal_uInt64 ) i64;
162 else if( ::com::sun::star::uno::TypeClass_LONG == tc ) {
165 i = ( sal_uInt64 )i32;
167 else if ( ::com::sun::star::uno::TypeClass_CHAR == tc ) {
169 c = *
static_cast<sal_Unicode const *
>(a.getValue());
170 i = ( sal_uInt64 ) c;
172 else if ( ::com::sun::star::uno::TypeClass_SHORT == tc ) {
175 i = ( sal_uInt64 ) i16;
177 else if ( ::com::sun::star::uno::TypeClass_BOOLEAN == tc ) {
179 b = *
static_cast<sal_Bool const *
>(a.getValue());
180 i = ( sal_uInt64 ) b;
182 else if ( ::com::sun::star::uno::TypeClass_BYTE == tc ) {
185 i = ( sal_uInt64 ) i8;
187 else if ( ::com::sun::star::uno::TypeClass_UNSIGNED_SHORT == tc ) {
190 i = ( sal_uInt64 ) i16;
192 else if ( ::com::sun::star::uno::TypeClass_UNSIGNED_LONG == tc ) {
195 i = ( sal_uInt64 ) i32;
198 throw ::com::sun::star::lang::IllegalArgumentException();
206 const enum ::com::sun::star::uno::TypeClass tc = a.getValueType().getTypeClass();
208 if( ::com::sun::star::uno::TypeClass_LONG == tc ) {
211 else if ( ::com::sun::star::uno::TypeClass_CHAR == tc ) {
213 c = *
static_cast<sal_Unicode const *
>(a.getValue());
216 else if ( ::com::sun::star::uno::TypeClass_SHORT == tc ) {
219 i = ( sal_Int32 ) i16;
221 else if ( ::com::sun::star::uno::TypeClass_BOOLEAN == tc ) {
223 b = *
static_cast<sal_Bool const *
>(a.getValue());
226 else if ( ::com::sun::star::uno::TypeClass_BYTE == tc ) {
229 i = ( sal_Int32 ) i8;
231 else if ( ::com::sun::star::uno::TypeClass_UNSIGNED_SHORT == tc ) {
234 i = ( sal_Int32 ) i16;
236 else if ( ::com::sun::star::uno::TypeClass_UNSIGNED_LONG == tc ) {
239 i = ( sal_Int32 ) i32;
242 throw ::com::sun::star::lang::IllegalArgumentException();
248 const enum ::com::sun::star::uno::TypeClass tc = a.getValueType().getTypeClass();
250 if ( ::com::sun::star::uno::TypeClass_UNSIGNED_LONG == tc ) {
253 else if( ::com::sun::star::uno::TypeClass_LONG == tc ) {
256 i = (sal_uInt32 ) i32;
258 else if ( ::com::sun::star::uno::TypeClass_CHAR == tc ) {
260 c = *
static_cast<sal_Unicode const *
>(a.getValue());
261 i = ( sal_uInt32 ) c;
263 else if ( ::com::sun::star::uno::TypeClass_SHORT == tc ) {
266 i = ( sal_uInt32 ) i16;
268 else if ( ::com::sun::star::uno::TypeClass_BOOLEAN == tc ) {
270 b = *
static_cast<sal_Bool const *
>(a.getValue());
271 i = ( sal_uInt32 ) b;
273 else if ( ::com::sun::star::uno::TypeClass_BYTE == tc ) {
276 i = ( sal_uInt32 ) i8;
278 else if ( ::com::sun::star::uno::TypeClass_UNSIGNED_SHORT == tc ) {
281 i = ( sal_uInt32 ) i16;
284 throw ::com::sun::star::lang::IllegalArgumentException();
291 const enum ::com::sun::star::uno::TypeClass tc = a.getValueType().getTypeClass();
293 if ( ::com::sun::star::uno::TypeClass_SHORT == tc ) {
296 else if ( ::com::sun::star::uno::TypeClass_CHAR == tc ) {
298 c = *
static_cast<sal_Unicode const *
>(a.getValue());
301 else if ( ::com::sun::star::uno::TypeClass_BOOLEAN == tc ) {
303 b = *
static_cast<sal_Bool const *
>(a.getValue());
306 else if ( ::com::sun::star::uno::TypeClass_BYTE == tc ) {
309 i = ( sal_Int16 ) i8;
311 else if ( ::com::sun::star::uno::TypeClass_UNSIGNED_SHORT == tc ) {
314 i = ( sal_Int16 ) i16;
317 throw ::com::sun::star::lang::IllegalArgumentException();
323 const enum ::com::sun::star::uno::TypeClass tc = a.getValueType().getTypeClass();
325 if ( ::com::sun::star::uno::TypeClass_UNSIGNED_SHORT == tc ) {
328 else if ( ::com::sun::star::uno::TypeClass_CHAR == tc ) {
330 c = *
static_cast<sal_Unicode const *
>(a.getValue());
333 else if ( ::com::sun::star::uno::TypeClass_BOOLEAN == tc ) {
335 b = *
static_cast<sal_Bool const *
>(a.getValue());
338 else if ( ::com::sun::star::uno::TypeClass_BYTE == tc ) {
341 i = ( sal_Int16 ) i8;
343 else if ( ::com::sun::star::uno::TypeClass_SHORT == tc ) {
346 i = ( sal_Int16 ) i16;
349 throw ::com::sun::star::lang::IllegalArgumentException();
355 const enum ::com::sun::star::uno::TypeClass tc = a.getValueType().getTypeClass();
357 if ( ::com::sun::star::uno::TypeClass_BYTE == tc ) {
360 else if ( ::com::sun::star::uno::TypeClass_BOOLEAN == tc ) {
362 b = *
static_cast<sal_Bool const *
>(a.getValue());
366 throw ::com::sun::star::lang::IllegalArgumentException();
372 const enum ::com::sun::star::uno::TypeClass tc = a.getValueType().getTypeClass();
374 if ( ::com::sun::star::uno::TypeClass_FLOAT == tc ) {
377 else if( ::com::sun::star::uno::TypeClass_DOUBLE == tc ) {
382 else if( ::com::sun::star::uno::TypeClass_HYPER == tc ) {
393 else if( ::com::sun::star::uno::TypeClass_LONG == tc ) {
398 else if ( ::com::sun::star::uno::TypeClass_CHAR == tc ) {
400 c = *
static_cast<sal_Unicode const *
>(a.getValue());
403 else if ( ::com::sun::star::uno::TypeClass_SHORT == tc ) {
408 else if ( ::com::sun::star::uno::TypeClass_BOOLEAN == tc ) {
410 b = *
static_cast<sal_Bool const *
>(a.getValue());
413 else if ( ::com::sun::star::uno::TypeClass_BYTE == tc ) {
418 else if ( ::com::sun::star::uno::TypeClass_UNSIGNED_SHORT == tc ) {
423 else if ( ::com::sun::star::uno::TypeClass_UNSIGNED_LONG == tc ) {
429 throw ::com::sun::star::lang::IllegalArgumentException();
436 const enum ::com::sun::star::uno::TypeClass tc = a.getValueType().getTypeClass();
438 if( ::com::sun::star::uno::TypeClass_DOUBLE == tc ) {
443 else if ( ::com::sun::star::uno::TypeClass_FLOAT == tc ) {
448 else if( ::com::sun::star::uno::TypeClass_HYPER == tc ) {
459 else if( ::com::sun::star::uno::TypeClass_LONG == tc ) {
464 else if ( ::com::sun::star::uno::TypeClass_CHAR == tc ) {
466 c = *
static_cast<sal_Unicode const *
>(a.getValue());
469 else if ( ::com::sun::star::uno::TypeClass_SHORT == tc ) {
474 else if ( ::com::sun::star::uno::TypeClass_BOOLEAN == tc ) {
476 b = *
static_cast<sal_Bool const *
>(a.getValue());
479 else if ( ::com::sun::star::uno::TypeClass_BYTE == tc ) {
484 else if ( ::com::sun::star::uno::TypeClass_UNSIGNED_SHORT == tc ) {
489 else if ( ::com::sun::star::uno::TypeClass_UNSIGNED_LONG == tc ) {
495 throw ::com::sun::star::lang::IllegalArgumentException();
501 if( ::com::sun::star::uno::TypeClass_STRING == a.getValueType().getTypeClass() ) {
505 throw ::com::sun::star::lang::IllegalArgumentException();
unsigned char sal_Bool
Definition: types.h:48
sal_uInt16 sal_Unicode
Definition: types.h:152
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:37
C++ class representing an IDL any.
Definition: Any.h:49
signed char sal_Int8
Definition: types.h:53
This String class provides base functionality for C++ like Unicode character array handling...
Definition: ustring.hxx:115
Definition: Enterable.hxx:26