aboutsummaryrefslogtreecommitdiff
path: root/libbuild2/scope.hxx
diff options
context:
space:
mode:
Diffstat (limited to 'libbuild2/scope.hxx')
-rw-r--r--libbuild2/scope.hxx34
1 files changed, 32 insertions, 2 deletions
diff --git a/libbuild2/scope.hxx b/libbuild2/scope.hxx
index 2ed8f18..655a1a0 100644
--- a/libbuild2/scope.hxx
+++ b/libbuild2/scope.hxx
@@ -181,6 +181,14 @@ namespace build2
return vars.assign (ctx.var_pool.rw (*this).insert<T> (move (name)));
}
+ template <typename T>
+ T&
+ assign (string name, T&& val)
+ {
+ value& v (assign<T> (move (name)) = forward<T> (val));
+ return v.as<T> ();
+ }
+
// Return a value suitable for appending. If the variable does not
// exist in this scope's map, then outer scopes are searched for
// the same variable. If found then a new variable with the found
@@ -289,6 +297,22 @@ namespace build2
public:
rule_map rules;
+ template <typename T>
+ void
+ insert_rule (action_id a, const char* hint, const rule& r)
+ {
+ rules.insert<T> (a, hint, r);
+ }
+
+ template <typename T>
+ void
+ insert_rule (meta_operation_id mid, operation_id oid,
+ const char* hint,
+ const rule& r)
+ {
+ rules.insert<T> (mid, oid, hint, r);
+ }
+
// Operation callbacks.
//
// An entity (module, core) can register a function that will be called
@@ -374,9 +398,9 @@ namespace build2
template <typename T>
T*
- lookup_module (const string& name) const
+ find_module (const string& name) const
{
- return root_extra->modules.lookup<T> (name);
+ return root_extra->modules.find_module<T> (name);
}
public:
@@ -389,6 +413,12 @@ namespace build2
return const_cast<scope&> (*this);
}
+ variable_pool&
+ var_pool ()
+ {
+ return ctx.var_pool.rw (*this);
+ }
+
private:
friend class parser;
friend class scope_map;