50 static inline int convertFromReal(
int,
Real v)
58 static inline unsigned int convertFromReal(
unsigned int,
Real v)
66 static inline long convertFromReal(
long,
Real v)
74 static inline unsigned long convertFromReal(
unsigned long,
Real v)
82 static inline long long convertFromReal(
long long,
Real v)
90 static inline unsigned long long convertFromReal(
unsigned long long,
Real v)
102 : m_real_value(0.), m_int32_value(0), m_int64_value(0),
103 m_bool_value(
false), m_sticky_type(TUnknown) {}
105 : m_real_value(v), m_int32_value(0), m_int64_value(0),
106 m_bool_value(
false), m_sticky_type(TReal) {}
107 SmallVariant(
Int32 v)
108 : m_real_value(0.), m_int32_value(v), m_int64_value(0),
109 m_bool_value(
false), m_sticky_type(TInt32) {}
110 SmallVariant(
Int64 v)
111 : m_real_value(0.), m_int32_value(0), m_int64_value(v),
112 m_bool_value(
false), m_sticky_type(TInt64) {}
114 : m_real_value(0.), m_int32_value(0), m_int64_value(v),
115 m_bool_value(v), m_sticky_type(TBool) {}
116 SmallVariant(
const String& v)
117 : m_real_value(0.), m_int32_value(0), m_int64_value(0),
118 m_bool_value(
false), m_string_value(v), m_sticky_type(TString) {}
120 void setValue(
Real v) { m_real_value = v; m_sticky_type = TReal; }
121 void setValue(
Int32 v) { m_int32_value = v; m_sticky_type = TInt32; }
122 void setValue(
Int64 v) { m_int64_value = v; m_sticky_type = TInt64; }
123 void setValue(
const String& v) { m_string_value = v; m_sticky_type = TString; }
124 void setValue(
bool v) { m_bool_value = v; m_sticky_type = TBool; }
126 void setValueAll(
Real v)
128 m_sticky_type = TReal;
130 m_int32_value = convertFromReal(m_int32_value,v);
131 m_int64_value = convertFromReal(m_int64_value,v);
132 m_bool_value = v!=0.;
133 m_string_value = String::fromNumber(m_real_value);
135 void setValueAll(
Int32 v)
137 m_sticky_type = TInt32;
140 m_int64_value = (
Int64)(v);
142 m_string_value = String::fromNumber(m_int32_value);
144 void setValueAll(
Int64 v)
146 m_sticky_type = TInt64;
148 m_int32_value = (
Int32)(v);
151 m_string_value = String::fromNumber(m_int64_value);
153 void setValueAll(
bool v)
155 m_sticky_type = TBool;
157 m_int32_value = v ? 1 : 0;
158 m_int64_value = v ? 1 : 0;
160 m_string_value = String::fromNumber(m_int64_value);
163 void value(
bool& v)
const { v = m_bool_value; }
164 void value(
Real& v)
const { v = m_real_value; }
165 void value(
Int32& v)
const { v = m_int32_value; }
166 void value(
Int64& v)
const { v = m_int64_value; }
167 void value(
String& v)
const { v = m_string_value; }
169 bool asBool()
const {
return m_bool_value; }
170 Real asReal()
const {
return m_real_value; }
172 Int32 asInt32()
const {
return m_int32_value; }
173 Int64 asInt64()
const {
return m_int64_value; }
174 const String& asString()
const {
return m_string_value; }
175 eType type()
const {
return m_sticky_type; }