aboutsummaryrefslogtreecommitdiff
path: root/build/target
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2015-04-15 14:10:50 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2015-04-15 14:10:50 +0200
commit6535bf6175af32e2514faf75d2742424751a783b (patch)
tree21312b28ffe2bbb459a57e80a1f8eec498327d9f /build/target
parentad720fabd468974e3909f62a0f4e4e3cf0d03aef (diff)
New variables architecture
Now operator[] is only used for lookup.
Diffstat (limited to 'build/target')
-rw-r--r--build/target42
1 files changed, 33 insertions, 9 deletions
diff --git a/build/target b/build/target
index 5495061..00be7b5 100644
--- a/build/target
+++ b/build/target
@@ -94,8 +94,7 @@ namespace build
~target () = default;
target (dir_path d, std::string n, const std::string* e)
- : dir (std::move (d)), name (std::move (n)), ext (e),
- variables (nullptr) {}
+ : dir (std::move (d)), name (std::move (n)), ext (e) {}
const dir_path dir; // Absolute and normalized.
const std::string name;
@@ -126,22 +125,47 @@ namespace build
// Target-specific variables.
//
public:
- variable_map variables;
+ variable_map vars;
- const variable_map&
- ro_variables () const {return variables;}
-
- // Variable lookup in this target and all its outer scopes.
+ // Lookup, including in outer scopes. If you only want to lookup
+ // in this target, do it on the the variables map directly.
//
value_proxy
- operator[] (const variable&);
+ operator[] (const variable&) const;
value_proxy
- operator[] (const std::string& name)
+ operator[] (const std::string& name) const
{
return operator[] (variable_pool.find (name));
}
+ // Return a value_proxy suitable for assignment. See class scope
+ // for details.
+ //
+ value_proxy
+ assign (const variable& var)
+ {
+ return vars.assign (var);
+ }
+
+ value_proxy
+ assign (const std::string& name)
+ {
+ return assign (variable_pool.find (name));
+ }
+
+ // Return a value_proxy suitable for appending. See class scope
+ // for details.
+ //
+ value_proxy
+ append (const variable&);
+
+ value_proxy
+ append (const std::string& name)
+ {
+ return append (variable_pool.find (name));
+ }
+
public:
target_state state;