Add method to get the local scope variables

This commit is contained in:
Ben Boeckel 2010-08-24 14:40:51 -04:00
parent f794d589a4
commit 52f9637174
2 changed files with 16 additions and 0 deletions

View File

@ -84,6 +84,19 @@ const char* cmDefinitions::Set(const char* key, const char* value)
return def.Exists? def.c_str() : 0;
}
//----------------------------------------------------------------------------
std::set<cmStdString> cmDefinitions::LocalKeys() const
{
std::set<cmStdString> keys;
// Consider local definitions.
for(MapType::const_iterator mi = this->Map.begin();
mi != this->Map.end(); ++mi)
{
keys.insert(mi->first);
}
return keys;
}
//----------------------------------------------------------------------------
cmDefinitions cmDefinitions::Closure() const
{

View File

@ -40,6 +40,9 @@ public:
/** Set (or unset if null) a value associated with a key. */
const char* Set(const char* key, const char* value);
/** Get the set of all local keys. */
std::set<cmStdString> LocalKeys() const;
/** Compute the closure of all defined keys with values.
This flattens the scope. The result has no parent. */
cmDefinitions Closure() const;