Class WxAny is based on the "any" class described in "Valued
Conversion", Kevlin Henney, C++ Report, July-August 2000, pages 37–40.
More...
#include <wxany.h>
Class WxAny is based on the "any" class described in "Valued
Conversion", Kevlin Henney, C++ Report, July-August 2000, pages 37–40.
WxAny should be used for objects with simple types which support a copy ctor.
Example usage is:
WxAny any(22); // store integer 22 cout << any.to_value<int>() << endl; // prints 22
any = WxAny(string("Hello World") ); // store string cout << any.to_value<string>() << endl; // prints "Hello World"
|
| | WxAny () |
| | Create empty object.
|
| |
| template<typename VALUETYPE > |
| | WxAny (const VALUETYPE &value) |
| | Create new WxAny from an object of a given type.
|
| |
| | WxAny (const WxAny &other) |
| | Copy ctor.
|
| |
| | WxAny (WxAny &&other) noexcept |
| | move ctor
|
| |
| | ~WxAny () |
| |
| WxAny & | swap (WxAny &rhs) |
| | Swap contents of object with contents of supplied object.
|
| |
| WxAny & | operator= (const WxAny &rhs) |
| | Assignment operator: use WxAny object to create a new object.
|
| |
| WxAny & | operator= (WxAny &&rhs) noexcept |
| |
| template<typename VALUETYPE > |
| WxAny & | operator= (const VALUETYPE &rhs) |
| | Assignment operator: use VALUETYPE object to create a new object.
|
| |
| bool | empty () const |
| | Is object empty?
|
| |
| const std::type_info & | type () const |
| | Type_info for this object's held value.
|
| |
| int | payloadSizeInBytes () const |
| | Size in bytes for this object's held value.
|
| |
| template<typename VALUETYPE > |
| const VALUETYPE * | to_ptr () const |
| | Convert the held object to a pointer.
|
| |
| const void * | to_void_ptr () const |
| | Convert held object to a const void *.
|
| |
| void * | to_void_ptr () |
| | Convert held object to a void *.
|
| |
| template<typename VALUETYPE > |
| VALUETYPE | to_value () const |
| | Extract the data from the WxAny object.
|
| |
◆ WxAny() [1/4]
◆ WxAny() [2/4]
template<typename VALUETYPE >
| WxAny::WxAny |
( |
const VALUETYPE & |
value | ) |
|
|
inline |
Create new WxAny from an object of a given type.
- Parameters
-
| value | Value of object stored. |
◆ WxAny() [3/4]
| WxAny::WxAny |
( |
const WxAny & |
other | ) |
|
|
inline |
◆ WxAny() [4/4]
| WxAny::WxAny |
( |
WxAny && |
other | ) |
|
|
inlinenoexcept |
◆ ~WxAny()
◆ empty()
| bool WxAny::empty |
( |
| ) |
const |
|
inline |
◆ operator=() [1/3]
template<typename VALUETYPE >
| WxAny & WxAny::operator= |
( |
const VALUETYPE & |
rhs | ) |
|
|
inline |
Assignment operator: use VALUETYPE object to create a new object.
◆ operator=() [2/3]
Assignment operator: use WxAny object to create a new object.
- Parameters
-
◆ operator=() [3/3]
◆ payloadSizeInBytes()
| int WxAny::payloadSizeInBytes |
( |
| ) |
const |
|
inline |
Size in bytes for this object's held value.
Returns size of stored type in bytes or -1 if no payload.
◆ swap()
Swap contents of object with contents of supplied object.
- Parameters
-
| rhs | Replace the value in this WxAny with 'rhs' |
◆ to_ptr()
template<typename VALUETYPE >
| const VALUETYPE * WxAny::to_ptr |
( |
| ) |
const |
|
inline |
Convert the held object to a pointer.
Do not use this function directly without checking if the returned pointer is not NULL.
◆ to_value()
template<typename VALUETYPE >
| VALUETYPE WxAny::to_value |
( |
| ) |
const |
|
inline |
Extract the data from the WxAny object.
If the type specified by the template 'VALUETYPE' is not the correct type of the object stored a std::bad_cast exception is thrown.
◆ to_void_ptr() [1/2]
| void * WxAny::to_void_ptr |
( |
| ) |
|
|
inline |
Convert held object to a void *.
This is not a safe operation as it breaks typechecking.
◆ to_void_ptr() [2/2]
| const void * WxAny::to_void_ptr |
( |
| ) |
const |
|
inline |
Convert held object to a const void *.
This is not a safe operation as it breaks typechecking.
◆ type()
| const std::type_info & WxAny::type |
( |
| ) |
const |
|
inline |
Type_info for this object's held value.
The documentation for this class was generated from the following file: