summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTobias Hunger <tobias.hunger@qt.io>2016-06-10 07:34:14 (GMT)
committerBrad King <brad.king@kitware.com>2016-06-10 13:33:02 (GMT)
commit120899c6980fcd81aa2a0d7b733ae15332a7a133 (patch)
treedd7876776937bb8d61fadff3d7c3844178b0f979
parent7066218e792927cb6494ce73e834b8ddb3d275e6 (diff)
downloadCMake-120899c6980fcd81aa2a0d7b733ae15332a7a133.zip
CMake-120899c6980fcd81aa2a0d7b733ae15332a7a133.tar.gz
CMake-120899c6980fcd81aa2a0d7b733ae15332a7a133.tar.bz2
cmPropertyList: Add a way to retrieve all properties
-rw-r--r--Source/cmPropertyMap.cxx12
-rw-r--r--Source/cmPropertyMap.h2
2 files changed, 14 insertions, 0 deletions
diff --git a/Source/cmPropertyMap.cxx b/Source/cmPropertyMap.cxx
index 74e04da..de1281e 100644
--- a/Source/cmPropertyMap.cxx
+++ b/Source/cmPropertyMap.cxx
@@ -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) {
diff --git a/Source/cmPropertyMap.h b/Source/cmPropertyMap.h
index 4e98750..6dc7bfb 100644
--- a/Source/cmPropertyMap.h
+++ b/Source/cmPropertyMap.h
@@ -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,