InterViews Reference Manual -- StringTable

NAME
StringTable - map strings to unique pointers
SYNOPSIS
#include <InterViews/strtable.h>
DESCRIPTION
A string table is an index for character strings. The table maps strings or substrings to a unique pointer to type StringId. The table guarantees that the same string will always be mapped to the same pointer; thus, one can quickly compare if two strings are equal by comparing their precomputed pointers. String tables use a static StringPool to manage the storage of the characters.
PUBLIC OPERATIONS
StringTable(int size)
Construct a string table of the given size. The size will be rounded up to the next power of two so that indexing the table does not require division (just take the bitwise-and of the string's hash value and (size-1)).
~StringTable()
Free storage associated with the string table.
StringId* Id(const char*)
StringId* Id(const char*, int)
Convert a string (null-terminated) or substring (explicit length) to a StringId. If the string cannot be found, it will be entered into the table. In any event, the pointer to the string table entry for the string is returned.
void Remove(const char*)
void Remove(const char*, int)
Delete a string from the table. This operation will not release any character storage, only the storage associated with table entry.
const char* StringId::Str()
Return the string associated with a StringId.
SEE ALSO
StringPool

Next: Subject | Prev: StringPool | Up: index | Top: index