diff options
author | Boris Kolpackov <boris@codesynthesis.com> | 2016-04-09 07:48:02 +0200 |
---|---|---|
committer | Boris Kolpackov <boris@codesynthesis.com> | 2016-04-09 07:48:02 +0200 |
commit | 7a7b8ba432977282a90567c77822a72645d2a5c8 (patch) | |
tree | 6abac0b3fad817c4149bc34d80b9c0e6e4a31168 /build2/variable.ixx | |
parent | 6906097a822517af4dc711825132d5f026329c62 (diff) |
Add abs_dir_path type, auto-complete if initialized from names
Diffstat (limited to 'build2/variable.ixx')
-rw-r--r-- | build2/variable.ixx | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/build2/variable.ixx b/build2/variable.ixx index 821d224..e52a150 100644 --- a/build2/variable.ixx +++ b/build2/variable.ixx @@ -411,6 +411,47 @@ namespace build2 return l.compare (r); } + // abs_dir_path value + // + inline bool value_traits<abs_dir_path>:: + assign (value& v, abs_dir_path&& x) + { + abs_dir_path* p; + + if (v.null ()) + p = new (&v.data_) abs_dir_path (move (x)); + else + p = &(v.as<abs_dir_path> () = move (x)); + + return !p->empty (); + } + + inline bool value_traits<abs_dir_path>:: + append (value& v, abs_dir_path&& x) + { + abs_dir_path* p; + + if (v.null ()) + p = new (&v.data_) abs_dir_path (move (x)); + else + { + p = &v.as<abs_dir_path> (); + + if (p->empty ()) + p->swap (x); + else + *p /= x; + } + + return !p->empty (); + } + + inline int value_traits<abs_dir_path>:: + compare (const abs_dir_path& l, const abs_dir_path& r) + { + return l.compare (static_cast<const dir_path&> (r)); + } + // name value // inline bool value_traits<name>:: |