aboutsummaryrefslogtreecommitdiff
path: root/build/variable.ixx
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2015-04-01 12:18:40 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2015-04-01 12:18:40 +0200
commite0de4f26fcf598b4f6beaa2847c4d43a4c761f5b (patch)
tree42e79e141d5b3488cb98843589a68001c875ed01 /build/variable.ixx
parent0dee00f28e623830e816c4002c8004c86055df85 (diff)
Warn about configured/command line value mismatch
Also store configured but unspecified values
Diffstat (limited to 'build/variable.ixx')
-rw-r--r--build/variable.ixx46
1 files changed, 46 insertions, 0 deletions
diff --git a/build/variable.ixx b/build/variable.ixx
new file mode 100644
index 0000000..85fdd50
--- /dev/null
+++ b/build/variable.ixx
@@ -0,0 +1,46 @@
+// file : build/variable.ixx -*- C++ -*-
+// copyright : Copyright (c) 2014-2015 Code Synthesis Tools CC
+// license : MIT; see accompanying LICENSE file
+
+namespace build
+{
+ inline const value_proxy& value_proxy::
+ operator= (value_ptr v) const
+ {
+ assert (v == nullptr || &v->scope == s);
+ *p = std::move (v);
+ return *this;
+ }
+
+ inline const value_proxy& value_proxy::
+ operator= (const value_proxy& v) const
+ {
+ if (this != &v)
+ {
+ if (v)
+ *p = v.as<const value&> ().clone (*s);
+ else
+ p->reset ();
+ }
+
+ return *this;
+ }
+
+ inline const value_proxy& value_proxy::
+ operator= (std::string v) const
+ {
+ // In most cases this is used to initialize a new variable, so
+ // don't bother trying to optimize for the case where p is not
+ // NULL.
+ //
+ p->reset (new list_value (*s, std::move (v)));
+ return *this;
+ }
+
+ inline const value_proxy& value_proxy::
+ operator= (path v) const
+ {
+ p->reset (new list_value (*s, std::move (v)));
+ return *this;
+ }
+}