Commit ce750180 authored by Andy Cedilnik's avatar Andy Cedilnik

Add method which returns a list of all variables

parent 6631d787
......@@ -976,6 +976,32 @@ const char* cmMakefile::GetDefinition(const char* name) const
return def;
}
std::vector<std::string> cmMakefile::GetDefinitions(int cacheonly /* = 0 */) const
{
std::map<std::string, int> definitions;
if ( !cacheonly )
{
DefinitionMap::const_iterator it;
for ( it = m_Definitions.begin(); it != m_Definitions.end(); it ++ )
{
definitions[it->first] = 1;
}
}
cmCacheManager::CacheIterator cit = this->GetCacheManager()->GetCacheIterator();
for ( cit.Begin(); !cit.IsAtEnd(); cit.Next() )
{
definitions[cit.GetName()] = 1;
}
std::vector<std::string> res;
std::map<std::string, int>::iterator fit;
for ( fit = definitions.begin(); fit != definitions.end(); fit ++ )
{
res.push_back(fit->first);
}
return res;
}
const char *cmMakefile::ExpandVariablesInString(std::string& source) const
......
......@@ -441,6 +441,13 @@ public:
* cache is then queried.
*/
const char* GetDefinition(const char*) const;
/**
* Get the list of all variables in the current space. If argument
* cacheonly is specified and is greater than 0, then only cache
* variables will be listed.
*/
std::vector<std::string> GetDefinitions(int cacheonly=0) const;
/** Test a boolean cache entry to see if it is true or false,
* returns false if no entry defined.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment