19 #ifndef INCLUDED_COM_SUN_STAR_UNO_ANY_HXX 20 #define INCLUDED_COM_SUN_STAR_UNO_ANY_HXX 35 #include <com/sun/star/uno/RuntimeException.hpp> 63 this, const_cast<T *>(&value),
92 this, const_cast< void * >( pData_ ), pTypeDescr,
cpp_acquire );
98 this, const_cast< void * >( pData_ ), pType_,
cpp_acquire );
112 this, rAny.pData, rAny.pType,
120 return ::rtl::OUString( pType->pTypeName );
133 this, const_cast< void * >( pData_ ), pType_,
140 this, const_cast< void * >( pData_ ), pTypeDescr,
158 template <
typename T>
171 pData, pType, rAny.pData, rAny.pType,
178 pData, pType, rAny.pData, rAny.pType,
199 #ifdef LIBO_INTERNAL_ONLY // "RTL_FAST_STRING" 200 template<
class C1,
class C2 >
201 inline Any SAL_CALL
makeAny(
const rtl::OUStringConcat< C1, C2 >& value )
233 #ifdef LIBO_INTERNAL_ONLY // "RTL_FAST_STRING" 234 template<
class C1,
class C2 >
235 inline void SAL_CALL operator <<= ( Any & rAny, const rtl::OUStringConcat< C1, C2 >& value )
240 &rAny, const_cast< rtl::OUString * >( &str ), rType.
getTypeLibType(),
251 rAny.pData, rAny.pType,
273 (value !=
sal_False) == (* static_cast< const sal_Bool * >( rAny.pData ) !=
sal_False));
282 value = *
static_cast< sal_Bool const *
>(
295 (*static_cast< sal_Bool const * >( rAny.pData )
306 value = *
static_cast< const sal_Int8 *
>( rAny.pData );
316 switch (rAny.pType->eTypeClass)
319 value = *
static_cast< const sal_Int8 *
>( rAny.pData );
323 value = *
static_cast< const sal_Int16 *
>( rAny.pData );
333 switch (rAny.pType->eTypeClass)
336 value = (sal_uInt16)( * static_cast< const sal_Int8 * >( rAny.pData ) );
340 value = *
static_cast< const sal_uInt16 *
>( rAny.pData );
351 switch (rAny.pType->eTypeClass)
354 value = *
static_cast< const sal_Int8 *
>( rAny.pData );
357 value = *
static_cast< const sal_Int16 *
>( rAny.pData );
360 value = *
static_cast< const sal_uInt16 *
>( rAny.pData );
364 value = *
static_cast< const sal_Int32 *
>( rAny.pData );
374 switch (rAny.pType->eTypeClass)
377 value = (sal_uInt32)( * static_cast< const sal_Int8 * >( rAny.pData ) );
380 value = (sal_uInt32)( * static_cast< const sal_Int16 * >( rAny.pData ) );
383 value = *
static_cast< const sal_uInt16 *
>( rAny.pData );
387 value = *
static_cast< const sal_uInt32 *
>( rAny.pData );
398 switch (rAny.pType->eTypeClass)
401 value = *
static_cast< const sal_Int8 *
>( rAny.pData );
404 value = *
static_cast< const sal_Int16 *
>( rAny.pData );
407 value = *
static_cast< const sal_uInt16 *
>( rAny.pData );
410 value = *
static_cast< const sal_Int32 *
>( rAny.pData );
413 value = *
static_cast< const sal_uInt32 *
>( rAny.pData );
417 value = *
static_cast< const sal_Int64 *
>( rAny.pData );
427 switch (rAny.pType->eTypeClass)
430 value = (sal_uInt64)( * static_cast< const sal_Int8 * >( rAny.pData ) );
433 value = (sal_uInt64)( * static_cast< const sal_Int16 * >( rAny.pData ) );
436 value = *
static_cast< const sal_uInt16 *
>( rAny.pData );
439 value = (sal_uInt64)( * static_cast< const sal_Int32 * >( rAny.pData ) );
442 value = *
static_cast< const sal_uInt32 *
>( rAny.pData );
446 value = *
static_cast< const sal_uInt64 *
>( rAny.pData );
457 switch (rAny.pType->eTypeClass)
460 value = *
static_cast< const sal_Int8 *
>( rAny.pData );
463 value = *
static_cast< const sal_Int16 *
>( rAny.pData );
466 value = *
static_cast< const sal_uInt16 *
>( rAny.pData );
469 value = *
static_cast< const float *
>( rAny.pData );
480 switch (rAny.pType->eTypeClass)
483 value = *
static_cast< const sal_Int8 *
>( rAny.pData );
486 value = *
static_cast< const sal_Int16 *
>( rAny.pData );
489 value = *
static_cast< const sal_uInt16 *
>( rAny.pData );
492 value = *
static_cast< const sal_Int32 *
>( rAny.pData );
495 value = *
static_cast< const sal_uInt32 *
>( rAny.pData );
498 value = *
static_cast< const float *
>( rAny.pData );
501 value = *
static_cast< const double *
>( rAny.pData );
514 value = *
static_cast< const ::
rtl::OUString *
>( rAny.pData );
521 inline bool SAL_CALL
operator == (
const Any & rAny, const ::rtl::OUString & value )
524 value.equals( * static_cast< const ::rtl::OUString * >( rAny.pData ) ));
533 value = *
static_cast< const Type *
>( rAny.pData );
543 value.
equals( * static_cast< const Type * >( rAny.pData ) ));
553 &value, rAny.pData, rAny.pType,
565 return static_cast< const BaseReference *
>( rAny.pData )->
operator == ( value );
577 rAny.pData, rAny.pType,
586 return (!
operator == ( rAny, value ));
589 template <
typename T>
593 if (! (*
this >>= value)) {
594 throw RuntimeException(
610 template<
typename charT,
typename traits>
611 inline std::basic_ostream<charT, traits> &operator<<(std::basic_ostream<charT, traits> &o,
Any const &any) {
613 switch(any.pType->eTypeClass) {
617 o <<
' ' << any.get<
bool>();
623 o <<
' ' << any.get<sal_Int64>();
628 o <<
' ' << any.get<sal_uInt64>();
632 o <<
' ' << any.get<
double>();
635 std::ios_base::fmtflags flgs = o.setf(
636 std::ios_base::hex, std::ios_base::basefield);
637 charT fill = o.fill(
'0');
638 o <<
" U+" << std::setw(4)
639 << *
static_cast<sal_Unicode const *
>(any.getValue());
648 o <<
' ' << any.get<css::uno::Type>().
getTypeName();
652 << ((*
static_cast<uno_Sequence *
const *
>(any.getValue()))->
656 o << ' ' << *static_cast<sal_Int32 const *>(any.getValue());
660 o <<
' ' << any.getValue();
663 o << ' ' << *static_cast<void * const *>(any.getValue());
680 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ type class of double
Definition: typeclass.h:51
type class of unsigned long
Definition: typeclass.h:43
type class of short
Definition: typeclass.h:37
type class of unsigned hyper
Definition: typeclass.h:47
type class of unsigned short
Definition: typeclass.h:39
CPPU_DLLPUBLIC void uno_any_destruct(uno_Any *pValue, uno_ReleaseFunc release) SAL_THROW_EXTERN_C()
Destructs an any.
CPPU_DLLPUBLIC void uno_any_clear(uno_Any *pValue, uno_ReleaseFunc release) SAL_THROW_EXTERN_C()
Sets value to void.
inline::rtl::OUString getValueTypeName() const
Gets the type name of the set value.
Definition: Any.hxx:118
bool isExtractableTo(const Type &rType) const
Tests whether this any is extractable to a value of given type.
Definition: Any.hxx:150
void * cpp_queryInterface(void *pCppI, typelib_TypeDescriptionReference *pType)
Function to query for a C++ interface.
Definition: genfunc.hxx:51
void operator<<=(Any &rAny, const C &value)
Template binary <<= operator to set the value of an any.
Definition: Any.hxx:213
#define CPPU_DLLPUBLIC
Definition: cppudllapi.h:10
Any & operator=(const Any &rAny)
Assignment operator: Sets the value of the given any.
Definition: Any.hxx:107
type class of interface
Definition: typeclass.h:79
type class of sequence
Definition: typeclass.h:72
css::uno::Type const & getTypeFavourUnsigned(SAL_UNUSED_PARAMETER T const *)
A working replacement for getCppuType (see there).
Definition: unotype.hxx:320
C++ class representing an IDL any.
Definition: Any.h:49
type class of hyper
Definition: typeclass.h:45
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.
bool has() const
Tests whether this any can provide a value of specified type.
Definition: Any.hxx:159
~Any()
Destructor: Destructs any content and frees memory.
Definition: Any.hxx:101
bool operator==(const Any &rAny) const
Equality operator: compares two anys.
Definition: Any.hxx:168
struct SAL_DLLPUBLIC_RTTI _uno_Any uno_Any
This is the binary specification of an UNO any.
bool operator!=(const Any &rAny) const
Unequality operator: compares two anys.
Definition: Any.hxx:175
type class of long
Definition: typeclass.h:41
type class of string
Definition: typeclass.h:53
void cpp_release(void *pCppI)
Function to release a C++ interface.
Definition: genfunc.hxx:46
unsigned char sal_Bool
Definition: types.h:48
type class of type
Definition: typeclass.h:55
type class of char
Definition: typeclass.h:31
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.
typelib_TypeDescriptionReference * getTypeLibType() const
Gets the C typelib type description reference pointer.
Definition: Type.h:154
CPPU_DLLPUBLIC rtl_uString * cppu_Any_extraction_failure_msg(uno_Any const *pAny, typelib_TypeDescriptionReference *pType) SAL_THROW_EXTERN_C()
bool equals(const Type &rType) const
Compares two types.
Definition: Type.h:173
C++ class representing an IDL meta type.
Definition: Type.h:54
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.
struct SAL_DLLPUBLIC_RTTI _typelib_TypeDescription typelib_TypeDescription
Full type description of a type.
signed char sal_Int8
Definition: types.h:53
sal_uInt16 sal_Unicode
Definition: types.h:155
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.
#define sal_False
Definition: types.h:49
Any()
Default constructor: Any holds no value; its type is void.
Definition: Any.hxx:53
type class of boolean
Definition: typeclass.h:33
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 setValue(const void *pData_, const Type &rType)
Sets a value.
Definition: Any.hxx:123
This is the binary specification of a SAL sequence.
Definition: types.h:343
This String class provides base functionality for C++ like Unicode character array handling...
Definition: ustring.hxx:106
definition of a no acquire enum for ctors
Definition: types.h:386
type class of float
Definition: typeclass.h:49
rtl::OUString getTypeName(rtl::OUString const &rEnvDcp)
Get the OBI type part of an environment descriptor.
Definition: EnvDcp.hxx:38
void cpp_acquire(void *pCppI)
Function to acquire a C++ interface.
Definition: genfunc.hxx:41
Any makeAny(const C &value)
Template function to generically construct an any from a C++ value.
Definition: Any.hxx:184
struct SAL_DLLPUBLIC_RTTI _typelib_TypeDescriptionReference typelib_TypeDescriptionReference
Holds a weak reference to a type description.
#define SAL_THROW_EXTERN_C()
Nothrow specification for C functions.
Definition: types.h:368
This base class serves as a base class for all template reference classes and has been introduced due...
Definition: Reference.h:58
type class of struct
Definition: typeclass.h:63
Any toAny(T const &value)
Wrap a value in an Any, if necessary.
Definition: Any.hxx:208
T get() const
Provides a value of specified type, so you can easily write e.g.
Definition: Any.hxx:590
bool operator>>=(const Any &rAny, C &value)
Template binary >>= operator to assign a value from an any.
Definition: Any.hxx:246
Get the css::uno::Type instance representing a certain UNO type.
Definition: unotype.hxx:47
type class of enum
Definition: typeclass.h:59
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 void
Definition: typeclass.h:29
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.
type class of byte
Definition: typeclass.h:35
void clear()
Clears this any.
Definition: Any.hxx:144
type class of exception
Definition: typeclass.h:70