Răsfoiți Sursa

Merge topic 'remove_property'

822203dd65 Source: Rename SetProperty(nullptr_t) to RemoveProperty()

Acked-by: Kitware Robot <[email protected]>
Acked-by: buildbot <[email protected]>
Reviewed-by: Ben Boeckel <[email protected]>
Merge-request: !8721
Brad King 2 ani în urmă
părinte
comite
c754f0d263

+ 2 - 2
Source/cmCPluginAPI.cxx

@@ -628,8 +628,8 @@ static void CCONV cmSourceFileSetProperty(void* arg, const char* prop,
 {
   cmCPluginAPISourceFile* sf = static_cast<cmCPluginAPISourceFile*>(arg);
   if (cmSourceFile* rsf = sf->RealSourceFile) {
-    if (value == nullptr) {
-      rsf->SetProperty(prop, nullptr);
+    if (!value) {
+      rsf->RemoveProperty(prop);
     } else {
       rsf->SetProperty(prop, value);
     }

+ 3 - 4
Source/cmCacheManager.cxx

@@ -597,15 +597,14 @@ void cmCacheManager::CacheEntry::SetProperty(const std::string& p, bool v)
   this->SetProperty(p, v ? std::string{ "ON" } : std::string{ "OFF" });
 }
 
-void cmCacheManager::CacheEntry::SetProperty(const std::string& prop,
-                                             std::nullptr_t)
+void cmCacheManager::CacheEntry::RemoveProperty(const std::string& prop)
 {
   if (prop == "TYPE") {
     this->Type = cmState::StringToCacheEntryType("STRING");
   } else if (prop == "VALUE") {
-    this->Value = "";
+    this->Value.clear();
   } else {
-    this->Properties.SetProperty(prop, cmValue{ nullptr });
+    this->Properties.RemoveProperty(prop);
   }
 }
 

+ 2 - 2
Source/cmCacheManager.h

@@ -41,7 +41,7 @@ class cmCacheManager
     bool GetPropertyAsBool(const std::string& property) const;
     void SetProperty(const std::string& property, const std::string& value);
     void SetProperty(const std::string& property, bool value);
-    void SetProperty(const std::string& property, std::nullptr_t);
+    void RemoveProperty(const std::string& property);
     void AppendProperty(const std::string& property, const std::string& value,
                         bool asString = false);
 
@@ -144,7 +144,7 @@ public:
                                 std::string const& propName)
   {
     if (auto* entry = this->GetCacheEntry(key)) {
-      entry->SetProperty(propName, nullptr);
+      entry->RemoveProperty(propName);
     }
   }
 

+ 0 - 4
Source/cmPropertyMap.cxx

@@ -10,10 +10,6 @@ void cmPropertyMap::Clear()
   this->Map_.clear();
 }
 
-void cmPropertyMap::SetProperty(const std::string& name, std::nullptr_t)
-{
-  this->Map_.erase(name);
-}
 void cmPropertyMap::SetProperty(const std::string& name, cmValue value)
 {
   if (!value) {

+ 0 - 2
Source/cmPropertyMap.h

@@ -4,7 +4,6 @@
 
 #include "cmConfigure.h" // IWYU pragma: keep
 
-#include <cstddef>
 #include <string>
 #include <unordered_map>
 #include <utility>
@@ -26,7 +25,6 @@ public:
   // -- Properties
 
   //! Set the property value
-  void SetProperty(const std::string& name, std::nullptr_t);
   void SetProperty(const std::string& name, cmValue value);
   void SetProperty(const std::string& name, const std::string& value)
   {

+ 2 - 2
Source/cmSetPropertyCommand.cxx

@@ -348,7 +348,7 @@ bool HandleAndValidateSourceFilePropertyGENERATED(
         sf->AppendProperty("GENERATED", propertyValue, true);
         break;
       case PropertyOp::Remove:
-        sf->SetProperty("GENERATED", nullptr);
+        sf->RemoveProperty("GENERATED");
         break;
       case PropertyOp::Set:
         sf->SetProperty("GENERATED", propertyValue);
@@ -703,7 +703,7 @@ bool HandleSource(cmSourceFile* sf, const std::string& propertyName,
     sf->AppendProperty(propertyName, propertyValue, appendAsString);
   } else {
     if (remove) {
-      sf->SetProperty(propertyName, nullptr);
+      sf->RemoveProperty(propertyName);
     } else {
       sf->SetProperty(propertyName, propertyValue);
     }

+ 1 - 2
Source/cmSourceFile.h

@@ -4,7 +4,6 @@
 
 #include "cmConfigure.h" // IWYU pragma: keep
 
-#include <cstddef>
 #include <memory>
 #include <string>
 #include <vector>
@@ -43,7 +42,7 @@ public:
 
   //! Set/Get a property of this source file
   void SetProperty(const std::string& prop, cmValue value);
-  void SetProperty(const std::string& prop, std::nullptr_t)
+  void RemoveProperty(const std::string& prop)
   {
     this->SetProperty(prop, cmValue{ nullptr });
   }