diff --git a/librecomp/include/librecomp/config.hpp b/librecomp/include/librecomp/config.hpp index 59231c1..a1086cf 100644 --- a/librecomp/include/librecomp/config.hpp +++ b/librecomp/include/librecomp/config.hpp @@ -249,6 +249,7 @@ namespace recomp { return std::get(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 diff --git a/librecomp/src/config.cpp b/librecomp/src/config.cpp index e493983..bbb6794 100644 --- a/librecomp/src/config.cpp +++ b/librecomp/src/config.cpp @@ -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()) {