diff options
author | Boris Kolpackov <boris@codesynthesis.com> | 2015-01-08 13:27:15 +0200 |
---|---|---|
committer | Boris Kolpackov <boris@codesynthesis.com> | 2015-01-08 13:27:15 +0200 |
commit | ab4421747146aa7995f0cfb1a639c9121c82c915 (patch) | |
tree | deb08893c02ed0238f73becbbe80ede5568b946e /build/path | |
parent | d3e624ef7c0fb274e62b81c4c7bd59640770520a (diff) |
Implement tracing support
Also use to-relative path translation in diagnostics.
Diffstat (limited to 'build/path')
-rw-r--r-- | build/path | 19 |
1 files changed, 19 insertions, 0 deletions
@@ -218,6 +218,16 @@ namespace build bool root () const; + // Return true if *this is a sub-path of the specified path (i.e., + // the specified path is a prefix). Expects both paths to be + // normalized. + // + bool + sub (const basic_path& p) const + { + return path_.compare (0, p.path_.size (), p.path_) == 0; + } + public: // Return the path without the directory part. // @@ -249,6 +259,13 @@ namespace build basic_path base () const; + // Return a path relative to the specified path that is equivalent + // to *this. Throws invalid_path if a relative path cannot be derived + // (e.g., paths are on different drives on Windows). + // + basic_path + relative (basic_path) const; + public: // Normalize the path. This includes collapsing the '.' and '..' // directories if possible, collapsing multiple directory @@ -334,12 +351,14 @@ namespace build string_type path_; }; + /* template <typename C> inline std::basic_ostream<C>& operator<< (std::basic_ostream<C>& os, basic_path<C> const& p) { return os << p.string (); } + */ } #include <build/path.ixx> |