From 67d12cdd4a50f83cb876376c85ee86a7747276ea Mon Sep 17 00:00:00 2001 From: rdb Date: Mon, 10 Feb 2014 09:51:21 +0000 Subject: [PATCH] add InternalName::join(sep) --- panda/src/gobj/internalName.cxx | 19 +++++++++++++++++++ panda/src/gobj/internalName.h | 1 + 2 files changed, 20 insertions(+) diff --git a/panda/src/gobj/internalName.cxx b/panda/src/gobj/internalName.cxx index 703b12dc9e..8ee046338f 100644 --- a/panda/src/gobj/internalName.cxx +++ b/panda/src/gobj/internalName.cxx @@ -154,6 +154,25 @@ get_name() const { } } +//////////////////////////////////////////////////////////////////// +// Function: InternalName::join +// Access: Published +// Description: Like get_name, but uses a custom separator instead +// of ".". +//////////////////////////////////////////////////////////////////// +string InternalName:: +join(const string &sep) const { + if (_parent == get_root()) { + return _basename; + + } else if (_parent == (InternalName *)NULL) { + return string(); + + } else { + return _parent->join(sep) + sep + _basename; + } +} + //////////////////////////////////////////////////////////////////// // Function: InternalName::find_ancestor // Access: Published diff --git a/panda/src/gobj/internalName.h b/panda/src/gobj/internalName.h index 88ad2fdda4..7c3c42e259 100644 --- a/panda/src/gobj/internalName.h +++ b/panda/src/gobj/internalName.h @@ -53,6 +53,7 @@ PUBLISHED: INLINE InternalName *get_parent() const; string get_name() const; + string join(const string &sep) const; INLINE const string &get_basename() const; int find_ancestor(const string &basename) const;