From 7a7b8ba432977282a90567c77822a72645d2a5c8 Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Sat, 9 Apr 2016 07:48:02 +0200 Subject: Add abs_dir_path type, auto-complete if initialized from names --- build2/variable.ixx | 41 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) (limited to 'build2/variable.ixx') 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:: + 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 () = move (x)); + + return !p->empty (); + } + + inline bool value_traits:: + 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 (); + + if (p->empty ()) + p->swap (x); + else + *p /= x; + } + + return !p->empty (); + } + + inline int value_traits:: + compare (const abs_dir_path& l, const abs_dir_path& r) + { + return l.compare (static_cast (r)); + } + // name value // inline bool value_traits:: -- cgit v1.1