summaryrefslogtreecommitdiffstats
path: root/Source/CTest/cmCTestGenericHandler.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'Source/CTest/cmCTestGenericHandler.cxx')
-rw-r--r--Source/CTest/cmCTestGenericHandler.cxx30
1 files changed, 26 insertions, 4 deletions
diff --git a/Source/CTest/cmCTestGenericHandler.cxx b/Source/CTest/cmCTestGenericHandler.cxx
index 48cc0e4..9800192 100644
--- a/Source/CTest/cmCTestGenericHandler.cxx
+++ b/Source/CTest/cmCTestGenericHandler.cxx
@@ -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, cmValue 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, cmValue 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,
+ cmValue value)
+{
+ this->SetOption(op, value);
+ SetMapValue(this->PersistentOptions, op, value);
+}
void cmCTestGenericHandler::AddMultiOption(const std::string& op,
const std::string& value)
@@ -72,13 +94,13 @@ void cmCTestGenericHandler::Initialize()
this->MultiOptions = this->PersistentMultiOptions;
}
-const char* cmCTestGenericHandler::GetOption(const std::string& op)
+cmValue cmCTestGenericHandler::GetOption(const std::string& op)
{
auto remit = this->Options.find(op);
if (remit == this->Options.end()) {
return nullptr;
}
- return remit->second.c_str();
+ return cmValue(remit->second);
}
std::vector<std::string> cmCTestGenericHandler::GetMultiOption(