aboutsummaryrefslogtreecommitdiff
path: root/build2/variable
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2016-03-19 11:34:10 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2016-03-28 16:03:35 +0200
commit9d0d078ff297138622cd2f3f1076f5984395e42b (patch)
treef8b93311adc03410422b3d602ba000822394aebc /build2/variable
parenteb8b0f33b5e3b8a03d9c1b5230028ba9b9e8c391 (diff)
Add support for pair representation reversibility
Diffstat (limited to 'build2/variable')
-rw-r--r--build2/variable15
1 files changed, 10 insertions, 5 deletions
diff --git a/build2/variable b/build2/variable
index a2490ac..029aafa 100644
--- a/build2/variable
+++ b/build2/variable
@@ -214,10 +214,15 @@ namespace build2
template <typename T> typename value_traits<T>::const_type as (const value&);
// Try to "assign" a simple value type to the value stored in name. Return
- // false if the value is not valid for this type.
+ // false if the value is not valid for this type. The second version is
+ // called for a pair and it is expected to merge the result into the first
+ // name.
//
template <typename T> bool assign (name&);
+ template <typename T> bool assign (name&, name&);
+ // Name cast. Can only be called after assign() above returned true.
+ //
template <typename T> typename value_traits<T>::type as (name&);
template <typename T> typename value_traits<T>::const_type as (const name&);
@@ -270,7 +275,7 @@ namespace build2
static type as (value&);
static const_type as (const value&);
- static bool assign (name&);
+ static bool assign (name&, name*);
static void assign (value&, bool);
static void append (value&, bool);
@@ -293,7 +298,7 @@ namespace build2
static type as (value&);
static const_type as (const value&);
- static bool assign (name&);
+ static bool assign (name&, name*);
static void assign (value&, string);
static void append (value&, string);
@@ -316,7 +321,7 @@ namespace build2
static type as (value&);
static const_type as (const value&);
- static bool assign (name&);
+ static bool assign (name&, name*);
static void assign (value&, dir_path);
static void append (value&, dir_path);
@@ -339,7 +344,7 @@ namespace build2
static type as (value&);
static const_type as (const value&);
- static bool assign (name&) {return true;}
+ static bool assign (name&, name* r) {return r == nullptr;}
static void assign (value&, name);
static void append (value&, name) = delete;