summaryrefslogtreecommitdiffstats
path: root/Source/cmPropertyMap.cxx
diff options
context:
space:
mode:
authorSebastian Holtermann <sebholt@xwmw.org>2019-06-02 11:34:31 (GMT)
committerSebastian Holtermann <sebholt@xwmw.org>2019-06-08 10:25:35 (GMT)
commit8d934d861be8c2a8b43d4c421715fb1e8c0c54fd (patch)
tree35ff59319c575fc206915fad3b02335066af0750 /Source/cmPropertyMap.cxx
parent026f65d284deaea9f2dba41ed956fabf84e17b6d (diff)
downloadCMake-8d934d861be8c2a8b43d4c421715fb1e8c0c54fd.zip
CMake-8d934d861be8c2a8b43d4c421715fb1e8c0c54fd.tar.gz
CMake-8d934d861be8c2a8b43d4c421715fb1e8c0c54fd.tar.bz2
cmPropertyMap: Make std::map container private
Diffstat (limited to 'Source/cmPropertyMap.cxx')
-rw-r--r--Source/cmPropertyMap.cxx40
1 files changed, 15 insertions, 25 deletions
diff --git a/Source/cmPropertyMap.cxx b/Source/cmPropertyMap.cxx
index 09b30ba..7177a63 100644
--- a/Source/cmPropertyMap.cxx
+++ b/Source/cmPropertyMap.cxx
@@ -2,30 +2,21 @@
file Copyright.txt or https://cmake.org/licensing for details. */
#include "cmPropertyMap.h"
-#include <assert.h>
#include <utility>
-cmProperty* cmPropertyMap::GetOrCreateProperty(const std::string& name)
+void cmPropertyMap::Clear()
{
- cmPropertyMap::iterator it = this->find(name);
- cmProperty* prop;
- if (it == this->end()) {
- prop = &(*this)[name];
- } else {
- prop = &(it->second);
- }
- return prop;
+ Map_.clear();
}
void cmPropertyMap::SetProperty(const std::string& name, const char* value)
{
if (!value) {
- this->erase(name);
+ Map_.erase(name);
return;
}
- cmProperty* prop = this->GetOrCreateProperty(name);
- prop->Set(value);
+ Map_[name].Set(value);
}
void cmPropertyMap::AppendProperty(const std::string& name, const char* value,
@@ -36,26 +27,25 @@ void cmPropertyMap::AppendProperty(const std::string& name, const char* value,
return;
}
- cmProperty* prop = this->GetOrCreateProperty(name);
- prop->Append(value, asString);
+ Map_[name].Append(value, asString);
}
const char* cmPropertyMap::GetPropertyValue(const std::string& name) const
{
- assert(!name.empty());
-
- cmPropertyMap::const_iterator it = this->find(name);
- if (it == this->end()) {
- return nullptr;
+ {
+ auto it = Map_.find(name);
+ if (it != Map_.end()) {
+ return it->second.GetValue();
+ }
}
- return it->second.GetValue();
+ return nullptr;
}
std::vector<std::string> cmPropertyMap::GetKeys() const
{
std::vector<std::string> keyList;
- keyList.reserve(this->size());
- for (auto const& item : *this) {
+ keyList.reserve(Map_.size());
+ for (auto const& item : Map_) {
keyList.push_back(item.first);
}
return keyList;
@@ -64,8 +54,8 @@ std::vector<std::string> cmPropertyMap::GetKeys() const
std::vector<std::pair<std::string, std::string>> cmPropertyMap::GetList() const
{
std::vector<std::pair<std::string, std::string>> kvList;
- kvList.reserve(this->size());
- for (auto const& item : *this) {
+ kvList.reserve(Map_.size());
+ for (auto const& item : Map_) {
kvList.emplace_back(item.first, item.second.GetValue());
}
return kvList;