aboutsummaryrefslogtreecommitdiff
path: root/build2/types
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2016-04-09 07:48:02 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2016-04-09 07:48:02 +0200
commit7a7b8ba432977282a90567c77822a72645d2a5c8 (patch)
tree6abac0b3fad817c4149bc34d80b9c0e6e4a31168 /build2/types
parent6906097a822517af4dc711825132d5f026329c62 (diff)
Add abs_dir_path type, auto-complete if initialized from names
Diffstat (limited to 'build2/types')
-rw-r--r--build2/types18
1 files changed, 17 insertions, 1 deletions
diff --git a/build2/types b/build2/types
index 166f47a..d3930ba 100644
--- a/build2/types
+++ b/build2/types
@@ -8,7 +8,7 @@
#include <vector>
#include <string>
#include <memory> // unique_ptr, shared_ptr
-#include <utility> // pair
+#include <utility> // pair, move()
#include <cstddef> // size_t, nullptr_t
#include <cstdint> // uint{8,16,32,64}_t
#include <istream>
@@ -77,6 +77,22 @@ namespace build2
using butl::basic_path;
using butl::invalid_path;
+ // Absolute directory path. Note that for now we don't do any checking that
+ // the path is in fact absolute.
+ //
+ // The idea is to have a different type that we automatically complete when
+ // a (variable) value of this type gets initialized from untyped names. See
+ // value_type<abs_dir_path> for details.
+ //
+ struct abs_dir_path: dir_path
+ {
+ using dir_path::dir_path;
+
+ explicit
+ abs_dir_path (dir_path d): dir_path (std::move (d).string (), false) {}
+ abs_dir_path () = default;
+ };
+
using paths = std::vector<path>;
using dir_paths = std::vector<dir_path>;