From 49cd0e47d3783bcc31521a2425061ca7fae07363 Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Fri, 10 Jul 2015 15:33:18 +0200 Subject: Implement path_cast(), path::simple() --- butl/path | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) (limited to 'butl/path') diff --git a/butl/path b/butl/path index af01d05..5462cc9 100644 --- a/butl/path +++ b/butl/path @@ -145,6 +145,12 @@ namespace butl template class basic_path; + // Cast from one path kind to another without any checking or + // processing. + // + template P path_cast (const basic_path&); + template P path_cast (basic_path&&); + template class path_data; @@ -278,6 +284,13 @@ namespace butl return this->path_.empty (); } + // Return true if this path doesn't have any directories. Note + // that "/foo" is not a simple path (it is "foo" in root directory) + // while "/" is (it is the root directory). + // + bool + simple () const; + bool absolute () const; @@ -497,6 +510,18 @@ namespace butl posix_string () const; private: + template + friend P butl::path_cast (const basic_path&); + + template + friend P butl::path_cast (basic_path&&); + + basic_path (string_type s, bool i): base_type (std::move (s)) + { + if (i) + init (); + } + void init (); }; -- cgit v1.1