From 9891b20350021ce41a950645dd76df20a45c92cc Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Wed, 2 Dec 2015 11:37:15 +0200 Subject: Implement optional module loading The syntax is: using? cli Now each module use results in two bool variables: .loaded and .configured. Also implement variable visibility (the above two variables are limited to project). --- build/scope | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) (limited to 'build/scope') diff --git a/build/scope b/build/scope index 1cfbc10..e52f615 100644 --- a/build/scope +++ b/build/scope @@ -76,25 +76,34 @@ namespace build // in this scope, do it on the the variables map directly. // build::lookup - operator[] (const variable&) const; + operator[] (const variable& var) const + { + return lookup (nullptr, nullptr, var); + } build::lookup operator[] (const std::string& name) const { - return operator[] (variable_pool.find (name)); + return operator[] (var_pool.find (name)); } // As above, but includes target type/pattern-specific variables. // build::lookup - lookup (const target_type&, const string& name, const variable&) const; + lookup (const target_key& tk, const variable& var) const + { + return lookup (tk.type, tk.name, var); + } build::lookup - lookup (const target_type& tt, const string& n, const string& var) const + lookup (const target_key& tk, const string& var) const { - return lookup (tt, n, variable_pool.find (var)); + return lookup (tk, var_pool.find (var)); } + build::lookup + lookup (const target_type*, const string* name, const variable&) const; + // Return a value suitable for assignment (or append if you only // want to append to the value from this scope). If the variable // does not exist in this scope's map, then a new one with the @@ -119,7 +128,7 @@ namespace build value& append (const std::string& name) { - return append (variable_pool.find (name)); + return append (var_pool.find (name)); } // Target type/pattern-specific variables. -- cgit v1.1