summaryrefslogtreecommitdiffstats
path: root/src/common/util/Path.h
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2006-09-11 11:10:35 +0000
committerDavid Robillard <d@drobilla.net>2006-09-11 11:10:35 +0000
commitb15864870d34a1188eda93ad215734275037278e (patch)
tree224a1669a29091ea4198425d4a002e448cde8b30 /src/common/util/Path.h
parent22bf43352ddfc48452d776f10ad4d12161255049 (diff)
downloadingen-b15864870d34a1188eda93ad215734275037278e.tar.gz
ingen-b15864870d34a1188eda93ad215734275037278e.tar.bz2
ingen-b15864870d34a1188eda93ad215734275037278e.zip
Switched homebrew CountedPtr to boost::shared_ptr.
Factories for patch windows, controller. Robustness updated in many places. Tons of cleanups, rewrites, bugfixes, etc. git-svn-id: http://svn.drobilla.net/lad/ingen@128 a436a847-0d15-0410-975c-d299462d15a1
Diffstat (limited to 'src/common/util/Path.h')
-rw-r--r--src/common/util/Path.h19
1 files changed, 15 insertions, 4 deletions
diff --git a/src/common/util/Path.h b/src/common/util/Path.h
index c84607fb..6c6d54be 100644
--- a/src/common/util/Path.h
+++ b/src/common/util/Path.h
@@ -199,17 +199,28 @@ public:
/** Parent path with a "/" appended.
*
- * Because of the "/" special case, append a child name to base_path()
- * to construct a path. This return value followed by a valid name is
- * guaranteed to be a valid path.
+ * This exists to avoid needing to be careful about the special case of "/".
+ * To create a child of a path, use parent.base() + child_name.
+ * Returned value is always a valid path, with the single exception that
+ * the last character is "/".
*/
- inline string base_path() const
+ inline string base() const
{
if ((*this) == "/")
return *this;
else
return (*this) + "/";
}
+
+ inline bool is_child_of(const Path& parent) const
+ {
+ return (length() > parent.length() && substr(0, parent.length()) == parent);
+ }
+
+ inline bool is_parent_of(const Path& child) const
+ {
+ return child.is_child_of(*this);
+ }
};