14 #ifndef __UT_FSASymbolTable__
15 #define __UT_FSASymbolTable__
23 template <
typename ITEM_T>
28 SymbolStorage(
const char *str,
const ITEM_T &
data)
46 myStorage.
append(SymbolStorage(symbol, data));
48 return myStorage.
last().myString;
52 for (
int i = 0; i < myStorage.
entries(); i++)
54 if (myStorage(i).myString == symbol)
77 *datap = myStorage(idx).myThing;
89 *datap = myStorage(idx).myThing;
103 {
return myTable.
contains(symbol); }
104 bool count(
const char *symbol)
const
105 {
return myTable.
count(symbol); }
114 return idx >= 0 ? myStorage(idx).myString : 0;
120 int64 mem = inclusive ?
sizeof(*this) : 0;
127 int (*
function)(
const ITEM_T &,
const char *,
void *),
130 for (
int i = 0; i < myStorage.
entries(); i++)
132 if (!
function(myStorage(i).myThing,
133 myStorage(i).myString, data))
138 int traverse(
int (*
function)(ITEM_T &,
const char *,
void *),
141 for (
int i = 0; i < myStorage.
entries(); i++)
143 if (!
function(myStorage(i).myThing,
144 myStorage(i).myString, data))
159 for (i = 0; i < myStorage.
entries(); i++)
160 tokens[i].set(i, myStorage(i).myString);
const char * getStringReference(const char *symbol)
int findSymbol(const char *symbol) const
int traverseConst(int(*function)(const ITEM_T &, const char *, void *), void *data) const
int findSymbol(const char *symbol, ITEM_T *datap) const
int traverse(int(*function)(ITEM_T &, const char *, void *), void *data)
SYS_FORCE_INLINE T * SYSconst_cast(const T *foo)
bool contains(const char *symbol) const
void extractStrings(UT_StringArray &list) const
int deleteSymbol(const char *symbol)
int64 getMemoryUsage(bool inclusive=false) const
exint removeIndex(exint index)
void setCapacity(exint new_capacity)
int count(const char *symbol) const
const char * c_str() const
int64 getMemoryUsage(bool inclusive) const
void extractStrings(UT_StringArray &list) const
A utility class to do read-only operations on a subset of an existing string.
bool count(const char *symbol) const
#define UT_NON_COPYABLE(CLASS)
Define deleted copy constructor and assignment operator inside a class.
int64 getMemoryUsage(bool inclusive) const
exint entries() const
Alias of size(). size() is preferred.
bool contains(const char *symbol) const
int findSymbol(const UT_StringRef &str, ITEM_T *datap) const
int findSymbol(const UT_String &str, ITEM_T *datap) const
bool build(const UT_StringArray &strings, const UT_IntArray &indices, int notfound_index=-1)
int findSymbol(const UT_StringView &symbol, ITEM_T *datap) const
const char * addSymbol(const char *symbol, const ITEM_T &data)