add InternalName::join(sep)

This commit is contained in:
rdb 2014-02-10 09:51:21 +00:00
parent 94962c15d2
commit 67d12cdd4a
2 changed files with 20 additions and 0 deletions

View File

@ -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 // Function: InternalName::find_ancestor
// Access: Published // Access: Published

View File

@ -53,6 +53,7 @@ PUBLISHED:
INLINE InternalName *get_parent() const; INLINE InternalName *get_parent() const;
string get_name() const; string get_name() const;
string join(const string &sep) const;
INLINE const string &get_basename() const; INLINE const string &get_basename() const;
int find_ancestor(const string &basename) const; int find_ancestor(const string &basename) const;