HDK
|
#include <UT_NameManager.h>
Public Member Functions | |
UT_NameManager (int suffix_start_number=2) | |
~UT_NameManager () | |
int64 | getMemoryUsage (bool inclusive) const |
Returns the amount of memory owned by this UT_NameManger. More... | |
unsigned | entries () const |
Returns the total number of unique names in the manager. More... | |
bool | empty () const |
Returns true if empty, false otherwise. More... | |
bool | deleteSymbol (const UT_StringRef &symbol, bool set_to_null) |
void | clear (bool set_to_null) |
bool | getUniqueName (const UT_StringRef &orig_name_in, UT_WorkBuffer &unique_name_out) const |
bool | addSymbol (const UT_StringRef &symbol, DATA_TYPE data) |
DATA_TYPE | findSymbol (const UT_StringRef &symbol) const |
Definition at line 45 of file UT_NameManager.h.
|
inline |
suffix_start_number determines the starting numerical suffix when unique names are generated. For example: If set to 0, generating unique names for "base" will result in "base0", "base1", "base2", etc. If set to 1, generating unique names for "base" will result in "base", "base1", "base2", etc. If set to 2, generating unique names for "base" will result in "base", "base2", "base3", etc. And so on.
Definition at line 55 of file UT_NameManager.h.
|
inline |
Definition at line 60 of file UT_NameManager.h.
|
inline |
Adds a new name to this collection. If the name already exists, the addition will silently fail, so it is the caller's responsibility to assure that the name is unique by calling findSymbol() if needed. This is done to avoid extra uniqueness checks that may be unnecessary in certain situations.
Returns true if symbol added successfully, false otherwise.
Definition at line 160 of file UT_NameManager.h.
|
inline |
Clears all the entries from this manager. if set_to_null is true the map entries values will be set to null instead of erasing all the entries.
Definition at line 105 of file UT_NameManager.h.
|
inline |
Removes a name, such as "base123", from the manager. If the removed name was the last one in a category and the category is now empty, deletes the category as well. Returns true if removal was successfull, false otherwise.
Definition at line 82 of file UT_NameManager.h.
|
inline |
Returns true if empty, false otherwise.
Definition at line 76 of file UT_NameManager.h.
|
inline |
Returns the total number of unique names in the manager.
Definition at line 73 of file UT_NameManager.h.
|
inline |
Finds the data item associated with a given name. Returns a pointer to the item if found, nullptr if the name is not in the collection.
Definition at line 187 of file UT_NameManager.h.
|
inline |
Returns the amount of memory owned by this UT_NameManger.
Definition at line 63 of file UT_NameManager.h.
|
inline |
Generates a new name unique relative to the items alraedy in this collection, optionally starting with a given name.
Definition at line 120 of file UT_NameManager.h.