The Variant class acts like a union for the most common data types. More...
Public Types | |
enum | DataType { INVALID, INT, UINT, DOUBLE, FLOAT, BOOL, VEC3D, COLOR3F, STRING, ARRAY } |
List of variant data types. More... | |
Public Member Functions | |
Variant () | |
Creates an empty Variant. More... | |
Variant (const Variant &other) | |
Creates a Variant as a copy of another Variant. More... | |
Variant (int val) | |
Creates a Variant with the int value val. More... | |
Variant (unsigned int val) | |
Creates a Variant with the unsigned int value val. More... | |
Variant (double val) | |
Creates a Variant with the double value val. More... | |
Variant (float val) | |
Creates a Variant with the float value val. More... | |
Variant (bool val) | |
Creates a Variant with the bool value val. More... | |
Variant (const Vec3d &val) | |
Creates a Variant with the Vec3d value val. More... | |
Variant (const Color3f &val) | |
Creates a Variant with the Color3f value val. More... | |
Variant (const Str &val) | |
Creates a Variant with the Str value val. More... | |
Variant (const char *val) | |
Creates a Variant with the const char pointer val. More... | |
Variant (const std::vector< Variant > &arr) | |
Creates a Variant from an array of Variant arr. More... | |
Variant & | operator= (const Variant &rhs) |
Assigns rhs to this and returns a reference to this Variant. More... | |
bool | operator== (const Variant &rhs) const |
Returns true if rhs is equal to this Variant; otherwise returns false. More... | |
bool | operator!= (const Variant &rhs) const |
Returns true if rhs is not equal to this Variant; otherwise returns false. More... | |
DataType | type () const |
Returns the data type of this Variant. More... | |
bool | isValid () const |
Returns true if this is a valid Variant. More... | |
int | getInt () const |
Returns the current value as an int. More... | |
unsigned int | getUInt () const |
Returns the current value as an unsigned int. More... | |
double | getDouble () const |
Returns the current value as a double. More... | |
float | getFloat () const |
Returns the current value as a float. More... | |
bool | getBool () const |
Returns the current value as a bool. More... | |
Vec3d | getVec3d () const |
Returns the current value as a Vec3d. More... | |
Color3f | getColor3f () const |
Returns the current value as a Color3f. More... | |
Str | getString () const |
Returns the current value as a string. More... | |
std::vector< Variant > | getArray () const |
Returns the array of variants. More... | |
The Variant class acts like a union for the most common data types.
A Variant object holds a single value of a single type() at a time. The methods named get*() (e.g., getInt(), getString()) are const.
List of variant data types.
Enumerator | |
---|---|
INVALID |
Invalid. |
INT |
Integer data type (int) |
UINT |
Unsigned integer data type (unsigned int) |
DOUBLE |
Double precision data type (double) |
FLOAT |
Floating point data type (float) |
BOOL |
Boolean data type (bool) |
VEC3D |
Vector data type (cee::Vec3d) |
COLOR3F |
Color data type (cee::Color3f) |
STRING |
String data type (cee::Str) |
ARRAY |
Array data type (std::vector) |
cee::Variant::Variant | ( | ) |
Creates an empty Variant.
cee::Variant::Variant | ( | const Variant & | other | ) |
Creates a Variant as a copy of another Variant.
cee::Variant::Variant | ( | int | val | ) |
Creates a Variant with the int value val.
cee::Variant::Variant | ( | unsigned int | val | ) |
Creates a Variant with the unsigned int value val.
cee::Variant::Variant | ( | double | val | ) |
Creates a Variant with the double value val.
cee::Variant::Variant | ( | float | val | ) |
Creates a Variant with the float value val.
cee::Variant::Variant | ( | bool | val | ) |
Creates a Variant with the bool value val.
cee::Variant::Variant | ( | const char * | val | ) |
Creates a Variant with the const char pointer val.
cee::Variant::Variant | ( | const std::vector< Variant > & | arr | ) |
Creates a Variant from an array of Variant arr.
std::vector< Variant > cee::Variant::getArray | ( | ) | const |
Returns the array of variants.
Assumes that the type of the Variant is ARRAY. No conversion is done.
bool cee::Variant::getBool | ( | ) | const |
Returns the current value as a bool.
Assumes that the type of the Variant is BOOL. No conversion is done.
cee::Color3f cee::Variant::getColor3f | ( | ) | const |
Returns the current value as a Color3f.
Assumes that the type of the Variant is COLOR3F. No conversion is done.
double cee::Variant::getDouble | ( | ) | const |
Returns the current value as a double.
Assumes that the type of the Variant is DOUBLE. No conversion is done.
float cee::Variant::getFloat | ( | ) | const |
Returns the current value as a float.
Assumes that the type of the Variant is FLOAT. No conversion is done.
int cee::Variant::getInt | ( | ) | const |
Returns the current value as an int.
Assumes that the type of the Variant is INT. No conversion is done.
Str cee::Variant::getString | ( | ) | const |
Returns the current value as a string.
Assumes that the type of the Variant is STRING. No conversion is done.
unsigned int cee::Variant::getUInt | ( | ) | const |
Returns the current value as an unsigned int.
Assumes that the type of the Variant is UINT. No conversion is done.
cee::Vec3d cee::Variant::getVec3d | ( | ) | const |
Returns the current value as a Vec3d.
Assumes that the type of the Variant is VEC3D. No conversion is done.
bool cee::Variant::isValid | ( | ) | const |
Returns true if this is a valid Variant.
bool cee::Variant::operator!= | ( | const Variant & | rhs | ) | const |
Returns true if rhs is not equal to this Variant; otherwise returns false.
Assigns rhs to this and returns a reference to this Variant.
bool cee::Variant::operator== | ( | const Variant & | rhs | ) | const |
Returns true if rhs is equal to this Variant; otherwise returns false.
Variant::DataType cee::Variant::type | ( | ) | const |
Returns the data type of this Variant.