#include <nameUniquifier.h>
Public Member Functions | |
NameUniquifier (const string &separator=string(), const string &empty=string()) | |
Creates a new NameUniquifier. | |
~NameUniquifier () | |
string | add_name (const string &name) |
If name is nonempty and so far unique, returns it unchanged. | |
string | add_name (const string &name, const string &prefix) |
If name is nonempty and so far unique, returns it unchanged. | |
Private Types | |
typedef pset< string > | Names |
Private Member Functions | |
string | add_name_body (const string &name, const string &prefix) |
The actual implementation of the two flavors of add_name(). | |
Private Attributes | |
Names | _names |
string | _separator |
string | _empty |
int | _counter |
Useful for writing egg files with unique vertex pool names, or for file converters to file formats that require unique node names, etc.
Definition at line 45 of file nameUniquifier.h.
|
Definition at line 57 of file nameUniquifier.h. |
|
Creates a new NameUniquifier. The separator string is used to separate the original name (or supplied prefix) and the generated number when a name must be generated. If the original name is empty, the empty string is used, followed by the generated number. Definition at line 52 of file nameUniquifier.cxx. |
|
Definition at line 72 of file nameUniquifier.cxx. References _counter, _empty, _names, _separator, and nassertr. |
|
If name is nonempty and so far unique, returns it unchanged. Otherwise, generates and returns a new name according to the following rules: If the prefix is empty, the new name is the NameUniquifier's "empty" string followed by a number, or the "separator" string if the "empty" string is empty. If the prefix is nonempty, the new name is the prefix, followed by the NameUniquifier's "separator" string, followed by a number. Definition at line 97 of file nameUniquifier.I. |
|
If name is nonempty and so far unique, returns it unchanged. Otherwise, generates and returns a new name according to the following rules: If the name is empty, the new name is the NameUniquifier's "empty" string followed by a number, or the "separator" string if the "empty" string is empty. If the name is nonempty, the new name is the original name, followed by the NameUniquifier's "separator" string, followed by a number. Definition at line 58 of file nameUniquifier.I. References add_name_body(), and INLINE. |
|
The actual implementation of the two flavors of add_name(). If name is nonempty and so far unique, returns it unchanged. Otherwise, generates and returns a new name according to the following rules: If the prefix is empty, the new name is the NameUniquifier's "empty" string followed by a number, or the "separator" string if the "empty" string is empty. If the prefix is nonempty, the new name is the prefix, followed by the NameUniquifier's "separator" string, followed by a number. Definition at line 116 of file nameUniquifier.cxx. Referenced by add_name(). |
|
Definition at line 61 of file nameUniquifier.h. Referenced by ~NameUniquifier(). |
|
Definition at line 60 of file nameUniquifier.h. Referenced by ~NameUniquifier(). |
|
Definition at line 58 of file nameUniquifier.h. Referenced by ~NameUniquifier(). |
|
Definition at line 59 of file nameUniquifier.h. Referenced by ~NameUniquifier(). |