// // Created by beerpsi on 4/13/2024. // #ifndef SEGATOOLS_CONFIGURATOR_OPTION_H #define SEGATOOLS_CONFIGURATOR_OPTION_H #include #include #include #include "games/io.h" enum class OptionType { Bool, Text, Integer, Enum, }; struct OptionDefinition { std::string title; std::string section; std::string key; std::string desc; OptionType type; std::string default_value; int max_string_length = 1; bool hidden = false; std::string setting_name; std::string game_name; games::HWFamily hw_family = games::HW_FAMILY_UNKNOWN; std::string category = "Development"; bool sensitive = false; std::vector> elements = {}; }; class Option { private: OptionDefinition definition; public: std::string value; bool disabled = false; explicit Option(OptionDefinition definition, std::string value = "") : definition(std::move(definition)), value(std::move(value)) {}; [[nodiscard]] inline const OptionDefinition &get_definition() const { return this->definition; } inline void set_definition(OptionDefinition def) { this->definition = std::move(def); } inline bool is_active() const { return !this->value.empty(); } void value_set(std::string new_value); [[nodiscard]] bool value_bool() const; [[nodiscard]] const std::string &value_text() const; [[nodiscard]] int value_int() const; void update_config() const; }; std::unique_ptr> parse_options(); #endif //SEGATOOLS_CONFIGURATOR_OPTION_H