Panda3D
Loading...
Searching...
No Matches
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 */
27INLINE std::string NameUniquifier::
28add_name(const std::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 */
45INLINE std::string NameUniquifier::
46add_name(const std::string &name, const std::string &prefix) {
47 return add_name_body(name, prefix);
48}
std::string add_name(const std::string &name)
If name is nonempty and so far unique, returns it unchanged.