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);
130 template <
typename T>
133 const std::type_info &info =
typeid(T);
134 assign(info, &value);
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>);
271 bool isDoubleVector()
const;
279 struct VariantImpl *
self;
293 void assign(
const std::type_info& info,
const void* value);
306 void convert_to(
const std::type_info& info,
void* value)
const;
TypeId
Definition: Variant.h:82
const std::type_info & typeInfo() const
T convert() const
Definition: Variant.h:178
Variant(const T &val)
Definition: Variant.h:105
Variant(const Variant &other)
std::string pythonRepr() const
Convert to Python-compatible representation.
std::string toString() const
static Variant parse(const std::string &val)