24#ifndef INCLUDED_CPPUHELPER_PROPTYPEHLP_HXX
25#define INCLUDED_CPPUHELPER_PROPTYPEHLP_HXX
28#include "com/sun/star/lang/IllegalArgumentException.hpp"
29#include "com/sun/star/uno/TypeClass.hpp"
34template <
class target >
38 if( !( a >>= value ) ) {
39 throw css::lang::IllegalArgumentException();
49 case css::uno::TypeClass_BYTE:
52 case css::uno::TypeClass_SHORT:
53 b = a.
get<sal_Int16>() != 0;
55 case css::uno::TypeClass_UNSIGNED_SHORT:
62 case css::uno::TypeClass_LONG:
63 b = a.
get<sal_Int32>() != 0;
65 case css::uno::TypeClass_UNSIGNED_LONG:
66 b = a.
get<sal_uInt32>() != 0;
68 case css::uno::TypeClass_CHAR:
75 throw css::lang::IllegalArgumentException();
89 case css::uno::TypeClass_BOOLEAN:
90 i =
static_cast<sal_Int64
>(a.
get<
bool>());
92 case css::uno::TypeClass_CHAR:
96 i =
static_cast<sal_Int64
>(c);
100 throw css::lang::IllegalArgumentException();
110 case css::uno::TypeClass_BOOLEAN:
111 i =
static_cast<sal_uInt64
>(a.
get<
bool>());
113 case css::uno::TypeClass_CHAR:
117 i =
static_cast<sal_uInt64
>(c);
121 throw css::lang::IllegalArgumentException();
130 case css::uno::TypeClass_BOOLEAN:
131 i =
static_cast<sal_Int32
>(a.
get<
bool>());
133 case css::uno::TypeClass_CHAR:
137 i =
static_cast<sal_Int32
>(c);
141 throw css::lang::IllegalArgumentException();
150 case css::uno::TypeClass_BOOLEAN:
151 i =
static_cast<sal_uInt32
>(a.
get<
bool>());
153 case css::uno::TypeClass_CHAR:
157 i =
static_cast<sal_uInt32
>(c);
161 throw css::lang::IllegalArgumentException();
170 case css::uno::TypeClass_BOOLEAN:
171 i =
static_cast<sal_Int16
>(a.
get<
bool>());
173 case css::uno::TypeClass_CHAR:
177 i =
static_cast<sal_Int16
>(c);
181 throw css::lang::IllegalArgumentException();
190 case css::uno::TypeClass_BOOLEAN:
191 i =
static_cast<sal_uInt16
>(a.
get<
bool>());
193 case css::uno::TypeClass_CHAR:
197 i =
static_cast<sal_Int16
>(c);
201 throw css::lang::IllegalArgumentException();
210 case css::uno::TypeClass_BOOLEAN:
214 throw css::lang::IllegalArgumentException();
225 case css::uno::TypeClass_BOOLEAN:
226 f =
static_cast<float>(a.
get<
bool>());
228 case css::uno::TypeClass_LONG:
229 f =
static_cast<float>(a.
get<sal_Int32>());
231 case css::uno::TypeClass_UNSIGNED_LONG:
232 f =
static_cast<float>(a.
get<sal_uInt32>());
234 case css::uno::TypeClass_HYPER:
235 f =
static_cast<float>(a.
get<sal_Int64>());
237 case css::uno::TypeClass_UNSIGNED_HYPER:
238 f =
static_cast<float>(a.
get<sal_uInt64>());
240 case css::uno::TypeClass_DOUBLE:
241 f =
static_cast<float>(a.
get<
double>());
243 case css::uno::TypeClass_CHAR:
247 f =
static_cast<float>(c);
251 throw css::lang::IllegalArgumentException();
261 case css::uno::TypeClass_BOOLEAN:
262 d =
static_cast<double>(a.
get<
bool>());
264 case css::uno::TypeClass_HYPER:
265 d =
static_cast<double>(a.
get<sal_Int64>());
267 case css::uno::TypeClass_UNSIGNED_HYPER:
268 d =
static_cast<double>(a.
get<sal_uInt64>());
270 case css::uno::TypeClass_CHAR:
274 d =
static_cast<double>(c);
278 throw css::lang::IllegalArgumentException();
unsigned char sal_Bool
Definition types.h:38
sal_uInt16 sal_Unicode
Definition types.h:123
signed char sal_Int8
Definition types.h:43
Definition Enterable.hxx:31
void convertPropertyValue(target &value, const css::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:58
const Type & getValueType() const
Gets the type of the set value.
Definition Any.h:159
T get() const
Provides a value of specified type, so you can easily write e.g.
Definition Any.hxx:683
const void * getValue() const
Gets a pointer to the set value.
Definition Any.h:200
TypeClass getTypeClass() const
Gets the type class of set type.
Definition Type.h:142