From dfcc6b65f887e3afcb3aa35eb7b15b7d7ffb972e Mon Sep 17 00:00:00 2001 From: David Robillard Date: Thu, 26 Jul 2007 16:19:58 +0000 Subject: 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 --- raul/Path.hpp | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) (limited to 'raul/Path.hpp') 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 { public: + /** Contrust an uninitialzed path, because the STL is annoying. */ + Path() : std::basic_string("/") {} + /** 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()] == '/')) ); } }; -- cgit v1.2.1