From 49e9add3bb67d36dae6d2d21c3050eb9768b9cee Mon Sep 17 00:00:00 2001 From: Mr-Wiseguy Date: Thu, 1 Jan 2026 18:54:58 -0500 Subject: [PATCH] Add function to check if option is present in config --- librecomp/include/librecomp/config.hpp | 1 + librecomp/src/config.cpp | 4 ++++ 2 files changed, 5 insertions(+) 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()) {