cmPropertyList: Add a way to retrieve all properties

This commit is contained in:
Tobias Hunger 2016-06-10 09:34:14 +02:00 committed by Brad King
parent 7066218e79
commit 120899c698
2 changed files with 14 additions and 0 deletions

View File

@ -15,6 +15,7 @@
#include "cmSystemTools.h"
#include "cmake.h"
#include <algorithm>
#include <assert.h>
cmProperty* cmPropertyMap::GetOrCreateProperty(const std::string& name)
@ -29,6 +30,17 @@ cmProperty* cmPropertyMap::GetOrCreateProperty(const std::string& name)
return prop;
}
std::vector<std::string> cmPropertyMap::GetPropertyList() const
{
std::vector<std::string> keyList;
for (cmPropertyMap::const_iterator i = this->begin(), e = this->end();
i != e; ++i) {
keyList.push_back(i->first);
}
std::sort(keyList.begin(), keyList.end());
return keyList;
}
void cmPropertyMap::SetProperty(const std::string& name, const char* value)
{
if (!value) {

View File

@ -19,6 +19,8 @@ class cmPropertyMap : public std::map<std::string, cmProperty>
public:
cmProperty* GetOrCreateProperty(const std::string& name);
std::vector<std::string> GetPropertyList() const;
void SetProperty(const std::string& name, const char* value);
void AppendProperty(const std::string& name, const char* value,