#include <wx/any.h>
The wxAny class represents a container for any type.
Its value can be changed at run time, possibly to a different type of value.
wxAny is a backwards-incompatible (but convertible) successor class for wxVariant, essentially doing the same thing in a more modern, template- based manner and with transparent support for any user data type.
Some pseudo-code'ish example of use with arbitrary user data:
When compared to wxVariant, there are various internal implementation differences as well. For instance, wxAny only allocates separate data object in heap for large objects (i.e. ones with size more than WX_ANY_VALUE_BUFFER_SIZE, which at the time of writing is 16 bytes).
Public Member Functions | |
wxAny () | |
Default constructor. | |
template<typename T > | |
wxAny (const T &value) | |
Constructs wxAny from data. | |
wxAny (const wxAny &any) | |
Constructs wxAny from another wxAny. | |
wxAny (const wxVariant &variant) | |
Constructs wxAny, converting value from wxVariant. | |
~wxAny () | |
Destructor. | |
template<typename T > | |
T | As () const |
This template function converts wxAny into given type. | |
template<typename T > | |
bool | CheckType () const |
Use this template function for checking if this wxAny holds a specific C++ data type. | |
template<typename T > | |
bool | GetAs (T *value) const |
Template function that retrieves and converts the value of this wxAny to the type that T* value is. | |
bool | GetAs (wxVariant *value) const |
Specialization of GetAs() that allows conversion of wxAny into wxVariant. | |
const wxAnyValueType * | GetType () const |
Returns the value type as wxAnyValueType instance. | |
bool | HasSameType (const wxAny &other) const |
Returns true if this and another wxAny have the same value type. | |
bool | IsNull () const |
Tests if wxAny is null (that is, whether there is no data). | |
void | MakeNull () |
Makes wxAny null (that is, clears it). | |
Assignment operators | |
template<typename T > | |
wxAny & | operator= (const T &value) |
wxAny & | operator= (const wxAny &any) |
wxAny & | operator= (const wxVariant &variant) |
Equality operators | |
bool | operator== (signed char value) const |
bool | operator== (signed short value) const |
bool | operator== (signed int value) const |
bool | operator== (signed long value) const |
bool | operator== (wxLongLong_t value) const |
bool | operator== (unsigned char value) const |
bool | operator== (unsigned short value) const |
bool | operator== (unsigned int value) const |
bool | operator== (unsigned long value) const |
bool | operator== (wxULongLong_t value) const |
bool | operator== (float value) const |
bool | operator== (double value) const |
bool | operator== (bool value) const |
bool | operator== (const char *value) const |
bool | operator== (const wchar_t *value) const |
bool | operator== (const wxString &value) const |
Inequality operators | |
bool | operator!= (signed char value) const |
bool | operator!= (signed short value) const |
bool | operator!= (signed int value) const |
bool | operator!= (signed long value) const |
bool | operator!= (wxLongLong_t value) const |
bool | operator!= (unsigned char value) const |
bool | operator!= (unsigned short value) const |
bool | operator!= (unsigned int value) const |
bool | operator!= (unsigned long value) const |
bool | operator!= (wxULongLong_t value) const |
bool | operator!= (float value) const |
bool | operator!= (double value) const |
bool | operator!= (bool value) const |
bool | operator!= (const char *value) const |
bool | operator!= (const wchar_t *value) const |
bool | operator!= (const wxString &value) const |
wxAny::wxAny | ( | ) |
Default constructor.
It seeds the object with a null value.
wxAny::wxAny | ( | const T & | value | ) |
Constructs wxAny from data.
wxAny::wxAny | ( | const wxVariant & | variant | ) |
wxAny::~wxAny | ( | ) |
Destructor.
T wxAny::As | ( | ) | const |
This template function converts wxAny into given type.
In most cases no type conversion is performed, so if the type is incorrect an assertion failure will occur.
bool wxAny::CheckType | ( | ) | const |
Use this template function for checking if this wxAny holds a specific C++ data type.
bool wxAny::GetAs | ( | T * | value | ) | const |
Template function that retrieves and converts the value of this wxAny to the type that T* value is.
bool wxAny::GetAs | ( | wxVariant * | value | ) | const |
const wxAnyValueType* wxAny::GetType | ( | ) | const |
Returns the value type as wxAnyValueType instance.
bool wxAny::HasSameType | ( | const wxAny & | other | ) | const |
Returns true if this and another wxAny have the same value type.
bool wxAny::IsNull | ( | ) | const |
Tests if wxAny is null (that is, whether there is no data).
void wxAny::MakeNull | ( | ) |
Makes wxAny null (that is, clears it).
bool wxAny::operator!= | ( | signed char | value | ) | const |
bool wxAny::operator!= | ( | signed short | value | ) | const |
bool wxAny::operator!= | ( | signed int | value | ) | const |
bool wxAny::operator!= | ( | signed long | value | ) | const |
bool wxAny::operator!= | ( | wxLongLong_t | value | ) | const |
bool wxAny::operator!= | ( | unsigned char | value | ) | const |
bool wxAny::operator!= | ( | unsigned short | value | ) | const |
bool wxAny::operator!= | ( | unsigned int | value | ) | const |
bool wxAny::operator!= | ( | unsigned long | value | ) | const |
bool wxAny::operator!= | ( | wxULongLong_t | value | ) | const |
bool wxAny::operator!= | ( | float | value | ) | const |
bool wxAny::operator!= | ( | double | value | ) | const |
bool wxAny::operator!= | ( | bool | value | ) | const |
bool wxAny::operator!= | ( | const char * | value | ) | const |
bool wxAny::operator!= | ( | const wchar_t * | value | ) | const |
bool wxAny::operator!= | ( | const wxString & | value | ) | const |
wxAny& wxAny::operator= | ( | const T & | value | ) |
bool wxAny::operator== | ( | signed char | value | ) | const |
bool wxAny::operator== | ( | signed short | value | ) | const |
bool wxAny::operator== | ( | signed int | value | ) | const |
bool wxAny::operator== | ( | signed long | value | ) | const |
bool wxAny::operator== | ( | wxLongLong_t | value | ) | const |
bool wxAny::operator== | ( | unsigned char | value | ) | const |
bool wxAny::operator== | ( | unsigned short | value | ) | const |
bool wxAny::operator== | ( | unsigned int | value | ) | const |
bool wxAny::operator== | ( | unsigned long | value | ) | const |
bool wxAny::operator== | ( | wxULongLong_t | value | ) | const |
bool wxAny::operator== | ( | float | value | ) | const |
bool wxAny::operator== | ( | double | value | ) | const |
bool wxAny::operator== | ( | bool | value | ) | const |
bool wxAny::operator== | ( | const char * | value | ) | const |
bool wxAny::operator== | ( | const wchar_t * | value | ) | const |
bool wxAny::operator== | ( | const wxString & | value | ) | const |