diff options
author | Stephen Kelly <steveire@gmail.com> | 2015-04-29 22:19:55 (GMT) |
---|---|---|
committer | Stephen Kelly <steveire@gmail.com> | 2015-05-01 17:34:59 (GMT) |
commit | 8b1745a1c5ed992e632bd4865c0f6a34b136041d (patch) | |
tree | 8687b5bf485fb9ee23106e9255ee0a85ecde2448 /Source/cmDefinitions.cxx | |
parent | e8ae46e5e228cc3008e64766e6c8da48b1835545 (diff) | |
download | CMake-8b1745a1c5ed992e632bd4865c0f6a34b136041d.zip CMake-8b1745a1c5ed992e632bd4865c0f6a34b136041d.tar.gz CMake-8b1745a1c5ed992e632bd4865c0f6a34b136041d.tar.bz2 |
cmDefinitions: Accept varStack iterators in Get API.
Diffstat (limited to 'Source/cmDefinitions.cxx')
-rw-r--r-- | Source/cmDefinitions.cxx | 21 |
1 files changed, 14 insertions, 7 deletions
diff --git a/Source/cmDefinitions.cxx b/Source/cmDefinitions.cxx index 61328be..94d27c2 100644 --- a/Source/cmDefinitions.cxx +++ b/Source/cmDefinitions.cxx @@ -11,6 +11,8 @@ ============================================================================*/ #include "cmDefinitions.h" +#include <assert.h> + //---------------------------------------------------------------------------- cmDefinitions::Def cmDefinitions::NoDef; @@ -21,28 +23,33 @@ cmDefinitions::cmDefinitions(cmDefinitions* parent) } //---------------------------------------------------------------------------- -cmDefinitions::Def const& -cmDefinitions::GetInternal(const std::string& key) +cmDefinitions::Def const& cmDefinitions::GetInternal( + const std::string& key, + std::list<cmDefinitions>::reverse_iterator rbegin, + std::list<cmDefinitions>::reverse_iterator rend) { + assert(&*rbegin == this); MapType::const_iterator i = this->Map.find(key); if(i != this->Map.end()) { return i->second; } - cmDefinitions* up = this->Up; - if(!up) + ++rbegin; + if(rbegin == rend) { return this->NoDef; } // Query the parent scope and store the result locally. - Def def = up->GetInternal(key); + Def def = rbegin->GetInternal(key, rbegin, rend); return this->Map.insert(MapType::value_type(key, def)).first->second; } //---------------------------------------------------------------------------- -const char* cmDefinitions::Get(const std::string& key) +const char* cmDefinitions::Get(const std::string& key, + std::list<cmDefinitions>::reverse_iterator rbegin, + std::list<cmDefinitions>::reverse_iterator rend) { - Def const& def = this->GetInternal(key); + Def const& def = this->GetInternal(key, rbegin, rend); return def.Exists? def.c_str() : 0; } |