Use 1/0 instead of true/false.
bool operator!=(const char*) const;
void set_combo(std::vector<std::string> newComboValues);
void set_default(std::string newDefault);
+ const std::string get_type() const;
private:
friend std::ostream& operator<<(std::ostream&, const OptionsMap&);
const Option& o = it.second;
os << "\nfeature option=\"" << it.first << " -" << o.type;
- if (o.type == "string" || o.type == "check" || o.type == "combo")
+ if (o.type == "string" || o.type == "combo")
os << " " << o.defaultValue;
+ else if (o.type == "check")
+ os << " " << int(o.defaultValue == "true");
if (o.type == "combo")
for (string value : o.comboValues)
defaultValue = currentValue = newDefault;
}
+const std::string Option::get_type() const {
+ return type;
+}
+
} // namespace UCI
std::getline(is, name, '=');
std::getline(is, value);
if (Options.count(name))
+ {
+ if (Options[name].get_type() == "check")
+ value = value == "1" ? "true" : "false";
Options[name] = value;
+ }
}
else if (token == "analyze")
{