MeVisLab Toolbox Reference
|
The Variant class stores different data types. More...
#include <mlVariant.h>
Public Types | |
enum | Type { Invalid , Bool , String , Int , UInt , Int64 , UInt64 , Float , Double , Vec2 , Vec3 , Vec4 , Vec6 , Mat3 , Mat4 , FilePath , PngImageData , JpgImageData , TypeCount } |
Static Public Member Functions | |
template<> | |
void | writeValueAsText (std::ostream &out, const float &value) |
template<> | |
void | writeValueAsText (std::ostream &out, const double &value) |
static std::ostream & | writeEscapedString (std::ostream &out, const std::string &s) |
static public utility methods | |
static std::string | readEscapedString (std::istream &in) |
template<typename T > | |
static void | writeValue (std::ostream &out, const T &value, bool binary, bool last=true) |
write value to/read value from stream, either as text or in binary form; if last is false, a comma is appended/expected (and skipped) after the value | |
template<typename T > | |
static void | readValue (std::istream &in, T &value, bool binary, bool last=true) |
template<typename T > | |
static void | writeValueAsText (std::ostream &out, const T &value) |
write value to stream as text, temporarily sets sufficient precision for float and double values (this assumes that the default number format is used) | |
static MLuint32 | getCodeForType (Type t) |
translation between variant type and 4-char-codes (used in both persistence types) | |
static Type | getTypeForCode (MLuint32) |
The Variant class stores different data types.
Conversion between (integer) types is supported to some degree.
Definition at line 35 of file mlVariant.h.
Enumerator | |
---|---|
Invalid | |
Bool | |
String | |
Int | |
UInt | |
Int64 | |
UInt64 | |
Float | |
Double | |
Vec2 | |
Vec3 | |
Vec4 | |
Vec6 | |
Mat3 | |
Mat4 | |
FilePath | |
PngImageData | |
JpgImageData | |
TypeCount |
Definition at line 38 of file mlVariant.h.
ml::Variant::Variant | ( | ) |
ml::Variant::~Variant | ( | ) |
ml::Variant::Variant | ( | const std::string & | value | ) |
use this for FilePath, PngImageData, JpgImageData
ml::Variant::Variant | ( | bool | value | ) |
ml::Variant::Variant | ( | MLint32 | value | ) |
ml::Variant::Variant | ( | MLuint32 | value | ) |
ml::Variant::Variant | ( | MLint64 | value | ) |
ml::Variant::Variant | ( | MLuint64 | value | ) |
ml::Variant::Variant | ( | MLfloat | value | ) |
ml::Variant::Variant | ( | MLdouble | value | ) |
for internal use, copies data from valuePtr, with length according to type
access content of variant directly, NOTE: use with care
Definition at line 78 of file mlVariant.h.
References T.
Referenced by ml::CSOReadValueFromStream().
check if the Variant can be converted to the given type
translation between variant type and 4-char-codes (used in both persistence types)
|
inline |
check if the Variants type is not Invalid
Definition at line 71 of file mlVariant.h.
Referenced by ml::CSOReadValueFromStream(), and ml::CSOReadValueFromStream< CSOPathPoints >().
std::istream & ml::Variant::read | ( | std::istream & | in, |
bool | asBinary ) |
|
static |
Definition at line 191 of file mlVariant.h.
References mlrange_cast(), and T.
bool ml::Variant::toBool | ( | ) | const |
std::string ml::Variant::toString | ( | ) | const |
|
inline |
get type of variant
Definition at line 68 of file mlVariant.h.
std::ostream & ml::Variant::write | ( | std::ostream & | out, |
bool | asBinary, | ||
bool | writeType = true ) const |
write variant to/read variant from stream, either as text or in binary form
Referenced by ml::CSOWriteValueToStream(), ml::CSOWriteValueToStream< CSOPathPoints >(), and ml::CSOWriteValueToStream< Variant >().
|
static |
static public utility methods
write/read quoted, escaped string, for persistence
|
static |
write value to/read value from stream, either as text or in binary form; if last is false, a comma is appended/expected (and skipped) after the value
Definition at line 178 of file mlVariant.h.
References mlrange_cast(), and T.
|
inlinestatic |
Definition at line 169 of file mlVariant.h.
References mlrange_cast().
|
inlinestatic |
Definition at line 160 of file mlVariant.h.
References mlrange_cast().
write value to stream as text, temporarily sets sufficient precision for float and double values (this assumes that the default number format is used)
Definition at line 154 of file mlVariant.h.
References mlrange_cast().