From 120899c6980fcd81aa2a0d7b733ae15332a7a133 Mon Sep 17 00:00:00 2001 From: Tobias Hunger Date: Fri, 10 Jun 2016 09:34:14 +0200 Subject: [PATCH] cmPropertyList: Add a way to retrieve all properties --- Source/cmPropertyMap.cxx | 12 ++++++++++++ Source/cmPropertyMap.h | 2 ++ 2 files changed, 14 insertions(+) diff --git a/Source/cmPropertyMap.cxx b/Source/cmPropertyMap.cxx index 74e04dac3..de1281ebe 100644 --- a/Source/cmPropertyMap.cxx +++ b/Source/cmPropertyMap.cxx @@ -15,6 +15,7 @@ #include "cmSystemTools.h" #include "cmake.h" +#include #include cmProperty* cmPropertyMap::GetOrCreateProperty(const std::string& name) @@ -29,6 +30,17 @@ cmProperty* cmPropertyMap::GetOrCreateProperty(const std::string& name) return prop; } +std::vector cmPropertyMap::GetPropertyList() const +{ + std::vector 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 4e987501b..6dc7bfbbe 100644 --- a/Source/cmPropertyMap.h +++ b/Source/cmPropertyMap.h @@ -19,6 +19,8 @@ class cmPropertyMap : public std::map public: cmProperty* GetOrCreateProperty(const std::string& name); + std::vector GetPropertyList() const; + void SetProperty(const std::string& name, const char* value); void AppendProperty(const std::string& name, const char* value,