|
CoreComponents 3.0.0
A Modern C++ Toolkit
|
Duck-typed value. More...
#include <cc/Variant>
Public Member Functions | |
| Variant () | |
| Create a variant without an value. | |
| template<class T > | |
| Variant (T value) | |
| Create a variant with value. | |
| Variant (int value) | |
| Convenience function for calling Variant(long) | |
| Variant (float value) | |
| Convenience function for calling Variant(double) | |
| Variant (const char *value) | |
| Convenience function for calling Variant(const String &) | |
| Variant (std::initializer_list< const char * > values) | |
| Create a variant storing a list of strings. | |
| Variant (std::initializer_list< int > values) | |
| Create a variant storing a list of longs. | |
| Variant (std::initializer_list< long > values) | |
| Create a variant storing a list of longs. | |
| Variant (std::initializer_list< double > values) | |
| Create a variant storing a list of doubles. | |
| Variant (const Variant &b) | |
| Copy-constructor. | |
| Variant (Variant &&b) | |
| R-value constructor. | |
| Variant & | operator= (const Variant &b) |
| Assignment operator. | |
| Variant & | operator= (Variant &&b) |
| R-value assignment operator. | |
| template<class T > | |
| bool | is () const |
| Check if stored value is of type T. | |
| template<class T > | |
| T | to () const |
| Retrieve stored value of type T. | |
| template<class T > | |
| operator T () const | |
| Retrieve stored value of type T. | |
| operator String () const | |
| Stringify this variant. | |
| bool | sameTypeAs (const Variant &b) const |
| Check if this variant is of the same type as variant b. | |
| const char * | typeName () const |
| Get the type name of the store value. | |
| Variant | operator() (const String &key) const |
| Convenience method to get the value of a member of this meta-object value. | |
| Variant & | operator() (const String &key) |
| Convenience method to get/set the value of a member of this meta-object value. | |
| Variant | operator[] (long index) const |
| Convenience method to get the child at index of this meta-object value. | |
| long | count () const |
| Convenience method to get the number of children of this meta-object value. | |
| bool | operator== (const Variant &other) const |
| Compare for equality with b. | |
| bool | operator== (const char *other) const |
| Compare for equality with b. | |
| std::strong_ordering | operator<=> (const Variant &other) const |
| Ordering operator. | |
Static Public Member Functions | |
| static Variant | read (const String &s) |
| Automatically sense type and read value from string s. | |
Duck-typed value.
provide iterator for child iteration
introduce VariantTypeMismatch debug exception
| Variant | ( | ) |
Create a variant without an value.
| Variant | ( | T | value | ) |
Create a variant with value.
| Variant | ( | int | value | ) |
Convenience function for calling Variant(long)
| Variant | ( | float | value | ) |
Convenience function for calling Variant(double)
| Variant | ( | const char * | value | ) |
Convenience function for calling Variant(const String &)
| Variant | ( | std::initializer_list< const char * > | values | ) |
Create a variant storing a list of strings.
| Variant | ( | std::initializer_list< int > | values | ) |
Create a variant storing a list of longs.
| Variant | ( | std::initializer_list< long > | values | ) |
Create a variant storing a list of longs.
| Variant | ( | std::initializer_list< double > | values | ) |
Create a variant storing a list of doubles.
| bool is | ( | ) | const |
Check if stored value is of type T.
| T to | ( | ) | const |
Retrieve stored value of type T.
|
explicit |
Retrieve stored value of type T.
| operator String | ( | ) | const |
Stringify this variant.
| bool sameTypeAs | ( | const Variant & | b | ) | const |
Check if this variant is of the same type as variant b.
| const char * typeName | ( | ) | const |
Get the type name of the store value.
Convenience method to get the value of a member of this meta-object value.
Convenience method to get/set the value of a member of this meta-object value.
| Variant operator[] | ( | long | index | ) | const |
Convenience method to get the child at index of this meta-object value.
| long count | ( | ) | const |
Convenience method to get the number of children of this meta-object value.
| bool operator== | ( | const Variant & | other | ) | const |
Compare for equality with b.
| bool operator== | ( | const char * | other | ) | const |
Compare for equality with b.
| std::strong_ordering operator<=> | ( | const Variant & | other | ) | const |
Ordering operator.