22 auto l_toLower = [](
char c) ->
char {
return (c >=
'A' && c <=
'Z' ? c + 0x20 : c); };
23 std::string argLower = arg;
24 std::transform(arg.begin(), arg.end(), argLower.begin(), l_toLower);
25 if (argLower ==
"false") {
27 }
else if (argLower ==
"true") {
29 }
else if (argLower ==
"unset") {
32 throw std::invalid_argument(
"Invalid value for OptionalBool: " + arg);
44 : throw
std::invalid_argument(
"Invalid value for OptionalBool: " +
std::
to_string(arg) +
45 "\nAccepted values are 0 or 1")) {}
57 :
throw std::invalid_argument(
"Invalid value for OptionalBool: " +
std::to_string(arg) +
58 "\nAccepted values are 0 or 1");
85 std::map<OptionalBool::Value, std::string> map;
87 for (
auto &oppositePair : opposite) {
88 map.emplace(oppositePair.second, oppositePair.first);
99 const auto enumValue =
value.getValue();
101 return Json::Value(
true);
103 return Json::Value(
false);
105 return Json::Value();
109namespace pwvjdetail {
double value
The value of the point.
OptionalBool : Tri-state bool.
static std::map< Value, std::string > enumToStrMap()
Value Validate(const std::string &arg)
bool operator==(const OptionalBool &other) const
bool operator!=(const OptionalBool &other) const
static const std::string StrUnset
static std::map< std::string, Value > strToEnumMap()
static const std::string StrFalse
static const std::string StrTrue
OptionalBool & operator=(const OptionalBool &other)=default
MANTID_KERNEL_DLL std::ostream & operator<<(std::ostream &, CPUTimer &)
Convenience function to provide for easier debug printing.
MANTID_KERNEL_DLL std::istream & operator>>(std::istream &, Interpolation &)
Reads in parameter value.
MANTID_KERNEL_DLL::Json::Value encodeAsJson(const OptionalBool &)
Encode an OptionalBool as a Json::Value.
std::string to_string(const wide_integer< Bits, Signed > &n)
T operator()(const Json::Value &)