From 56ce5687567150b0b2cc3e57540d564793ef6bf7 Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Tue, 28 Apr 2015 16:13:54 +0200 Subject: Add support for iteration over path components --- build/path.ixx | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) (limited to 'build/path.ixx') diff --git a/build/path.ixx b/build/path.ixx index ff1ec32..8ee6a33 100644 --- a/build/path.ixx +++ b/build/path.ixx @@ -85,6 +85,41 @@ namespace build } template + inline auto basic_path:: + begin () const -> iterator + { + size_type b, e; + + if (this->path_.empty ()) + b = e = string_type::npos; + +#ifndef _WIN32 + else if (root ()) + { + // We want to return a single empty component. Here we return + // the begin position one past the end. Not sure if this legal. + // + b = 1; + e = string_type::npos; + } +#endif + else + { + b = 0; + e = traits::find_separator (this->path_); + } + + return iterator (this->path_, b, e); + } + + template + inline auto basic_path:: + end () const -> iterator + { + return iterator (this->path_, string_type::npos, string_type::npos); + } + + template inline basic_path& basic_path:: complete () { -- cgit v1.1