16 #ifndef __UT_NameManager_h__
17 #define __UT_NameManager_h__
44 template <
class DATA_TYPE >
57 mySuffixStartNumber = suffix_start_number;
65 int64 mem = inclusive ?
sizeof(*this) : 0;
73 unsigned entries()
const {
return (
unsigned) myNumEntries; }
76 bool empty()
const {
return myNumEntries == 0; }
87 auto it = myMap.
find(symbol);
109 for(
auto it = myMap.
begin(); !it.
atEnd(); ++it )
110 it->second =
nullptr;
122 unsigned i=mySuffixStartNumber;
127 ?
static_cast<const char *
>(orig_name_in) :
"name",
130 temp_name.
base(base);
132 unique_name_out.
strcpy(base);
133 int base_len = unique_name_out.
length();
140 unique_name_out.
append(number);
165 auto it = myMap.
find(symbol);
166 if( it!=myMap.
end() )
168 if( it->second ==
nullptr )
192 auto it = myMap.
find(symbol);
193 if( it==myMap.
end() )
203 int mySuffixStartNumber;
204 unsigned myNumEntries;
SYS_FORCE_INLINE exint length() const
bool addSymbol(const UT_StringRef &symbol, DATA_TYPE data)
UT_NameManager(int suffix_start_number=2)
bool empty() const
Returns true if empty, false otherwise.
SYS_FORCE_INLINE const char * buffer() const
SYS_FORCE_INLINE void strcpy(const char *src)
iterator end()
Returns a non-const end iterator for the set.
void clear(bool set_to_null)
iterator find(const Key &key)
unsigned entries() const
Returns the total number of unique names in the manager.
int64 getMemoryUsage(bool inclusive) const
Returns the amount of memory owned by this UT_NameManger.
DATA_TYPE findSymbol(const UT_StringRef &symbol) const
iterator begin()
Returns a non-const iterator for the beginning of the set.
GLuint const GLchar * name
std::function< T > UT_Function
bool getUniqueName(const UT_StringRef &orig_name_in, UT_WorkBuffer &unique_name_out) const
static int itoa(char *str, int64 i)
int64 getMemoryUsage(bool inclusive) const
SYS_FORCE_INLINE void truncate(exint new_length)
std::pair< iterator, bool > emplace(Args &&...args)
bool deleteSymbol(const UT_StringRef &symbol, bool set_to_null)
UT_API UT_StringHolder UTuniqueName(const UT_StringRef &name, UT_Function< bool(const UT_StringRef &)> is_unique)
SYS_FORCE_INLINE void append(char character)
iterator erase(iterator pos)
const char * base(UT_String &buf) const
SYS_FORCE_INLINE bool isstring() const