diff options
author | Boris Kolpackov <boris@codesynthesis.com> | 2021-09-29 11:16:22 +0200 |
---|---|---|
committer | Boris Kolpackov <boris@codesynthesis.com> | 2021-09-29 11:16:22 +0200 |
commit | ef8d8c01a4d630b55ee4cf7a23688a5a5d685419 (patch) | |
tree | bb7fb99993609ed79739664dea2022af2c66ec63 /libbutl/path.hxx | |
parent | df1ef68cd8e8582724ce1192bfc202e0b9aeaf0c (diff) |
Factor path::{sub,sup}() to path_traits::{sub,sup}()
Diffstat (limited to 'libbutl/path.hxx')
-rw-r--r-- | libbutl/path.hxx | 16 |
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, |