21 #ifndef REVERSEDICTIONARY_H 22 #define REVERSEDICTIONARY_H 53 void used(FXival u){ ((FXival*)table)[-2]=u; }
56 void free(FXival f){ ((FXival*)table)[-3]=f; }
59 FXbool resize(FXival n);
63 FXReverseDictionary();
66 FXReverseDictionary(
const FXReverseDictionary& other);
69 FXival
no()
const {
return ((FXival*)table)[-1]; }
72 FXival
used()
const {
return ((FXival*)table)[-2]; }
75 FXival
free()
const {
return ((FXival*)table)[-3]; }
78 FXbool
empty()
const {
return ((FXival*)table)[-1]<=1; }
87 FXival find(
const void* ky)
const;
90 FXbool
has(
const void* ky)
const {
return 0<=find(ky); }
96 const FXString& at(
const void* ky)
const;
114 FXbool
empty(FXival pos)
const {
return (table[pos].key==
nullptr)||(table[pos].key==(
const void*)-1L); }
117 const void*
key(FXival pos)
const {
return table[pos].key; }
const FXString & operator[](const void *ky) const
Return constant reference to slot assocated with given key.
Definition: FXReverseDictionary.h:102
FXbool empty(FXival pos) const
Return true if slot is empty.
Definition: FXReverseDictionary.h:114
FXbool has(const void *ky) const
Check if key is mapped.
Definition: FXReverseDictionary.h:90
FXival used() const
Return number of used slots in the table.
Definition: FXReverseDictionary.h:72
Definition: FXReverseDictionary.h:41
The reverse dictionary class is a fast-access hash table, mapping void-pointers to strings...
Definition: FXReverseDictionary.h:39
FXival no() const
Return the size of the table, including the empty slots.
Definition: FXReverseDictionary.h:69
Definition: FX4Splitter.h:28
FXival free() const
Return number of free slots in the table.
Definition: FXReverseDictionary.h:75
FXbool empty() const
See if map is empty.
Definition: FXReverseDictionary.h:78
FXString & operator[](const void *ky)
Return reference to slot assocated with given key.
Definition: FXReverseDictionary.h:99
FXString & data(FXival pos)
Return reference to slot at position pos.
Definition: FXReverseDictionary.h:120
const void * key(FXival pos) const
Return key at position pos.
Definition: FXReverseDictionary.h:117
const FXString & data(FXival pos) const
Return constant reference to slot at position pos.
Definition: FXReverseDictionary.h:123
FXString insert(const void *ky, const FXString &str=FXString::null)
Insert association with given key; return old value, if any.
Definition: FXReverseDictionary.h:105
FXString provides essential string manipulation capabilities in FOX.
Definition: FXString.h:42