Add function to check if option is present in config

This commit is contained in:
Mr-Wiseguy 2026-01-01 18:54:58 -05:00
parent ae5e92303f
commit 49e9add3bb
2 changed files with 5 additions and 0 deletions

View file

@ -249,6 +249,7 @@ namespace recomp {
return std::get<T>(get_option(option_index).variant);
};
bool has_option(const std::string& option_id) const;
const ConfigValueVariant get_option_value(const std::string& option_id) const;
const ConfigValueVariant get_temp_option_value(const std::string& option_id) const;
// This should only be used internally to recompui. Other changes to values should be done through update_option_value

View file

@ -276,6 +276,10 @@ const ConfigOption &Config::get_option(const std::string& option_id) const {
return schema.options[option_by_id_it->second];
}
bool Config::has_option(const std::string& option_id) const {
return schema.options_by_id.contains(option_id);
}
const ConfigValueVariant Config::get_option_value_from_storage(const std::string& option_id, const ConfigStorage& src) const {
auto it = src.value_map.find(option_id);
if (it != src.value_map.end()) {