LibreOffice
LibreOffice 24.2 SDK C/C++ API Reference
|
C++ class representing an IDL any. More...
#include <Any.h>
Public Member Functions | |
Any () | |
Default constructor: Any holds no value; its type is void. More... | |
template<typename T > | |
Any (T const &value) | |
Templated ctor. More... | |
Any (bool value) | |
Ctor support for C++ bool. More... | |
Any (const Any &rAny) | |
Copy constructor: Sets value of the given any. More... | |
Any (const void *pData_, const Type &rType) | |
Constructor: Sets a copy of the given data. More... | |
Any (const void *pData_, typelib_TypeDescription *pTypeDescr) | |
Constructor: Sets a copy of the given data. More... | |
Any (const void *pData_, typelib_TypeDescriptionReference *pType_) | |
Constructor: Sets a copy of the given data. More... | |
~Any () | |
Destructor: Destructs any content and frees memory. More... | |
Any & | operator= (const Any &rAny) |
Assignment operator: Sets the value of the given any. More... | |
const Type & | getValueType () const |
Gets the type of the set value. More... | |
typelib_TypeDescriptionReference * | getValueTypeRef () const |
Gets the type of the set value. More... | |
void | getValueTypeDescription (typelib_TypeDescription **ppTypeDescr) const |
Gets the type description of the set value. More... | |
TypeClass | getValueTypeClass () const |
Gets the type class of the set value. More... | |
inline ::rtl::OUString | getValueTypeName () const |
Gets the type name of the set value. More... | |
bool | hasValue () const |
Tests if any contains a value. More... | |
const void * | getValue () const |
Gets a pointer to the set value. More... | |
template<typename T > | |
T | get () const |
Provides a value of specified type, so you can easily write e.g. More... | |
void | setValue (const void *pData_, const Type &rType) |
Sets a value. More... | |
void | setValue (const void *pData_, typelib_TypeDescriptionReference *pType_) |
Sets a value. More... | |
void | setValue (const void *pData_, typelib_TypeDescription *pTypeDescr) |
Sets a value. More... | |
void | clear () |
Clears this any. More... | |
bool | isExtractableTo (const Type &rType) const |
Tests whether this any is extractable to a value of given type. More... | |
template<typename T > | |
bool | has () const |
Tests whether this any can provide a value of specified type. More... | |
bool | operator== (const Any &rAny) const |
Equality operator: compares two anys. More... | |
bool | operator!= (const Any &rAny) const |
Inequality operator: compares two anys. More... | |
C++ class representing an IDL any.
This class is used to transport any type defined in IDL. The class inherits from the binary C representation of uno_Any. You can insert a value by using the <<= operators. No any can hold an any. You can extract values from an any by using the >>= operators which return true if the any contains an assignable value (no data loss), e.g. the any contains a short and you >>= it into a long variable.
|
inline |
Default constructor: Any holds no value; its type is void.
|
inlineexplicit |
|
inlineexplicit |
Ctor support for C++ bool.
|
inline |
Copy constructor: Sets value of the given any.
rAny | another any |
|
inline |
Constructor: Sets a copy of the given data.
pData_ | value |
rType | type of value |
|
inline |
Constructor: Sets a copy of the given data.
pData_ | value |
pTypeDescr | type of value |
|
inline |
Constructor: Sets a copy of the given data.
pData_ | value |
pType_ | type of value |
|
inline |
Destructor: Destructs any content and frees memory.
|
inline |
Clears this any.
If the any already contains a value, that value will be destructed and its memory freed. After this has been called, the any does not contain a value.
|
inline |
Provides a value of specified type, so you can easily write e.g.
sal_Int32 myVal = myAny.get<sal_Int32>();
Widening conversion without data loss is taken into account. Throws a com::sun::star::uno::RuntimeException if the specified type cannot be provided.
com::sun::star::uno::RuntimeException | in case the specified type cannot be provided |
|
inline |
Gets a pointer to the set value.
|
inline |
Gets the type of the set value.
|
inline |
Gets the type class of the set value.
|
inline |
Gets the type description of the set value.
Provides ownership of the type description! Call an explicit typelib_typedescription_release() to release afterwards.
ppTypeDescr | a pointer to type description pointer |
|
inline |
Gets the type name of the set value.
|
inline |
Gets the type of the set value.
|
inline |
Tests whether this any can provide a value of specified type.
Widening conversion without data loss is taken into account.
|
inline |
Tests if any contains a value.
|
inline |
Tests whether this any is extractable to a value of given type.
Widening conversion without data loss is taken into account.
rType | destination type |
|
inline |
Inequality operator: compares two anys.
The values need not be of equal type, e.g. a short integer is compared to a long integer.
rAny | another any (right side) |
Assignment operator: Sets the value of the given any.
rAny | another any (right side) |
|
inline |
Equality operator: compares two anys.
The values need not be of equal type, e.g. a short integer is compared to a long integer.
rAny | another any (right side) |
|
inline |
Sets a value.
If the any already contains a value, that value will be destructed and its memory freed.
pData_ | pointer to value |
rType | type of value |
|
inline |
Sets a value.
If the any already contains a value, that value will be destructed and its memory freed.
pData_ | pointer to value |
pType_ | type of value |
|
inline |
Sets a value.
If the any already contains a value, that value will be destructed and its memory freed.
pData_ | pointer to value |
pTypeDescr | type description of value |