14 #ifndef __UT_FSASymbolTable__
15 #define __UT_FSASymbolTable__
22 template <
typename ITEM_T>
26 SymbolStorage(
const char *str,
const ITEM_T &
data)
42 myStorage.
append(SymbolStorage(symbol, data));
44 return myStorage.
last().myString;
48 for (
int i = 0; i < myStorage.
entries(); i++)
50 if (myStorage(i).myString == symbol)
73 *datap = myStorage(idx).myThing;
85 *datap = myStorage(idx).myThing;
100 bool count(
const char *symbol)
const
101 {
return myTable.
count(symbol); }
110 return idx >= 0 ? myStorage(idx).myString : 0;
116 int64 mem = inclusive ?
sizeof(*this) : 0;
123 int (*
function)(
const ITEM_T &,
const char *,
void *),
126 for (
int i = 0; i < myStorage.
entries(); i++)
128 if (!
function(myStorage(i).myThing,
129 myStorage(i).myString, data))
134 int traverse(
int (*
function)(ITEM_T &,
const char *,
void *),
137 for (
int i = 0; i < myStorage.
entries(); i++)
139 if (!
function(myStorage(i).myThing,
140 myStorage(i).myString, data))
155 for (i = 0; i < myStorage.
entries(); i++)
156 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)
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.
void setCapacity(exint newcapacity)
bool count(const char *symbol) const
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)