Merge topic 'remove_property'

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

Acked-by: Kitware Robot <kwrobot@kitware.com>
Acked-by: buildbot <buildbot@kitware.com>
Reviewed-by: Ben Boeckel <ben.boeckel@kitware.com>
Merge-request: !8721
This commit is contained in:
Brad King
2023-08-16 14:03:47 +00:00
committed by Kitware Robot
7 changed files with 10 additions and 18 deletions

View File

@@ -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);
}

View File

@@ -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);
}
}

View File

@@ -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);
}
}

View File

@@ -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) {

View File

@@ -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)
{

View File

@@ -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);
}

View File

@@ -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 });
}