summaryrefslogtreecommitdiff
path: root/src/fs/Traits.hxx
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2014-02-07 18:58:37 +0100
committerMax Kellermann <max@duempel.org>2014-02-07 19:08:51 +0100
commitd744c997d8a4370d56901c5bdf92d3cca0ef83bc (patch)
tree808a88c401091b9c8444745e900152599badbd14 /src/fs/Traits.hxx
parent6b421cc354cb0c297fcf99d7824b99b61caec99d (diff)
fs/Traits: add function Relative()
Move code from Path::RelativeFS() and make it generic.
Diffstat (limited to 'src/fs/Traits.hxx')
-rw-r--r--src/fs/Traits.hxx18
1 files changed, 18 insertions, 0 deletions
diff --git a/src/fs/Traits.hxx b/src/fs/Traits.hxx
index 323656991..88715c3e8 100644
--- a/src/fs/Traits.hxx
+++ b/src/fs/Traits.hxx
@@ -106,6 +106,15 @@ struct PathTraitsFS {
static string GetParent(const_pointer p);
/**
+ * Determine the relative part of the given path to this
+ * object, not including the directory separator. Returns an
+ * empty string if the given path equals this object or
+ * nullptr on mismatch.
+ */
+ gcc_pure gcc_nonnull_all
+ static const_pointer Relative(const_pointer base, const_pointer other);
+
+ /**
* Constructs the path from the given components.
* If either of the components is empty string,
* remaining component is returned unchanged.
@@ -180,6 +189,15 @@ struct PathTraitsUTF8 {
static string GetParent(const_pointer p);
/**
+ * Determine the relative part of the given path to this
+ * object, not including the directory separator. Returns an
+ * empty string if the given path equals this object or
+ * nullptr on mismatch.
+ */
+ gcc_pure gcc_nonnull_all
+ static const_pointer Relative(const_pointer base, const_pointer other);
+
+ /**
* Constructs the path from the given components.
* If either of the components is empty string,
* remaining component is returned unchanged.