diff options
author | David Robillard <d@drobilla.net> | 2007-07-26 16:19:58 +0000 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2007-07-26 16:19:58 +0000 |
commit | dfcc6b65f887e3afcb3aa35eb7b15b7d7ffb972e (patch) | |
tree | f04e684e9bb14c2ac54687a1b0390338b4cd0d50 /raul/Path.hpp | |
parent | 47fb95d6086c2c67086316a25b4c0858783d3c2b (diff) | |
download | raul-dfcc6b65f887e3afcb3aa35eb7b15b7d7ffb972e.tar.gz raul-dfcc6b65f887e3afcb3aa35eb7b15b7d7ffb972e.tar.bz2 raul-dfcc6b65f887e3afcb3aa35eb7b15b7d7ffb972e.zip |
Fix various Table bugs (and put some way too slow code in there, but hey, it works).
Use PathTable for models on the client side.
Implement renaming on client side.
git-svn-id: http://svn.drobilla.net/lad/raul@636 a436a847-0d15-0410-975c-d299462d15a1
Diffstat (limited to 'raul/Path.hpp')
-rw-r--r-- | raul/Path.hpp | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/raul/Path.hpp b/raul/Path.hpp index d8ef751..ba8574e 100644 --- a/raul/Path.hpp +++ b/raul/Path.hpp @@ -44,6 +44,9 @@ namespace Raul { class Path : public std::basic_string<char> { public: + /** Contrust an uninitialzed path, because the STL is annoying. */ + Path() : std::basic_string<char>("/") {} + /** Construct a Path from an std::string. * * It is a fatal error to construct a Path from an invalid string, @@ -114,7 +117,7 @@ public: * Returned value is always a valid path, with the single exception that * the last character is "/". */ - inline string base() const + inline const string base() const { if ((*this) == "/") return *this; @@ -125,9 +128,9 @@ public: /** Return true if \a child is equal to, or a descendant of \a parent */ static bool descendant_comparator(const Path& parent, const Path& child) { - return ( child == parent - || (!strncmp(parent.c_str(), child.c_str(), parent.length()) - && child[parent.length()] == '/') ); + return ( child == parent || (child.length() > parent.length() && + (!strncmp(parent.c_str(), child.c_str(), parent.length()) + && child[parent.length()] == '/')) ); } }; |