From baa7dfcb33d2be7217f450e24f63e94a8c1ad6be Mon Sep 17 00:00:00 2001 From: Josh Yelon Date: Fri, 25 Jan 2008 03:29:18 +0000 Subject: [PATCH] Added a convenience function to make an internal name with an integer suffix --- panda/src/gobj/internalName.cxx | 13 +++++++++++++ panda/src/gobj/internalName.h | 1 + 2 files changed, 14 insertions(+) diff --git a/panda/src/gobj/internalName.cxx b/panda/src/gobj/internalName.cxx index 447b73be33..cabc8704b9 100644 --- a/panda/src/gobj/internalName.cxx +++ b/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 diff --git a/panda/src/gobj/internalName.h b/panda/src/gobj/internalName.h index 47290b9066..6a988ceb7a 100644 --- a/panda/src/gobj/internalName.h +++ b/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;