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"
66#if defined LIBO_INTERNAL_ONLY && !(defined _MSC_VER && _MSC_VER <= 1929 && defined _MANAGED)
70 requires(!std::is_base_of_v<XInterface, T>)
75 this,
const_cast<T *
>(&
value),
88#if defined LIBO_INTERNAL_ONLY
89template<
typename T1,
typename T2>
93template<std::
size_t nBufSize>
95template <std::
size_t N>
107 this,
const_cast< void *
>(
pData_ ),
rType.getTypeLibType(),
138#if defined LIBO_INTERNAL_ONLY
140#if !defined(__COVERITY__)
143 std::swap(
other.pType, pType);
144 std::swap(
other.pData, pData);
145 std::swap(
other.pReserved, pReserved);
146 if (pData == &
other.pReserved) {
157 std::swap(other.pType, pType);
158 std::swap(other.pData, pData);
159 std::swap(other.pReserved, pReserved);
160 if (pData == &other.pReserved) {
163 if (other.pData == &pReserved) {
164 other.pData = &other.pReserved;
173 return ::rtl::OUString( pType->pTypeName );
203 return ::uno_type_isAssignableFromData(
204 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,
228 return (!
operator==(
rAny));
232#if !defined LIBO_INTERNAL_ONLY
249#if defined LIBO_INTERNAL_ONLY
251inline Any
toAny(Any&& value) {
return std::move(value); }
253template<
typename T1,
typename T2>
255{
return Any(std::move(value)); }
257template<std::
size_t nBufSize>
259{
return Any(std::move(value)); }
261template<
typename T>
bool fromAny(Any
const & any, T * value) {
262 assert(value !=
nullptr);
263 return any >>= *value;
266template<>
bool fromAny(Any
const & any, Any * value) {
267 assert(value !=
nullptr);
291#ifdef LIBO_INTERNAL_ONLY
292template<
class C1,
class C2 >
297template<
typename T1,
typename T2>
299template< std::
size_t nBufSize >
304template<std::
size_t nBufSize>
308#if defined LIBO_INTERNAL_ONLY
309template<>
void SAL_CALL
operator <<=(Any &, Any
const &) =
delete;
316 return ::uno_type_assignData(
380 switch (
rAny.pType->eTypeClass)
397 switch (
rAny.pType->eTypeClass)
415 switch (
rAny.pType->eTypeClass)
438 switch (
rAny.pType->eTypeClass)
462 switch (
rAny.pType->eTypeClass)
491 switch (
rAny.pType->eTypeClass)
521 switch (
rAny.pType->eTypeClass)
533 value = *
static_cast< const float *
>(
rAny.pData );
544 switch (
rAny.pType->eTypeClass)
562 value = *
static_cast< const float *
>(
rAny.pData );
565 value = *
static_cast< const double *
>(
rAny.pData );
591#if defined LIBO_INTERNAL_ONLY
592template<std::
size_t N>
615 value.equals( *
static_cast< const Type *
>(
rAny.pData ) ));
619#if defined LIBO_INTERNAL_ONLY
620template<>
bool SAL_CALL
operator >>=(Any
const &, Any &) =
delete;
652 return ::uno_type_equalData(
654 const_cast< C *
>( &
value ),
rType.getTypeLibType(),
669 if (! (*
this >>=
value)) {
680#if defined LIBO_INTERNAL_ONLY
690template<
typename charT,
typename traits>
691inline std::basic_ostream<charT, traits> &
operator<<(std::basic_ostream<charT, traits> &
o,
Any const &
any) {
692 o <<
"<Any: (" <<
any.getValueTypeName() <<
')';
693 switch(
any.pType->eTypeClass) {
715 std::ios_base::fmtflags
flgs =
o.setf(
716 std::ios_base::hex, std::ios_base::basefield);
718 o <<
" U+" << std::setw(4)
728 o <<
' ' << any.
get<css::uno::Type>().getTypeName();
736 o << ' ' << *static_cast<sal_Int32 const *>(any.
getValue());
743 o << ' ' << *static_cast<void * const *>(any.
getValue());
@ SAL_NO_ACQUIRE
definition of a no acquire enum for ctors
Definition types.h:374
unsigned char sal_Bool
Definition types.h:38
#define SAL_THROW_EXTERN_C()
Nothrow specification for C functions.
Definition types.h:352
sal_uInt16 sal_Unicode
Definition types.h:123
signed char sal_Int8
Definition types.h:43
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.
@ 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
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:649
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:691
Any makeAny(const C &value)
Template function to generically construct an any from a C++ value.
Definition Any.hxx:234
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:660
bool operator>>=(const Any &rAny, C &value)
Template binary >>= operator to assign a value from an any.
Definition Any.hxx:313
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:243
void operator<<=(Any &rAny, const C &value)
Template binary <<= operator to set the value of an any.
Definition Any.hxx:275
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:322
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:172
Template reference class for interface type derived from BaseReference.
Definition Reference.h:184
interface_type * get() const
Gets interface pointer.
Definition Reference.h:405
Get the css::uno::Type instance representing a certain UNO type.
Definition unotype.hxx:290
C++ class representing an IDL any.
Definition Any.h:62
bool has() const
Tests whether this any can provide a value of specified type.
Definition Any.hxx:210
T get() const
Provides a value of specified type, so you can easily write e.g.
Definition Any.hxx:666
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:129
inline ::rtl::OUString getValueTypeName() const
Gets the type name of the set value.
Definition Any.hxx:171
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:176
bool isExtractableTo(const Type &rType) const
Tests whether this any is extractable to a value of given type.
Definition Any.hxx:201
const void * getValue() const
Gets a pointer to the set value.
Definition Any.h:210
~Any()
Destructor: Destructs any content and frees memory.
Definition Any.hxx:123
void clear()
Clears this any.
Definition Any.hxx:195
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