From 9e64e617eb295c7e2725d871225659ae7bcf7c48 Mon Sep 17 00:00:00 2001 From: Sebastian Holtermann Date: Sun, 2 Jun 2019 12:35:33 +0200 Subject: cmPropertyMap: Rename GetPropertyList method to GetKeys --- Source/cmCacheManager.cxx | 2 +- Source/cmGeneratorTarget.cxx | 8 +------- Source/cmPropertyMap.cxx | 21 ++++++++++----------- Source/cmPropertyMap.h | 7 +++++-- Source/cmStateDirectory.cxx | 8 +------- 5 files changed, 18 insertions(+), 28 deletions(-) diff --git a/Source/cmCacheManager.cxx b/Source/cmCacheManager.cxx index 358f095..e8fc350 100644 --- a/Source/cmCacheManager.cxx +++ b/Source/cmCacheManager.cxx @@ -620,7 +620,7 @@ bool cmCacheManager::CacheIterator::GetValueAsBool() const std::vector 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 036a07d..de0f371 100644 --- a/Source/cmGeneratorTarget.cxx +++ b/Source/cmGeneratorTarget.cxx @@ -5032,13 +5032,7 @@ void cmGeneratorTarget::ComputeVersionedName(std::string& vName, std::vector cmGeneratorTarget::GetPropertyKeys() const { - cmPropertyMap const& propsObject = this->Target->GetProperties(); - std::vector 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 3f6d7c8..a97e1f0 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 #include #include @@ -18,16 +17,6 @@ cmProperty* cmPropertyMap::GetOrCreateProperty(const std::string& name) return prop; } -std::vector cmPropertyMap::GetPropertyList() const -{ - std::vector 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 cmPropertyMap::GetKeys() const +{ + std::vector 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 5a05150..5c93627 100644 --- a/Source/cmPropertyMap.h +++ b/Source/cmPropertyMap.h @@ -14,16 +14,19 @@ class cmPropertyMap : public std::map { public: + // -- Properties 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, bool asString = false); const char* GetPropertyValue(const std::string& name) const; + + // -- Lists + //! Get a sorted list of property keys + std::vector GetKeys() const; }; #endif diff --git a/Source/cmStateDirectory.cxx b/Source/cmStateDirectory.cxx index 182d3fe..6ca1c9f 100644 --- a/Source/cmStateDirectory.cxx +++ b/Source/cmStateDirectory.cxx @@ -6,7 +6,6 @@ #include #include #include -#include #include "cmAlgorithms.h" #include "cmProperty.h" @@ -667,12 +666,7 @@ bool cmStateDirectory::GetPropertyAsBool(const std::string& prop) const std::vector cmStateDirectory::GetPropertyKeys() const { - std::vector 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) -- cgit v0.12