nameUniquifier.I
Go to the documentation of this file.
1 /**
2  * PANDA 3D SOFTWARE
3  * Copyright (c) Carnegie Mellon University. All rights reserved.
4  *
5  * All use of this software is subject to the terms of the revised BSD
6  * license. You should have received a copy of this license along
7  * with this source code in a file named "LICENSE."
8  *
9  * @file nameUniquifier.I
10  * @author drose
11  * @date 2000-02-16
12  */
13 
14 /**
15  * If name is nonempty and so far unique, returns it unchanged.
16  *
17  * Otherwise, generates and returns a new name according to the following
18  * rules:
19  *
20  * If the name is empty, the new name is the NameUniquifier's "empty" string
21  * followed by a number, or the "separator" string if the "empty" string is
22  * empty.
23  *
24  * If the name is nonempty, the new name is the original name, followed by the
25  * NameUniquifier's "separator" string, followed by a number.
26  */
27 INLINE string NameUniquifier::
28 add_name(const string &name) {
29  return add_name_body(name, name);
30 }
31 
32 /**
33  * If name is nonempty and so far unique, returns it unchanged.
34  *
35  * Otherwise, generates and returns a new name according to the following
36  * rules:
37  *
38  * If the prefix is empty, the new name is the NameUniquifier's "empty" string
39  * followed by a number, or the "separator" string if the "empty" string is
40  * empty.
41  *
42  * If the prefix is nonempty, the new name is the prefix, followed by the
43  * NameUniquifier's "separator" string, followed by a number.
44  */
45 INLINE string NameUniquifier::
46 add_name(const string &name, const string &prefix) {
47  return add_name_body(name, prefix);
48 }
string add_name(const string &name)
If name is nonempty and so far unique, returns it unchanged.