aboutsummaryrefslogtreecommitdiff
path: root/build/scope
diff options
context:
space:
mode:
Diffstat (limited to 'build/scope')
-rw-r--r--build/scope16
1 files changed, 16 insertions, 0 deletions
diff --git a/build/scope b/build/scope
index 2b621e7..2eb8ac7 100644
--- a/build/scope
+++ b/build/scope
@@ -88,6 +88,8 @@ namespace build
private:
friend class scope_map;
+ friend class temp_scope;
+
typedef path_map<scope>::const_iterator iterator;
scope (): variables (*this) {}
@@ -97,6 +99,20 @@ namespace build
scope* root_;
};
+ // Temporary scope. The idea is to be able to create a temporary
+ // scope in order not to change the variables in the current scope.
+ // Such a scope is not entered in to the scope map. As a result it
+ // can only be used as a temporary set of variables. In particular,
+ // defining targets/prerequsites directly in such a scope will surely
+ // end up badly. Defining any nested scopes will be as if defining
+ // such a scope in the parent (since path() returns parent's path).
+ //
+ class temp_scope: public scope
+ {
+ public:
+ temp_scope (scope& p) {i_ = p.i_; parent_ = &p; root_ = p.root_;}
+ };
+
class scope_map: public path_map<scope>
{
public: