diff options
-rw-r--r-- | Source/cmCacheManager.cxx | 2 | ||||
-rw-r--r-- | Source/cmGeneratorTarget.cxx | 8 | ||||
-rw-r--r-- | Source/cmPropertyMap.cxx | 21 | ||||
-rw-r--r-- | Source/cmPropertyMap.h | 7 | ||||
-rw-r--r-- | Source/cmStateDirectory.cxx | 8 |
5 files changed, 18 insertions, 28 deletions
diff --git a/Source/cmCacheManager.cxx b/Source/cmCacheManager.cxx index 358f095bbc..e8fc350e19 100644 --- a/Source/cmCacheManager.cxx +++ b/Source/cmCacheManager.cxx @@ -620,7 +620,7 @@ bool cmCacheManager::CacheIterator::GetValueAsBool() const std::vector<std::string> cmCacheManager::CacheEntry::GetPropertyList() const { - return this->Properties.GetPropertyList(); + return this->Properties.GetKeys(); } const char* cmCacheManager::CacheEntry::GetProperty( diff --git a/Source/cmGeneratorTarget.cxx b/Source/cmGeneratorTarget.cxx index 036a07d1c0..de0f371463 100644 --- a/Source/cmGeneratorTarget.cxx +++ b/Source/cmGeneratorTarget.cxx @@ -5032,13 +5032,7 @@ void cmGeneratorTarget::ComputeVersionedName(std::string& vName, std::vector<std::string> cmGeneratorTarget::GetPropertyKeys() const { - cmPropertyMap const& propsObject = this->Target->GetProperties(); - std::vector<std::string> props; - props.reserve(propsObject.size()); - for (auto const& it : propsObject) { - props.push_back(it.first); - } - return props; + return this->Target->GetProperties().GetKeys(); } void cmGeneratorTarget::ReportPropertyOrigin( diff --git a/Source/cmPropertyMap.cxx b/Source/cmPropertyMap.cxx index 3f6d7c8a9f..a97e1f0713 100644 --- a/Source/cmPropertyMap.cxx +++ b/Source/cmPropertyMap.cxx @@ -2,7 +2,6 @@ file Copyright.txt or https://cmake.org/licensing for details. */ #include "cmPropertyMap.h" -#include <algorithm> #include <assert.h> #include <utility> @@ -18,16 +17,6 @@ cmProperty* cmPropertyMap::GetOrCreateProperty(const std::string& name) return prop; } -std::vector<std::string> cmPropertyMap::GetPropertyList() const -{ - std::vector<std::string> keyList; - for (auto const& i : *this) { - 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) { @@ -61,3 +50,13 @@ const char* cmPropertyMap::GetPropertyValue(const std::string& name) const } return it->second.GetValue(); } + +std::vector<std::string> cmPropertyMap::GetKeys() const +{ + std::vector<std::string> keyList; + keyList.reserve(this->size()); + for (auto const& item : *this) { + keyList.push_back(item.first); + } + return keyList; +} diff --git a/Source/cmPropertyMap.h b/Source/cmPropertyMap.h index 5a0515076d..5c93627637 100644 --- a/Source/cmPropertyMap.h +++ b/Source/cmPropertyMap.h @@ -14,16 +14,19 @@ class cmPropertyMap : public std::map<std::string, cmProperty> { public: + // -- Properties 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, bool asString = false); const char* GetPropertyValue(const std::string& name) const; + + // -- Lists + //! Get a sorted list of property keys + std::vector<std::string> GetKeys() const; }; #endif diff --git a/Source/cmStateDirectory.cxx b/Source/cmStateDirectory.cxx index 182d3fe73b..6ca1c9f555 100644 --- a/Source/cmStateDirectory.cxx +++ b/Source/cmStateDirectory.cxx @@ -6,7 +6,6 @@ #include <algorithm> #include <assert.h> #include <iterator> -#include <utility> #include "cmAlgorithms.h" #include "cmProperty.h" @@ -667,12 +666,7 @@ bool cmStateDirectory::GetPropertyAsBool(const std::string& prop) const std::vector<std::string> cmStateDirectory::GetPropertyKeys() const { - std::vector<std::string> keys; - keys.reserve(this->DirectoryState->Properties.size()); - for (auto const& it : this->DirectoryState->Properties) { - keys.push_back(it.first); - } - return keys; + return this->DirectoryState->Properties.GetKeys(); } void cmStateDirectory::AddNormalTargetName(std::string const& name) |