aboutsummaryrefslogtreecommitdiff
path: root/libbutl/path.hxx
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2021-09-29 11:16:22 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2021-09-29 11:16:22 +0200
commitef8d8c01a4d630b55ee4cf7a23688a5a5d685419 (patch)
treebb7fb99993609ed79739664dea2022af2c66ec63 /libbutl/path.hxx
parentdf1ef68cd8e8582724ce1192bfc202e0b9aeaf0c (diff)
Factor path::{sub,sup}() to path_traits::{sub,sup}()
Diffstat (limited to 'libbutl/path.hxx')
-rw-r--r--libbutl/path.hxx16
1 files changed, 16 insertions, 0 deletions
diff --git a/libbutl/path.hxx b/libbutl/path.hxx
index 8276130..fae145e 100644
--- a/libbutl/path.hxx
+++ b/libbutl/path.hxx
@@ -373,6 +373,22 @@ namespace butl
: (p = rfind_separator (s, n - 1)) == nullptr ? s : ++p;
}
+ // Return true if sb is a sub-path of sp (i.e., sp is a prefix). Expects
+ // both paths to be normalized. Note that this function returns true if
+ // the paths are equal. Empty path is considered a prefix of any path.
+ //
+ static bool
+ sub (const C* sb, size_type nb,
+ const C* sp, size_type np);
+
+ // Return true if sp is a super-path of sb (i.e., sb is a suffix). Expects
+ // both paths to be normalized. Note that this function returns true if
+ // the paths are equal. Empty path is considered a prefix of any path.
+ //
+ static bool
+ sup (const C* sp, size_type np,
+ const C* sb, size_type nb);
+
static int
compare (string_type const& l,
string_type const& r,