23#ifndef INCLUDED_COM_SUN_STAR_UNO_ANY_HXX
24#define INCLUDED_COM_SUN_STAR_UNO_ANY_HXX
41#include "com/sun/star/uno/RuntimeException.hpp"
69 this,
const_cast<T *
>(&value),
82#if defined LIBO_INTERNAL_ONLY
83template<
typename T1,
typename T2>
87template<std::
size_t nBufSize>
89template <std::
size_t N>
101 this,
const_cast< void *
>(
pData_ ),
rType.getTypeLibType(),
134#if defined LIBO_INTERNAL_ONLY
138 std::swap(
other.pType, pType);
139 std::swap(
other.pData, pData);
140 std::swap(
other.pReserved, pReserved);
141 if (pData == &
other.pReserved) {
151 std::swap(other.pType, pType);
152 std::swap(other.pData, pData);
153 std::swap(other.pReserved, pReserved);
154 if (pData == &other.pReserved) {
157 if (other.pData == &pReserved) {
158 other.pData = &other.pReserved;
167 return ::rtl::OUString( pType->pTypeName );
173 this,
const_cast< void *
>(
pData_ ),
rType.getTypeLibType(),
199 return ::uno_type_isAssignableFromData(
200 rType.getTypeLibType(), pData, pType,
209 return ::uno_type_isAssignableFromData(
210 rType.getTypeLibType(), pData, pType,
215#if defined LIBO_INTERNAL_ONLY
216template<>
bool Any::has<Any>()
const =
delete;
221 return ::uno_type_equalData(
222 pData, pType,
rAny.pData,
rAny.pType,
229 pData, pType,
rAny.pData,
rAny.pType,
234#if !defined LIBO_INTERNAL_ONLY
251#if defined LIBO_INTERNAL_ONLY
253inline Any
toAny(Any&& value) {
return std::move(value); }
255template<
typename T1,
typename T2>
257{
return Any(std::move(value)); }
259template<std::
size_t nBufSize>
261{
return Any(std::move(value)); }
263template<
typename T>
bool fromAny(Any
const & any, T * value) {
264 assert(value !=
nullptr);
265 return any >>= *value;
268template<>
bool fromAny(Any
const & any, Any * value) {
269 assert(value !=
nullptr);
281 &
rAny,
const_cast< C *
>( &value ),
rType.getTypeLibType(),
297#ifdef LIBO_INTERNAL_ONLY
298template<
class C1,
class C2 >
304 &rAny,
const_cast< rtl::OUString *
>( &str ), rType.getTypeLibType(),
307template<
typename T1,
typename T2>
309template< std::
size_t nBufSize >
315 &rAny,
const_cast< rtl::OUString *
>( &str ), rType.getTypeLibType(),
318template<std::
size_t nBufSize>
322#if defined LIBO_INTERNAL_ONLY
323template<>
void SAL_CALL
operator <<=(Any &, Any
const &) =
delete;
330 return ::uno_type_assignData(
331 &value,
rType.getTypeLibType(),
354 bool(value) ==
bool(*
static_cast< const sal_Bool *
>(
rAny.pData )));
385 value = *
static_cast< const sal_Int8 *
>(
rAny.pData );
395 switch (
rAny.pType->eTypeClass)
398 value = *
static_cast< const sal_Int8 *
>(
rAny.pData );
412 switch (
rAny.pType->eTypeClass)
430 switch (
rAny.pType->eTypeClass)
433 value = *
static_cast< const sal_Int8 *
>(
rAny.pData );
453 switch (
rAny.pType->eTypeClass)
477 switch (
rAny.pType->eTypeClass)
480 value = *
static_cast< const sal_Int8 *
>(
rAny.pData );
506 switch (
rAny.pType->eTypeClass)
536 switch (
rAny.pType->eTypeClass)
539 value = *
static_cast< const sal_Int8 *
>(
rAny.pData );
548 value = *
static_cast< const float *
>(
rAny.pData );
559 switch (
rAny.pType->eTypeClass)
562 value = *
static_cast< const sal_Int8 *
>(
rAny.pData );
577 value = *
static_cast< const float *
>(
rAny.pData );
580 value = *
static_cast< const double *
>(
rAny.pData );
606#if defined LIBO_INTERNAL_ONLY
607template<std::
size_t N>
620 value = *
static_cast< const Type *
>(
rAny.pData );
634#if defined LIBO_INTERNAL_ONLY
635template<>
bool SAL_CALL
operator >>=(Any
const &, Any &) =
delete;
656 return static_cast< const BaseReference *
>(
rAny.pData )->
operator == ( value );
667 return ::uno_type_equalData(
669 const_cast< C *
>( &value ),
rType.getTypeLibType(),
677 return (!
operator == (
rAny, value ));
684 if (! (*
this >>= value)) {
695#if defined LIBO_INTERNAL_ONLY
705template<
typename charT,
typename traits>
706inline std::basic_ostream<charT, traits> &
operator<<(std::basic_ostream<charT, traits> &
o,
Any const &
any) {
707 o <<
"<Any: (" <<
any.getValueTypeName() <<
')';
708 switch(
any.pType->eTypeClass) {
730 std::ios_base::fmtflags
flgs =
o.setf(
731 std::ios_base::hex, std::ios_base::basefield);
733 o <<
" U+" << std::setw(4)
743 o <<
' ' << any.
get<css::uno::Type>().getTypeName();
751 o << ' ' << *static_cast<sal_Int32 const *>(any.
getValue());
758 o << ' ' << *static_cast<void * const *>(any.
getValue());
@ SAL_NO_ACQUIRE
definition of a no acquire enum for ctors
Definition types.h:356
unsigned char sal_Bool
Definition types.h:38
#define SAL_THROW_EXTERN_C()
Nothrow specification for C functions.
Definition types.h:334
sal_uInt16 sal_Unicode
Definition types.h:123
signed char sal_Int8
Definition types.h:43
@ typelib_TypeClass_VOID
type class of void
Definition typeclass.h:32
@ typelib_TypeClass_UNSIGNED_SHORT
type class of unsigned short
Definition typeclass.h:42
@ typelib_TypeClass_STRUCT
type class of struct
Definition typeclass.h:66
@ typelib_TypeClass_CHAR
type class of char
Definition typeclass.h:34
@ typelib_TypeClass_HYPER
type class of hyper
Definition typeclass.h:48
@ typelib_TypeClass_BYTE
type class of byte
Definition typeclass.h:38
@ typelib_TypeClass_BOOLEAN
type class of boolean
Definition typeclass.h:36
@ typelib_TypeClass_INTERFACE
type class of interface
Definition typeclass.h:82
@ typelib_TypeClass_STRING
type class of string
Definition typeclass.h:56
@ typelib_TypeClass_SHORT
type class of short
Definition typeclass.h:40
@ typelib_TypeClass_FLOAT
type class of float
Definition typeclass.h:52
@ typelib_TypeClass_DOUBLE
type class of double
Definition typeclass.h:54
@ typelib_TypeClass_TYPE
type class of type
Definition typeclass.h:58
@ typelib_TypeClass_UNSIGNED_HYPER
type class of unsigned hyper
Definition typeclass.h:50
@ typelib_TypeClass_SEQUENCE
type class of sequence
Definition typeclass.h:75
@ typelib_TypeClass_LONG
type class of long
Definition typeclass.h:44
@ typelib_TypeClass_ENUM
type class of enum
Definition typeclass.h:62
@ typelib_TypeClass_UNSIGNED_LONG
type class of unsigned long
Definition typeclass.h:46
@ typelib_TypeClass_EXCEPTION
type class of exception
Definition typeclass.h:73
struct SAL_DLLPUBLIC_RTTI _typelib_TypeDescription typelib_TypeDescription
Full type description of a type.
struct SAL_DLLPUBLIC_RTTI _typelib_TypeDescriptionReference typelib_TypeDescriptionReference
Holds a weak reference to a type description.
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.
CPPU_DLLPUBLIC void uno_any_destruct(uno_Any *pValue, uno_ReleaseFunc release) SAL_THROW_EXTERN_C()
Destructs an any.
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.
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.
struct SAL_DLLPUBLIC_RTTI _uno_Any uno_Any
This is the binary specification of a UNO any.
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.
CPPU_DLLPUBLIC void uno_any_clear(uno_Any *pValue, uno_ReleaseFunc release) SAL_THROW_EXTERN_C()
Sets value to void.
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.
#define CPPU_DLLPUBLIC
Definition cppudllapi.h:13
CPPU_DLLPUBLIC rtl_uString * cppu_Any_extraction_failure_msg(uno_Any const *pAny, typelib_TypeDescriptionReference *pType) SAL_THROW_EXTERN_C()
Definition bootstrap.hxx:34
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:664
std::basic_ostream< charT, traits > & operator<<(std::basic_ostream< charT, traits > &o, Any const &any)
Support for Any in std::ostream (and thus in CPPUNIT_ASSERT or SAL_INFO macros, for example).
Definition Any.hxx:706
Any makeAny(const C &value)
Template function to generically construct an any from a C++ value.
Definition Any.hxx:236
bool operator!=(const Any &rAny, const C &value)
Template inequality operator: compares set value of left side any to right side value.
Definition Any.hxx:675
bool operator>>=(const Any &rAny, C &value)
Template binary >>= operator to assign a value from an any.
Definition Any.hxx:327
void cpp_release(void *pCppI)
Function to release a C++ interface.
Definition genfunc.hxx:50
void * cpp_queryInterface(void *pCppI, typelib_TypeDescriptionReference *pType)
Function to query for a C++ interface.
Definition genfunc.hxx:55
void cpp_acquire(void *pCppI)
Function to acquire a C++ interface.
Definition genfunc.hxx:45
Any toAny(T const &value)
Wrap a value in an Any, if necessary.
Definition Any.hxx:245
void operator<<=(Any &rAny, const C &value)
Template binary <<= operator to set the value of an any.
Definition Any.hxx:277
css::uno::Type const & getTypeFavourUnsigned(SAL_UNUSED_PARAMETER T const *)
A working replacement for getCppuType (see there).
Definition unotype.hxx:324
This is the binary specification of a SAL sequence.
Definition types.h:304
Template reference class for reference type.
Definition ref.hxx:46
This String class provides base functionality for C++ like Unicode character array handling.
Definition ustring.hxx:206
Template reference class for interface type derived from BaseReference.
Definition Reference.h:184
interface_type * get() const
Gets interface pointer.
Definition Reference.h:403
Get the css::uno::Type instance representing a certain UNO type.
Definition unotype.hxx:290
C++ class representing an IDL any.
Definition Any.h:58
bool has() const
Tests whether this any can provide a value of specified type.
Definition Any.hxx:206
T get() const
Provides a value of specified type, so you can easily write e.g.
Definition Any.hxx:681
bool operator!=(const Any &rAny) const
Inequality operator: compares two anys.
Definition Any.hxx:226
Any & operator=(const Any &rAny)
Assignment operator: Sets the value of the given any.
Definition Any.hxx:123
inline ::rtl::OUString getValueTypeName() const
Gets the type name of the set value.
Definition Any.hxx:165
bool operator==(const Any &rAny) const
Equality operator: compares two anys.
Definition Any.hxx:219
void setValue(const void *pData_, const Type &rType)
Sets a value.
Definition Any.hxx:170
bool isExtractableTo(const Type &rType) const
Tests whether this any is extractable to a value of given type.
Definition Any.hxx:197
const void * getValue() const
Gets a pointer to the set value.
Definition Any.h:198
~Any()
Destructor: Destructs any content and frees memory.
Definition Any.hxx:117
void clear()
Clears this any.
Definition Any.hxx:191
Any()
Default constructor: Any holds no value; its type is void.
Definition Any.hxx:59
This base class serves as a base class for all template reference classes and has been introduced due...
Definition Reference.h:67
C++ class representing an IDL meta type.
Definition Type.h:59
bool equals(const Type &rType) const
Compares two types.
Definition Type.h:181