diff options
author | Boris Kolpackov <boris@codesynthesis.com> | 2015-03-25 14:48:36 +0200 |
---|---|---|
committer | Boris Kolpackov <boris@codesynthesis.com> | 2015-03-25 14:48:36 +0200 |
commit | cd75e06a87aa74aa6968113107afa53d401d20bc (patch) | |
tree | 1e104829d10f375a783d6efbbf7eef3e2c6d2ef5 /build/path.ixx | |
parent | a94dcda7f00b10cb22b5f2138b1c29bcfbe7de37 (diff) |
Configure/disfigure src_root saving/removing support; fsdir{} injection
We can now build out-of-tree.
Diffstat (limited to 'build/path.ixx')
-rw-r--r-- | build/path.ixx | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/build/path.ixx b/build/path.ixx index ef1232b..95608e9 100644 --- a/build/path.ixx +++ b/build/path.ixx @@ -48,6 +48,43 @@ namespace build } template <typename C> + inline bool basic_path<C>:: + sub (const basic_path& p) const + { + size_type n (p.path_.size ()); + + if (n == 0) + return true; + + size_type m (path_.size ()); + + // The second condition guards against the /foo-bar vs /foo case. + // + return m >= n && path_.compare (0, n, p.path_) == 0 && + (traits::is_separator (p.path_.back ()) || // p ends with a separator + m == n || // *this == p + traits::is_separator (path_[n])); // next char is a separator + } + + template <typename C> + inline bool basic_path<C>:: + sup (const basic_path& p) const + { + size_type n (p.path_.size ()); + + if (n == 0) + return true; + + size_type m (path_.size ()); + + // The second condition guards against the /foo-bar vs bar case. + // + return m >= n && path_.compare (m - n, n, p.path_) == 0 && + (m == n || // *this == p + traits::is_separator (path_[m - n - 1])); // prev char is a separator + } + + template <typename C> inline basic_path<C>& basic_path<C>:: complete () { |