Skip to content

Commit 96068d9

Browse files
committed
SimpCfg: Add support for boolean fields wrt key-value
1 parent cd7d369 commit 96068d9

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

common/simpcfg.hpp

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ void sc_load(std::string &fname) {
7474
curL = str_trim(curL);
7575
if (bGroup) {
7676
group = curL;
77-
LOG_TEELN("DBUG:%s:%s", __func__, group.c_str());
77+
LOG_TEELN("DBUG:%s:group:%s", __func__, group.c_str());
7878
continue;
7979
}
8080
auto dPos = curL.find(':');
@@ -91,8 +91,12 @@ void sc_load(std::string &fname) {
9191
key = str_trim(key);
9292
std::string value = curL.substr(dPos+1);
9393
value = str_trim(value);
94-
LOG_TEELN("DBUG:%s:%s:%s:%s", __func__, group.c_str(), key.c_str(), value.c_str());
95-
sc_set_string(group, key, value);
94+
LOG_TEELN("DBUG:%s:kv:%s:%s:%s", __func__, group.c_str(), key.c_str(), value.c_str());
95+
if ((value == "true") || (value == "false")) {
96+
sc_set_bool(group, key, value == "true" ? true : false);
97+
} else {
98+
sc_set_string(group, key, value);
99+
}
96100
}
97101
}
98102

0 commit comments

Comments
 (0)