aboutsummaryrefslogtreecommitdiff
path: root/build/scope
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2015-04-13 10:29:25 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2015-04-13 10:29:25 +0200
commit534f9d8db025d58c9ce23f3b81a37e8c34386a27 (patch)
treee7d0c7871a7caf3b3e41c8d00548212f1ca7aa83 /build/scope
parentb4ceb7b6aecb7492b28d7a0f6c53fa657a2cd2e5 (diff)
Add initial import support
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: