19 #ifndef _COM_SUN_STAR_UNO_ANY_HXX_
20 #define _COM_SUN_STAR_UNO_ANY_HXX_
25 #include <com/sun/star/uno/XInterface.hpp>
49 this, const_cast<T *>(&value),
71 this, const_cast< void * >( pData_ ), rType.getTypeLibType(),
98 this, rAny.pData, rAny.pType,
112 this, const_cast< void * >( pData_ ), rType.getTypeLibType(),
119 this, const_cast< void * >( pData_ ), pType_,
126 this, const_cast< void * >( pData_ ), pTypeDescr,
139 rType.getTypeLibType(), pData, pType,
144 template <
typename T>
153 #if ! defined(__SUNPRO_CC)
156 bool Any::has<sal_uInt16>()
const;
157 #endif // ! defined(__SUNPRO_CC)
163 pData, pType, rAny.pData, rAny.pType,
170 pData, pType, rAny.pData, rAny.pType,
191 #ifdef RTL_FAST_STRING
192 template<
class C1,
class C2 >
193 inline Any SAL_CALL
makeAny(
const rtl::OUStringConcat< C1, C2 >& value )
SAL_THROW(())
221 #ifdef RTL_FAST_STRING
222 template<
class C1,
class C2 >
223 inline void SAL_CALL operator <<= ( Any & rAny, const rtl::OUStringConcat< C1, C2 >& value )
229 &rAny, const_cast< rtl::OUString * >( &str ), rType.getTypeLibType(),
240 rAny.pData, rAny.
pType,
260 (value !=
sal_False) == (* reinterpret_cast< const sal_Bool * >( rAny.pData ) !=
sal_False));
270 value = *
reinterpret_cast< sal_Bool const *
>(
284 (*reinterpret_cast< sal_Bool const * >( rAny.pData )
294 value = *
reinterpret_cast< const sal_Int8 *
>( rAny.pData );
303 switch (rAny.pType->eTypeClass)
306 value = *
reinterpret_cast< const sal_Int8 *
>( rAny.pData );
310 value = *
reinterpret_cast< const sal_Int16 *
>( rAny.pData );
319 switch (rAny.pType->eTypeClass)
322 value = (sal_uInt16)( * reinterpret_cast< const sal_Int8 * >( rAny.pData ) );
326 value = *
reinterpret_cast< const sal_uInt16 *
>( rAny.pData );
336 switch (rAny.pType->eTypeClass)
339 value = *
reinterpret_cast< const sal_Int8 *
>( rAny.pData );
342 value = *
reinterpret_cast< const sal_Int16 *
>( rAny.pData );
345 value = *
reinterpret_cast< const sal_uInt16 *
>( rAny.pData );
349 value = *
reinterpret_cast< const sal_Int32 *
>( rAny.pData );
358 switch (rAny.pType->eTypeClass)
361 value = (sal_uInt32)( * reinterpret_cast< const sal_Int8 * >( rAny.pData ) );
364 value = (sal_uInt32)( * reinterpret_cast< const sal_Int16 * >( rAny.pData ) );
367 value = *
reinterpret_cast< const sal_uInt16 *
>( rAny.pData );
371 value = *
reinterpret_cast< const sal_uInt32 *
>( rAny.pData );
381 switch (rAny.pType->eTypeClass)
384 value = *
reinterpret_cast< const sal_Int8 *
>( rAny.pData );
387 value = *
reinterpret_cast< const sal_Int16 *
>( rAny.pData );
390 value = *
reinterpret_cast< const sal_uInt16 *
>( rAny.pData );
393 value = *
reinterpret_cast< const sal_Int32 *
>( rAny.pData );
396 value = *
reinterpret_cast< const sal_uInt32 *
>( rAny.pData );
400 value = *
reinterpret_cast< const sal_Int64 *
>( rAny.pData );
409 switch (rAny.pType->eTypeClass)
412 value = (sal_uInt64)( * reinterpret_cast< const sal_Int8 * >( rAny.pData ) );
415 value = (sal_uInt64)( * reinterpret_cast< const sal_Int16 * >( rAny.pData ) );
418 value = *
reinterpret_cast< const sal_uInt16 *
>( rAny.pData );
421 value = (sal_uInt64)( * reinterpret_cast< const sal_Int32 * >( rAny.pData ) );
424 value = *
reinterpret_cast< const sal_uInt32 *
>( rAny.pData );
428 value = *
reinterpret_cast< const sal_uInt64 *
>( rAny.pData );
438 switch (rAny.pType->eTypeClass)
441 value = *
reinterpret_cast< const sal_Int8 *
>( rAny.pData );
444 value = *
reinterpret_cast< const sal_Int16 *
>( rAny.pData );
447 value = *
reinterpret_cast< const sal_uInt16 *
>( rAny.pData );
450 value = *
reinterpret_cast< const float *
>( rAny.pData );
460 switch (rAny.pType->eTypeClass)
463 value = *
reinterpret_cast< const sal_Int8 *
>( rAny.pData );
466 value = *
reinterpret_cast< const sal_Int16 *
>( rAny.pData );
469 value = *
reinterpret_cast< const sal_uInt16 *
>( rAny.pData );
472 value = *
reinterpret_cast< const sal_Int32 *
>( rAny.pData );
475 value = *
reinterpret_cast< const sal_uInt32 *
>( rAny.pData );
478 value = *
reinterpret_cast< const float *
>( rAny.pData );
481 value = *
reinterpret_cast< const double *
>( rAny.pData );
493 value = *
reinterpret_cast< const ::
rtl::OUString *
>( rAny.pData );
502 value.equals( * reinterpret_cast< const ::rtl::OUString * >( rAny.pData ) ));
510 value = *
reinterpret_cast< const Type *
>( rAny.pData );
519 value.equals( * reinterpret_cast< const Type * >( rAny.pData ) ));
528 &value, rAny.pData, rAny.pType,
539 return reinterpret_cast< const BaseReference *
>( rAny.pData )->
operator == ( value );
551 rAny.pData, rAny.pType,
560 return (!
operator == ( rAny, value ));
563 #if ! defined(EXCEPTIONS_OFF)
569 template <
typename T>
573 if (! (*
this >>= value)) {
574 throw RuntimeException(
586 sal_uInt16 Any::get<sal_uInt16>()
const;
587 #endif // ! defined(EXCEPTIONS_OFF)
void cpp_acquire(void *pCppI)
Function to acquire a C++ interface.
Definition: genfunc.hxx:36
CPPU_DLLPUBLIC void uno_any_assign(uno_Any *pDest, void *pSource, struct _typelib_TypeDescription *pTypeDescr, uno_AcquireFunc acquire, uno_ReleaseFunc release) SAL_THROW_EXTERN_C()
Assign an any with a given value.
sal_Bool isExtractableTo(const Type &rType) const
Tests whether this any is extractable to a value of given type.
Definition: Any.hxx:136
Any & operator=(const Any &rAny)
Assignment operator: Sets the value of the given any.
Definition: Any.hxx:93
void * pData
pointer to value; this may point to pReserved and thus the uno_Any is not anytime mem-copyable! You m...
Definition: any2.h:49
Any()
Default constructor: Any holds no value; its type is void.
Definition: Any.hxx:39
sal_Bool operator!=(const Any &rAny, const C &value)
Template unequality operator: compares set value of left side any to right side value.
Definition: Any.hxx:558
Holds a weak reference to a type description.
Definition: typedescription.h:40
CPPU_DLLPUBLIC void uno_any_construct(uno_Any *pDest, void *pSource, struct _typelib_TypeDescription *pTypeDescr, uno_AcquireFunc acquire) SAL_THROW_EXTERN_C()
Constructs an any with a given value.
bool has() const
Tests whether this any can provide a value of specified type.
Definition: Any.hxx:145
CPPU_DLLPUBLIC void uno_any_clear(uno_Any *pValue, uno_ReleaseFunc release) SAL_THROW_EXTERN_C()
Sets value to void.
This String class provides base functionality for C++ like Unicode character array handling...
Definition: ustring.hxx:87
#define sal_True
Definition: types.h:39
type class of type
Definition: typeclass.h:55
void(* uno_ReleaseFunc)(void *pInterface)
Generic function pointer declaration to release an interface.
Definition: data.h:52
C++ class representing an IDL meta type.
Definition: Type.h:55
#define SAL_THROW_EXTERN_C()
Definition: types.h:358
void clear()
Clears this any.
Definition: Any.hxx:130
#define SAL_THROW(exc)
Definition of function throw clause macros.
Definition: types.h:356
void cpp_release(void *pCppI)
Function to release a C++ interface.
Definition: genfunc.hxx:42
This base class serves as a base class for all template reference classes and has been introduced due...
Definition: Reference.h:54
::com::sun::star::uno::Type const & getTypeFavourUnsigned(SAL_UNUSED_PARAMETER T const *)
A working replacement for getCppuType (see there).
Definition: unotype.hxx:287
type class of byte
Definition: typeclass.h:35
rtl_uString * pTypeName
fully qualified name of type
Definition: typedescription.h:55
void *(* uno_QueryInterfaceFunc)(void *pInterface, struct _typelib_TypeDescriptionReference *pType)
Generic function pointer declaration to query for an interface.
Definition: data.h:40
struct _typelib_TypeDescription * pType
pointer to full typedescription; this value is only valid if the type is never swapped out ...
Definition: typedescription.h:58
struct _typelib_TypeDescriptionReference * pType
type of value
Definition: any2.h:44
type class of unsigned short
Definition: typeclass.h:39
sal_Bool operator!=(const Any &rAny) const
Unequality operator: compares two anys.
Definition: Any.hxx:167
definition of a no acquire enum for ctors
Definition: types.h:374
CPPU_DLLPUBLIC void uno_any_destruct(uno_Any *pValue, uno_ReleaseFunc release) SAL_THROW_EXTERN_C()
Destructs an any.
Full type description of a type.
Definition: typedescription.h:71
CPPU_DLLPUBLIC sal_Bool uno_type_equalData(void *pVal1, struct _typelib_TypeDescriptionReference *pVal1Type, void *pVal2, struct _typelib_TypeDescriptionReference *pVal2Type, uno_QueryInterfaceFunc queryInterface, uno_ReleaseFunc release) SAL_THROW_EXTERN_C()
Tests if two values are equal.
type class of unsigned hyper
Definition: typeclass.h:47
CPPU_DLLPUBLIC void uno_type_any_construct(uno_Any *pDest, void *pSource, struct _typelib_TypeDescriptionReference *pType, uno_AcquireFunc acquire) SAL_THROW_EXTERN_C()
Constructs an any with a given value.
CPPU_DLLPUBLIC sal_Bool uno_type_isAssignableFromData(struct _typelib_TypeDescriptionReference *pAssignable, void *pFrom, struct _typelib_TypeDescriptionReference *pFromType, uno_QueryInterfaceFunc queryInterface, uno_ReleaseFunc release) SAL_THROW_EXTERN_C()
Tests whether a value of given type is assignable from given value.
void operator<<=(Any &rAny, const C &value)
Template binary <<= operator to set the value of an any.
Definition: Any.hxx:201
CPPU_DLLPUBLIC sal_Bool uno_type_assignData(void *pDest, struct _typelib_TypeDescriptionReference *pDestType, void *pSource, struct _typelib_TypeDescriptionReference *pSourceType, uno_QueryInterfaceFunc queryInterface, uno_AcquireFunc acquire, uno_ReleaseFunc release) SAL_THROW_EXTERN_C()
Assigns a destination value with a source value.
sal_Bool operator>>=(const Any &rAny, C &value)
Template binary >>= operator to assign a value from an any.
Definition: Any.hxx:235
inline::rtl::OUString getValueTypeName() const
Gets the type name of the set value.
Definition: Any.hxx:104
const ::com::sun::star::uno::Type & getCppuBooleanType()
Gets the meta type of IDL type boolean.
Definition: Type.hxx:111
Template reference class for interface type derived from BaseReference.
Definition: unotype.hxx:32
type class of double
Definition: typeclass.h:51
type class of string
Definition: typeclass.h:53
type class of long
Definition: typeclass.h:41
C++ class representing an IDL any.
Definition: Any.h:46
T get() const
Provides a value of specified type, so you can easily write e.g.
Definition: Any.hxx:570
type class of unsigned long
Definition: typeclass.h:43
CPPU_DLLPUBLIC void uno_type_any_assign(uno_Any *pDest, void *pSource, struct _typelib_TypeDescriptionReference *pType, uno_AcquireFunc acquire, uno_ReleaseFunc release) SAL_THROW_EXTERN_C()
Assign an any with a given value.
rtl_uString * cppu_Any_extraction_failure_msg(uno_Any const *pAny, typelib_TypeDescriptionReference *pType) SAL_THROW_EXTERN_C()
type class of short
Definition: typeclass.h:37
unsigned char sal_Bool
Definition: types.h:37
This is the binary specification of an UNO any.
Definition: any2.h:40
sal_Bool operator==(const Any &rAny, const C &value)
Template equality operator: compares set value of left side any to right side value.
Definition: Any.hxx:547
Any makeAny(const C &value)
Template function to generically construct an any from a C++ value.
Definition: Any.hxx:176
void setValue(const void *pData_, const Type &rType)
Sets a value.
Definition: Any.hxx:109
~Any()
Destructor: Destructs any content and frees memory.
Definition: Any.hxx:87
signed char sal_Int8
Definition: types.h:42
#define sal_False
Definition: types.h:38
type class of boolean
Definition: typeclass.h:33
sal_Bool operator==(const Any &rAny) const
Equality operator: compares two anys.
Definition: Any.hxx:160
type class of float
Definition: typeclass.h:49
void * cpp_queryInterface(void *pCppI, typelib_TypeDescriptionReference *pType)
Function to query for a C++ interface.
Definition: genfunc.hxx:48
typelib_TypeDescriptionReference * getTypeLibType() const
Gets the C typelib type description reference pointer.
Definition: Type.h:155
void(* uno_AcquireFunc)(void *pInterface)
Generic function pointer declaration to acquire an interface.
Definition: data.h:46
type class of hyper
Definition: typeclass.h:45
type class of interface
Definition: typeclass.h:73