Class Avogadro::Core::Variant#
-
class Variant#
The Variant class represents a union of data values.
Variant objects allow for the storage of and conversion between a variety of different data types.
Public Types
Public Functions
-
inline Variant()#
Creates a null variant.
-
inline ~Variant()#
Destroys the variant object.
-
inline bool isNull() const#
Returns
true
if the variant is null.
-
template<typename T>
inline T value() const# Returns the value of the variant in the type given by
T
.
-
inline void clear()#
Clears the variant’s data and sets the variant to null.
-
inline bool toBool() const#
Returns the value of the variant as a
bool
.
-
inline char toChar() const#
Returns the value of the variant as a
char
.
-
inline unsigned char toUChar() const#
Returns the value of the variant as an
unsigned
char
.
-
inline short toShort() const#
Returns the value of the variant as a
short
.
-
inline unsigned short toUShort() const#
Returns the value of the variant as an
unsigned
short
.
-
inline int toInt() const#
Returns the value of the variant as an
int
.
-
inline unsigned int toUInt() const#
Returns the value of the variant as an
unsigned
int
.
-
inline long toLong() const#
Returns the value of the variant as a
long
.
-
inline unsigned long toULong() const#
Returns the value of the variant as an
unsigned
long
.
-
inline float toFloat() const#
Returns the value of the variant as a
float
.
-
inline double toDouble() const#
Returns the value of the variant as a
double
.
-
inline Real toReal() const#
Returns the value of the variant as a
Real
.
-
inline void *toPointer() const#
Returns the value of the variant as a pointer.
-
inline std::string toString() const#
Returns the value of the variant as a string.
-
inline MatrixX toMatrix() const#
Returns the value of the variant as a MatrixX.
-
inline const MatrixX &toMatrixRef() const#
Returns a reference to the value of the variant as a MatrixX. This method will not perform any casting — if type() is not exactly MatrixX, the function will fail and return a reference to an empty MatrixX.
-
template<>
inline Variant(const char *v)#
-
template<>
inline Variant(const MatrixXf &v)#
-
template<>
inline bool setValue(bool v)#
-
template<>
inline bool setValue(char v)#
-
template<>
inline bool setValue(short v)#
-
template<>
inline bool setValue(int v)#
-
template<>
inline bool setValue(long v)#
-
template<>
inline bool setValue(float v)#
-
template<>
inline bool setValue(double v)#
-
template<>
inline bool setValue(std::string string)#
-
template<>
inline bool setValue(const char *string)#
-
template<>
inline bool setValue(void *pointer)#
-
template<>
inline bool setValue(MatrixX matrix)#
-
template<>
inline bool value() const#
-
inline Variant()#