11 #include "rrExporter.h"
83 STRING, BOOL, INT32, UINT32, INT64, UINT64, FLOAT, DOUBLE, CHAR, UCHAR, EMPTY, DOUBLEVECTOR
104 template <
typename T>
107 const std::type_info &info =
typeid(T);
112 Variant(
const char* str) : self(0)
114 const std::type_info &info =
typeid(std::string);
115 std::string val(str);
123 Variant(
const Variant& other);
130 template <
typename T>
133 const std::type_info &info =
typeid(T);
134 assign(info, &value);
163 const std::type_info& typeInfo()
const;
177 template <
typename T>
181 convert_to(
typeid(T), &value);
190 #define VARIANT_IMPLICIT_CONVERT(type) \
191 operator type() const \
193 return convert<type>(); \
196 VARIANT_IMPLICIT_CONVERT(std::string);
198 VARIANT_IMPLICIT_CONVERT(
long);
200 VARIANT_IMPLICIT_CONVERT(
bool);
202 VARIANT_IMPLICIT_CONVERT(
float);
204 VARIANT_IMPLICIT_CONVERT(
double);
206 VARIANT_IMPLICIT_CONVERT(
unsigned long);
208 VARIANT_IMPLICIT_CONVERT(
int);
210 VARIANT_IMPLICIT_CONVERT(
unsigned int);
212 VARIANT_IMPLICIT_CONVERT(
char);
214 VARIANT_IMPLICIT_CONVERT(
unsigned char);
216 VARIANT_IMPLICIT_CONVERT(std::vector<double>);
225 static Variant parse(
const std::string& val);
230 std::string toString()
const;
236 std::string pythonRepr()
const;
241 bool isString()
const;
246 bool isInteger()
const;
251 bool isNumeric()
const;
261 bool isEmpty()
const;
266 bool isSigned()
const;
271 bool isDoubleVector()
const;
293 void assign(
const std::type_info& info,
const void* value);
306 void convert_to(
const std::type_info& info,
void* value)
const;
A basic type to hold a variety of data types.
Definition: _Variant.h:75
TypeId
list of currently supported types that a Variant can hold.
Definition: _Variant.h:82
T convert() const
Convert this variant to a supported data type.
Definition: _Variant.h:178
Variant(const T &val)
create a new variant from an existing supported data type.
Definition: _Variant.h:105
Definition: _Variant.cpp:29