21 #ifndef FXVARIANTMAP_H 22 #define FXVARIANTMAP_H 46 void used(FXival u){ ((FXival*)table)[-2]=u; }
49 void free(FXival f){ ((FXival*)table)[-3]=f; }
52 FXbool resize(FXival n);
59 FXVariantMap(
const FXVariantMap& other);
62 FXival
no()
const {
return ((FXival*)table)[-1]; }
65 FXival
used()
const {
return ((FXival*)table)[-2]; }
68 FXival
free()
const {
return ((FXival*)table)[-3]; }
71 FXbool
empty()
const {
return ((FXival*)table)[-1]<=1; }
80 FXival find(
const FXchar* ky)
const;
86 FXbool
has(
const FXchar* ky)
const {
return 0<=find(ky); }
95 const FXVariant& at(
const FXchar* ky)
const;
116 FXbool
remove(
const FXchar* ky);
119 FXbool
remove(
const FXString& ky){
return remove(ky.text()); }
122 FXbool erase(FXival pos);
125 FXbool
empty(FXival pos)
const {
return table[pos].key.
empty(); }
FXival free() const
Return number of free slots in the table.
Definition: FXVariantMap.h:68
const FXVariant & at(const FXString &ky) const
Return constant reference to variant assocated with key.
Definition: FXVariantMap.h:101
const FXVariant & data(FXival pos) const
Return value at slot pos; may be empty!
Definition: FXVariantMap.h:135
FXival no() const
Return the size of the table, including the empty slots.
Definition: FXVariantMap.h:62
FXbool empty() const
See if map is empty.
Definition: FXVariantMap.h:71
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
FXbool empty(FXival pos) const
Return true if slot at pos is empty.
Definition: FXVariantMap.h:125
FXchar * text()
Get text contents as pointer.
Definition: FXString.h:119
FXbool empty() const
See if string is empty.
Definition: FXString.h:125
FXVariant & operator[](const FXchar *ky)
Return reference to variant assocated with key.
Definition: FXVariantMap.h:104
const FXVariant & operator[](const FXchar *ky) const
Return constant reference to variant assocated with key.
Definition: FXVariantMap.h:107
Definition: FXVariantMap.h:33
Definition: FX4Splitter.h:28
FXVariant & data(FXival pos)
Return reference to data at slot s; but careful as assignment to empty slot is dangerous!! ...
Definition: FXVariantMap.h:132
const FXString & key(FXival pos) const
Return key value at slot pos; may be empty!
Definition: FXVariantMap.h:128
FXival used() const
Return number of used slots in the table.
Definition: FXVariantMap.h:65
const FXVariant & operator[](const FXString &ky) const
Return constant reference to variant assocated with key.
Definition: FXVariantMap.h:113
FXival find(const FXString &ky) const
Find slot index for key; return -1 if not found.
Definition: FXVariantMap.h:83
FXbool has(const FXString &ky) const
Check if key is mapped.
Definition: FXVariantMap.h:89
Variant map associates strings to variants using fast hash table.
Definition: FXVariantMap.h:31
FXVariant & at(const FXString &ky)
Return reference to variant assocated with key.
Definition: FXVariantMap.h:98
FXbool has(const FXchar *ky) const
Check if key is mapped.
Definition: FXVariantMap.h:86
FXVariant & operator[](const FXString &ky)
Return reference to variant assocated with key.
Definition: FXVariantMap.h:110
FXString provides essential string manipulation capabilities in FOX.
Definition: FXString.h:42