From cd75e06a87aa74aa6968113107afa53d401d20bc Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Wed, 25 Mar 2015 14:48:36 +0200 Subject: Configure/disfigure src_root saving/removing support; fsdir{} injection We can now build out-of-tree. --- build/path.ixx | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) (limited to 'build/path.ixx') 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 + inline bool basic_path:: + 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 + inline bool basic_path:: + 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 inline basic_path& basic_path:: complete () { -- cgit v1.1