Browse Source

Added a convenience function to make an internal name with an integer suffix

Josh Yelon 18 years ago
parent
commit
baa7dfcb33
2 changed files with 14 additions and 0 deletions
  1. 13 0
      panda/src/gobj/internalName.cxx
  2. 1 0
      panda/src/gobj/internalName.h

+ 13 - 0
panda/src/gobj/internalName.cxx

@@ -301,6 +301,19 @@ finalize(BamReader *) {
   nassertv(get_ref_count() != 0);
 }
 
+////////////////////////////////////////////////////////////////////
+//     Function: InternalName::make
+//       Access: Published, Static
+//  Description: Make using a string and an integer.  Concatenates
+//               the two.
+////////////////////////////////////////////////////////////////////
+PT(InternalName) InternalName::
+make(const string &name, int index) {
+  std::ostringstream full;
+  full << name << index;
+  return make(full.str());
+}
+
 ////////////////////////////////////////////////////////////////////
 //     Function: InternalName::make_from_bam
 //       Access: Protected, Static

+ 1 - 0
panda/src/gobj/internalName.h

@@ -52,6 +52,7 @@ PUBLISHED:
   bool unref() const;
 
   INLINE static PT(InternalName) make(const string &name);
+  INLINE static PT(InternalName) make(const string &name, int index);
   PT(InternalName) append(const string &basename);
 
   INLINE InternalName *get_parent() const;