From 534f9d8db025d58c9ce23f3b81a37e8c34386a27 Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Mon, 13 Apr 2015 10:29:25 +0200 Subject: Add initial import support --- build/scope | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'build/scope') 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::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 { public: -- cgit v1.1