xlnt
|
Represents an object that can have variable type. More...
#include <variant.hpp>
Public Types | |
enum | type { vector, null, i4, lpstr, date, boolean } |
The possible types a variant can hold. More... | |
Public Member Functions | |
variant () | |
Default constructor. Creates a null-type variant. More... | |
variant (const std::string &value) | |
Creates a string-type variant with the given value. More... | |
variant (const char *value) | |
Creates a string-type variant with the given value. More... | |
variant (std::int32_t value) | |
Creates a i4-type variant with the given value. More... | |
variant (bool value) | |
Creates a bool-type variant with the given value. More... | |
variant (const datetime &value) | |
Creates a date-type variant with the given value. More... | |
variant (const std::initializer_list< std::int32_t > &value) | |
Creates a vector_i4-type variant with the given value. More... | |
variant (const std::vector< std::int32_t > &value) | |
Creates a vector_i4-type variant with the given value. More... | |
variant (const std::initializer_list< const char *> &value) | |
Creates a vector_string-type variant with the given value. More... | |
variant (const std::vector< const char *> &value) | |
Creates a vector_string-type variant with the given value. More... | |
variant (const std::initializer_list< std::string > &value) | |
Creates a vector_string-type variant with the given value. More... | |
variant (const std::vector< std::string > &value) | |
Creates a vector_string-type variant with the given value. More... | |
variant (const std::vector< variant > &value) | |
Creates a vector_variant-type variant with the given value. More... | |
bool | is (type t) const |
Returns true if this variant is of type t. More... | |
template<typename T > | |
T | get () const |
Returns the value of this variant as type T. An exception will be thrown if the types are not convertible. More... | |
type | value_type () const |
Returns the type of this variant. More... | |
bool | operator== (const variant &rhs) const |
template<> | |
bool | get () const |
template<> | |
std::int32_t | get () const |
template<> | |
std::string | get () const |
template<> | |
datetime | get () const |
template<> | |
std::vector< std::int32_t > | get () const |
template<> | |
std::vector< std::string > | get () const |
template<> | |
std::vector< variant > | get () const |
Represents an object that can have variable type.
|
strong |
The possible types a variant can hold.
xlnt::variant::variant | ( | ) |
Default constructor. Creates a null-type variant.
xlnt::variant::variant | ( | const std::string & | value | ) |
Creates a string-type variant with the given value.
xlnt::variant::variant | ( | const char * | value | ) |
Creates a string-type variant with the given value.
xlnt::variant::variant | ( | std::int32_t | value | ) |
Creates a i4-type variant with the given value.
xlnt::variant::variant | ( | bool | value | ) |
Creates a bool-type variant with the given value.
xlnt::variant::variant | ( | const datetime & | value | ) |
Creates a date-type variant with the given value.
xlnt::variant::variant | ( | const std::initializer_list< std::int32_t > & | value | ) |
Creates a vector_i4-type variant with the given value.
xlnt::variant::variant | ( | const std::vector< std::int32_t > & | value | ) |
Creates a vector_i4-type variant with the given value.
xlnt::variant::variant | ( | const std::initializer_list< const char *> & | value | ) |
Creates a vector_string-type variant with the given value.
xlnt::variant::variant | ( | const std::vector< const char *> & | value | ) |
Creates a vector_string-type variant with the given value.
xlnt::variant::variant | ( | const std::initializer_list< std::string > & | value | ) |
Creates a vector_string-type variant with the given value.
xlnt::variant::variant | ( | const std::vector< std::string > & | value | ) |
Creates a vector_string-type variant with the given value.
xlnt::variant::variant | ( | const std::vector< variant > & | value | ) |
Creates a vector_variant-type variant with the given value.
T xlnt::variant::get | ( | ) | const |
Returns the value of this variant as type T. An exception will be thrown if the types are not convertible.
bool xlnt::variant::is | ( | type | t | ) | const |
Returns true if this variant is of type t.
type xlnt::variant::value_type | ( | ) | const |
Returns the type of this variant.