SimpCfg:Cleanup:Cmdline Arg, GetValueCallerLogging, StringCmp

Bring the direct string comparison also back, as the issue with
cmp was more to do with string.transform.
This commit is contained in:
HanishKVC 2024-05-01 16:40:24 +05:30
parent 08b9711d68
commit 8fdc80533f

View file

@ -163,7 +163,7 @@ public:
return defaultValue; return defaultValue;
} }
auto value = gm[key]; auto value = gm[key];
LDBUG_LN("DBUG:SC:%s:%s:%s:%s", __func__, group.c_str(), key.c_str(), to_str(value).c_str()); LDBUG_LN("DBUG:SC:%s_%s:%s:%s:%s", __func__, callerName.c_str(), group.c_str(), key.c_str(), to_str(value).c_str());
return std::get<SupportedDataType>(value); return std::get<SupportedDataType>(value);
} }
@ -229,7 +229,7 @@ public:
value = str_trim(value, ","); value = str_trim(value, ",");
std::string vtype = "bool"; std::string vtype = "bool";
auto valueLower = str_tolower(value); auto valueLower = str_tolower(value);
if ((valueLower.compare("true") == 0) || (valueLower.compare("false") == 0)) { if ((valueLower.compare("true") == 0) || (valueLower == "false")) {
set_bool(group, key, value); set_bool(group, key, value);
} else if (std::regex_match(value, rInt)) { } else if (std::regex_match(value, rInt)) {
vtype = "int"; vtype = "int";
@ -254,6 +254,10 @@ public:
#ifdef SC_TEST_PRG #ifdef SC_TEST_PRG
int main(int argc, char **argv) { int main(int argc, char **argv) {
if (argc != 2) {
LERRR_LN("USAGE:%s simp.cfg", argv[0]);
exit(1);
}
std::string fname {argv[1]}; std::string fname {argv[1]};
SimpCfg sc; SimpCfg sc;
sc.load(fname); sc.load(fname);