116 void setType(Type t);
128 FXbool
isNull()
const {
return type==NullType; }
131 FXbool
isBool()
const {
return type==BoolType; }
134 FXbool
isChar()
const {
return type==CharType; }
137 FXbool
isInt()
const {
return type==IntType; }
140 FXbool
isUInt()
const {
return type==UIntType; }
143 FXbool
isLong()
const {
return type==LongType; }
146 FXbool
isULong()
const {
return type==ULongType; }
149 FXbool
isFloat()
const {
return type==FloatType; }
152 FXbool
isDouble()
const {
return type==DoubleType; }
155 FXbool
isInteger()
const {
return BoolType<=type && type<=ULongType; }
158 FXbool
isReal()
const {
return FloatType<=type && type<=DoubleType; }
161 FXbool
isNumber()
const {
return BoolType<=type && type<=DoubleType; }
164 FXbool
isPtr()
const {
return type==PointerType; }
167 FXbool
isString()
const {
return type==StringType; }
170 FXbool
isArray()
const {
return type==ArrayType; }
173 FXbool
isMap()
const {
return type==MapType; }
176 FXbool toBool()
const;
182 FXint toInt(FXbool* ok=
nullptr)
const;
185 FXuint toUInt(FXbool* ok=
nullptr)
const;
188 FXlong toLong(FXbool* ok=
nullptr)
const;
191 FXulong toULong(FXbool* ok=
nullptr)
const;
194 FXfloat toFloat(FXbool* ok=
nullptr)
const;
197 FXdouble toDouble(FXbool* ok=
nullptr)
const;
200 const FXchar* toChars()
const;
203 FXString toString(FXbool* ok=
nullptr)
const;
206 operator FXbool()
const {
return toBool(); }
209 operator FXptr()
const {
return toPtr(); }
212 operator FXchar()
const {
return (FXchar)toInt(); }
215 operator FXuchar()
const {
return (FXuchar)toUInt(); }
218 operator FXshort()
const {
return (FXshort)toInt(); }
221 operator FXushort()
const {
return (FXushort)toUInt(); }
224 operator FXint()
const {
return toInt(); }
227 operator FXuint()
const {
return toUInt(); }
230 operator FXlong()
const {
return toLong(); }
233 operator FXulong()
const {
return toULong(); }
236 operator FXfloat()
const {
return toFloat(); }
239 operator FXdouble()
const {
return toDouble(); }
290 const FXVariant& at(
const FXchar* key)
const;
318 const FXVariant& operator[](FXint idx)
const {
return at(idx); }
322 const FXVariant& operator[](FXival idx)
const {
return at(idx); }
325 FXbool has(
const FXchar* key)
const;
334 const FXptr&
asPtr()
const {
return value.p; }
340 const FXlong&
asLong()
const {
return value.i; }
346 const FXulong&
asULong()
const {
return value.u; }
352 const FXdouble&
asDouble()
const {
return value.d; }
355 const FXchar*
asChars()
const {
return value.s; }
376 FXbool
remove(
const FXchar* key);
379 FXbool
remove(
const FXString& key){
return remove(key.text()); }
382 FXbool erase(FXival idx);
const FXdouble & asDouble() const
Return the value of the variant as a double; variant type MUST be DoubleType.
Definition: FXVariant.h:352
const FXulong & asULong() const
Return the value of the variant as an unsigned long; variant type MUST be ULongType.
Definition: FXVariant.h:346
FXVariantArray & asArray()
Return the value of the variant as an array-reference; variant type MUST be ArrayType.
Definition: FXVariant.h:364
FXbool isReal() const
Is it a real (float or double)?
Definition: FXVariant.h:158
FXdouble & asDouble()
Return the value of the variant as a double; variant type MUST be DoubleType.
Definition: FXVariant.h:349
FXbool isFloat() const
Is it a float?
Definition: FXVariant.h:149
FXbool isInt() const
Is it a int?
Definition: FXVariant.h:137
FXbool isLong() const
Is it a long?
Definition: FXVariant.h:143
A Variant type can hold any kind of object, be it a boolean, integer, real, string, or even array of Variants or dictionaries of variants.
Definition: FXVariant.h:44
FXulong & asULong()
Return the value of the variant as an unsigned long; variant type MUST be ULongType.
Definition: FXVariant.h:343
FXbool isInteger() const
Is it a integer (bool, char, ..., or long)?
Definition: FXVariant.h:155
FXbool isUInt() const
Is it a unsigned int?
Definition: FXVariant.h:140
const FXString & asString() const
Return the value of the variant as a const string-reference; variant type MUST be StringType...
Definition: FXVariant.h:361
FXString & asString()
Return the value of the variant as a string-reference; variant type MUST be StringType.
Definition: FXVariant.h:358
const FXVariantArray & asArray() const
Return the value of the variant as a const array-reference; variant type MUST be ArrayType.
Definition: FXVariant.h:367
const FXVariantMap & asMap() const
Return the value of the variant as a const map-reference; variant type MUST be MapType.
Definition: FXVariant.h:373
FXbool isChar() const
Is it a character?
Definition: FXVariant.h:134
FXbool isNumber() const
Is it any kind of number?
Definition: FXVariant.h:161
FXchar * text()
Get text contents as pointer.
Definition: FXString.h:119
const FXchar * asChars() const
Return the value of the variant as a char pointer; variant type MUST be StringType.
Definition: FXVariant.h:355
FXbool isBool() const
Is it a bool?
Definition: FXVariant.h:131
FXbool isString() const
Is it a string?
Definition: FXVariant.h:167
FXVariant & operator[](FXint idx)
Return value of array member.
Definition: FXVariant.h:317
FXbool isDouble() const
Is it a double?
Definition: FXVariant.h:152
FXlong & asLong()
Return the value of the variant as a long; variant type MUST be LongType.
Definition: FXVariant.h:337
Definition: FX4Splitter.h:28
FXVariant & operator[](const FXString &key)
Return value of object member.
Definition: FXVariant.h:305
FXbool isMap() const
Is it a map?
Definition: FXVariant.h:173
FXbool isULong() const
Is it a unsigned long?
Definition: FXVariant.h:146
FXptr & asPtr()
Return the value of the variant as a pointer; variant type MUST be PointerType.
Definition: FXVariant.h:331
static const FXVariant null
Default constant variant.
Definition: FXVariant.h:388
FXVariantMap & asMap()
Return the value of the variant as an map-reference; variant type MUST be MapType.
Definition: FXVariant.h:370
FXbool isNull() const
Is it a null?
Definition: FXVariant.h:128
FXVariant & operator[](FXival idx)
Return value of array member.
Definition: FXVariant.h:321
const FXptr & asPtr() const
Return the value of the variant as a pointer; variant type MUST be PointerType.
Definition: FXVariant.h:334
const FXlong & asLong() const
Return the value of the variant as a long; variant type MUST be LongType.
Definition: FXVariant.h:340
const FXVariant & operator[](const FXString &key) const
Return value of object member.
Definition: FXVariant.h:308
Variant map associates strings to variants using fast hash table.
Definition: FXVariantMap.h:31
FXbool isArray() const
Is it a array?
Definition: FXVariant.h:170
FXbool has(const FXString &key) const
Check if key is mapped.
Definition: FXVariant.h:328
Type getType() const
Return type.
Definition: FXVariant.h:119
FXVariant & operator[](const FXchar *key)
Return value of object member.
Definition: FXVariant.h:293
Array of variants.
Definition: FXVariantArray.h:28
const FXVariant & operator[](const FXchar *key) const
Return value of object member.
Definition: FXVariant.h:296
FXString provides essential string manipulation capabilities in FOX.
Definition: FXString.h:42
FXbool isPtr() const
Is it a pointer?
Definition: FXVariant.h:164