mirror of
https://github.com/Kitware/CMake.git
synced 2026-01-11 16:32:14 -06:00
cmCTestGenericHandler::SetOption accepts cmProp or std::string
This commit is contained in:
@@ -21,11 +21,12 @@ cmCTestGenericHandler::cmCTestGenericHandler()
|
||||
|
||||
cmCTestGenericHandler::~cmCTestGenericHandler() = default;
|
||||
|
||||
namespace {
|
||||
/* Modify the given `map`, setting key `op` to `value` if `value`
|
||||
* is non-null, otherwise removing key `op` (if it exists).
|
||||
*/
|
||||
static void SetMapValue(cmCTestGenericHandler::t_StringToString& map,
|
||||
const std::string& op, const char* value)
|
||||
void SetMapValue(cmCTestGenericHandler::t_StringToString& map,
|
||||
const std::string& op, const char* value)
|
||||
{
|
||||
if (!value) {
|
||||
map.erase(op);
|
||||
@@ -34,11 +35,26 @@ static void SetMapValue(cmCTestGenericHandler::t_StringToString& map,
|
||||
|
||||
map[op] = value;
|
||||
}
|
||||
void SetMapValue(cmCTestGenericHandler::t_StringToString& map,
|
||||
const std::string& op, cmProp value)
|
||||
{
|
||||
if (!value) {
|
||||
map.erase(op);
|
||||
return;
|
||||
}
|
||||
|
||||
map[op] = *value;
|
||||
}
|
||||
}
|
||||
|
||||
void cmCTestGenericHandler::SetOption(const std::string& op, const char* value)
|
||||
{
|
||||
SetMapValue(this->Options, op, value);
|
||||
}
|
||||
void cmCTestGenericHandler::SetOption(const std::string& op, cmProp value)
|
||||
{
|
||||
SetMapValue(this->Options, op, value);
|
||||
}
|
||||
|
||||
void cmCTestGenericHandler::SetPersistentOption(const std::string& op,
|
||||
const char* value)
|
||||
@@ -46,6 +62,12 @@ void cmCTestGenericHandler::SetPersistentOption(const std::string& op,
|
||||
this->SetOption(op, value);
|
||||
SetMapValue(this->PersistentOptions, op, value);
|
||||
}
|
||||
void cmCTestGenericHandler::SetPersistentOption(const std::string& op,
|
||||
cmProp value)
|
||||
{
|
||||
this->SetOption(op, value);
|
||||
SetMapValue(this->PersistentOptions, op, value);
|
||||
}
|
||||
|
||||
void cmCTestGenericHandler::AddMultiOption(const std::string& op,
|
||||
const std::string& value)
|
||||
|
||||
@@ -87,7 +87,17 @@ public:
|
||||
* as a multi-value will return nullptr.
|
||||
*/
|
||||
void SetPersistentOption(const std::string& op, const char* value);
|
||||
void SetPersistentOption(const std::string& op, const std::string& value)
|
||||
{
|
||||
this->SetPersistentOption(op, cmProp(value));
|
||||
}
|
||||
void SetPersistentOption(const std::string& op, cmProp value);
|
||||
void SetOption(const std::string& op, const char* value);
|
||||
void SetOption(const std::string& op, const std::string& value)
|
||||
{
|
||||
this->SetOption(op, cmProp(value));
|
||||
}
|
||||
void SetOption(const std::string& op, cmProp value);
|
||||
cmProp GetOption(const std::string& op);
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user