summaryrefslogtreecommitdiffstats
path: root/Source
diff options
context:
space:
mode:
authorSebastian Holtermann <sebholt@xwmw.org>2019-06-03 07:26:59 (GMT)
committerSebastian Holtermann <sebholt@xwmw.org>2019-06-08 10:25:35 (GMT)
commite0a8ff31480df672e42e2382e8ed7f33ea65afb4 (patch)
treeb7a7b0e3d27d9d7c8d7c84e9f1a7ba4956e1d671 /Source
parent8d934d861be8c2a8b43d4c421715fb1e8c0c54fd (diff)
downloadCMake-e0a8ff31480df672e42e2382e8ed7f33ea65afb4.zip
CMake-e0a8ff31480df672e42e2382e8ed7f33ea65afb4.tar.gz
CMake-e0a8ff31480df672e42e2382e8ed7f33ea65afb4.tar.bz2
cmPropertyMap: Use std::string as value container class
Diffstat (limited to 'Source')
-rw-r--r--Source/CMakeLists.txt1
-rw-r--r--Source/cmExportFileGenerator.cxx1
-rw-r--r--Source/cmJsonObjects.cxx1
-rw-r--r--Source/cmProperty.cxx26
-rw-r--r--Source/cmProperty.h18
-rw-r--r--Source/cmPropertyMap.cxx14
-rw-r--r--Source/cmPropertyMap.h4
-rw-r--r--Source/cmTestGenerator.cxx1
8 files changed, 11 insertions, 55 deletions
diff --git a/Source/CMakeLists.txt b/Source/CMakeLists.txt
index 695e075..67bc598 100644
--- a/Source/CMakeLists.txt
+++ b/Source/CMakeLists.txt
@@ -338,7 +338,6 @@ set(SRCS
cmProcessOutput.h
cmProcessTools.cxx
cmProcessTools.h
- cmProperty.cxx
cmProperty.h
cmPropertyDefinition.cxx
cmPropertyDefinition.h
diff --git a/Source/cmExportFileGenerator.cxx b/Source/cmExportFileGenerator.cxx
index 6621797..c366183 100644
--- a/Source/cmExportFileGenerator.cxx
+++ b/Source/cmExportFileGenerator.cxx
@@ -12,7 +12,6 @@
#include "cmMessageType.h"
#include "cmOutputConverter.h"
#include "cmPolicies.h"
-#include "cmProperty.h"
#include "cmPropertyMap.h"
#include "cmStateTypes.h"
#include "cmSystemTools.h"
diff --git a/Source/cmJsonObjects.cxx b/Source/cmJsonObjects.cxx
index 657d681..8d065e1 100644
--- a/Source/cmJsonObjects.cxx
+++ b/Source/cmJsonObjects.cxx
@@ -14,7 +14,6 @@
#include "cmLinkLineComputer.h"
#include "cmLocalGenerator.h"
#include "cmMakefile.h"
-#include "cmProperty.h"
#include "cmPropertyMap.h"
#include "cmSourceFile.h"
#include "cmState.h"
diff --git a/Source/cmProperty.cxx b/Source/cmProperty.cxx
deleted file mode 100644
index 27f0ecd..0000000
--- a/Source/cmProperty.cxx
+++ /dev/null
@@ -1,26 +0,0 @@
-/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
-#include "cmProperty.h"
-
-void cmProperty::Set(const char* value)
-{
- this->Value = value;
- this->ValueHasBeenSet = true;
-}
-
-void cmProperty::Append(const char* value, bool asString)
-{
- if (!this->Value.empty() && *value && !asString) {
- this->Value += ";";
- }
- this->Value += value;
- this->ValueHasBeenSet = true;
-}
-
-const char* cmProperty::GetValue() const
-{
- if (this->ValueHasBeenSet) {
- return this->Value.c_str();
- }
- return nullptr;
-}
diff --git a/Source/cmProperty.h b/Source/cmProperty.h
index d11c5ef..80f131a 100644
--- a/Source/cmProperty.h
+++ b/Source/cmProperty.h
@@ -5,8 +5,6 @@
#include "cmConfigure.h" // IWYU pragma: keep
-#include <string>
-
class cmProperty
{
public:
@@ -22,22 +20,6 @@ public:
CACHED_VARIABLE,
INSTALL
};
-
- // set this property
- void Set(const char* value);
-
- // append to this property
- void Append(const char* value, bool asString = false);
-
- // get the value
- const char* GetValue() const;
-
- // construct with the value not set
- cmProperty() { this->ValueHasBeenSet = false; }
-
-protected:
- std::string Value;
- bool ValueHasBeenSet;
};
#endif
diff --git a/Source/cmPropertyMap.cxx b/Source/cmPropertyMap.cxx
index 7177a63..0874977 100644
--- a/Source/cmPropertyMap.cxx
+++ b/Source/cmPropertyMap.cxx
@@ -16,7 +16,7 @@ void cmPropertyMap::SetProperty(const std::string& name, const char* value)
return;
}
- Map_[name].Set(value);
+ Map_[name] = value;
}
void cmPropertyMap::AppendProperty(const std::string& name, const char* value,
@@ -27,7 +27,13 @@ void cmPropertyMap::AppendProperty(const std::string& name, const char* value,
return;
}
- Map_[name].Append(value, asString);
+ {
+ std::string& pVal = Map_[name];
+ if (!pVal.empty() && !asString) {
+ pVal += ';';
+ }
+ pVal += value;
+ }
}
const char* cmPropertyMap::GetPropertyValue(const std::string& name) const
@@ -35,7 +41,7 @@ const char* cmPropertyMap::GetPropertyValue(const std::string& name) const
{
auto it = Map_.find(name);
if (it != Map_.end()) {
- return it->second.GetValue();
+ return it->second.c_str();
}
}
return nullptr;
@@ -56,7 +62,7 @@ std::vector<std::pair<std::string, std::string>> cmPropertyMap::GetList() const
std::vector<std::pair<std::string, std::string>> kvList;
kvList.reserve(Map_.size());
for (auto const& item : Map_) {
- kvList.emplace_back(item.first, item.second.GetValue());
+ kvList.emplace_back(item.first, item.second);
}
return kvList;
}
diff --git a/Source/cmPropertyMap.h b/Source/cmPropertyMap.h
index 4fcbf58..165eb92 100644
--- a/Source/cmPropertyMap.h
+++ b/Source/cmPropertyMap.h
@@ -5,8 +5,6 @@
#include "cmConfigure.h" // IWYU pragma: keep
-#include "cmProperty.h"
-
#include <map>
#include <string>
#include <utility>
@@ -35,7 +33,7 @@ public:
std::vector<std::pair<std::string, std::string>> GetList() const;
private:
- std::map<std::string, cmProperty> Map_;
+ std::map<std::string, std::string> Map_;
};
#endif
diff --git a/Source/cmTestGenerator.cxx b/Source/cmTestGenerator.cxx
index 3840e50..174fb8a 100644
--- a/Source/cmTestGenerator.cxx
+++ b/Source/cmTestGenerator.cxx
@@ -10,7 +10,6 @@
#include "cmListFileCache.h"
#include "cmLocalGenerator.h"
#include "cmOutputConverter.h"
-#include "cmProperty.h"
#include "cmPropertyMap.h"
#include "cmRange.h"
#include "cmStateTypes.h"