00001 // Filename: nameUniquifier.I 00002 // Created by: drose (16Feb00) 00003 // 00004 //////////////////////////////////////////////////////////////////// 00005 // 00006 // PANDA 3D SOFTWARE 00007 // Copyright (c) 2001, Disney Enterprises, Inc. All rights reserved 00008 // 00009 // All use of this software is subject to the terms of the Panda 3d 00010 // Software license. You should have received a copy of this license 00011 // along with this source code; you will also find a current copy of 00012 // the license at http://www.panda3d.org/license.txt . 00013 // 00014 // To contact the maintainers of this program write to 00015 // panda3d@yahoogroups.com . 00016 // 00017 //////////////////////////////////////////////////////////////////// 00018 00019 00020 //////////////////////////////////////////////////////////////////// 00021 // Function: NameUniquifier::add_name 00022 // Access: Public 00023 // Description: If name is nonempty and so far unique, returns it 00024 // unchanged. 00025 // 00026 // Otherwise, generates and returns a new name according 00027 // to the following rules: 00028 // 00029 // If the name is empty, the new name is the 00030 // NameUniquifier's "empty" string followed by a number, 00031 // or the "separator" string if the "empty" string is 00032 // empty. 00033 // 00034 // If the name is nonempty, the new name is the original 00035 // name, followed by the NameUniquifier's "separator" 00036 // string, followed by a number. 00037 //////////////////////////////////////////////////////////////////// 00038 INLINE string NameUniquifier:: 00039 add_name(const string &name) { 00040 return add_name_body(name, name); 00041 } 00042 00043 //////////////////////////////////////////////////////////////////// 00044 // Function: NameUniquifier::add_name 00045 // Access: Public 00046 // Description: If name is nonempty and so far unique, returns it 00047 // unchanged. 00048 // 00049 // Otherwise, generates and returns a new name according 00050 // to the following rules: 00051 // 00052 // If the prefix is empty, the new name is the 00053 // NameUniquifier's "empty" string followed by a number, 00054 // or the "separator" string if the "empty" string is 00055 // empty. 00056 // 00057 // If the prefix is nonempty, the new name is the 00058 // prefix, followed by the NameUniquifier's "separator" 00059 // string, followed by a number. 00060 //////////////////////////////////////////////////////////////////// 00061 INLINE string NameUniquifier:: 00062 add_name(const string &name, const string &prefix) { 00063 return add_name_body(name, prefix); 00064 }