mirror of
https://gitea.tendokyu.moe/beerpsi/segatools-configurator.git
synced 2024-12-18 01:35:54 +01:00
72 lines
1.7 KiB
C
72 lines
1.7 KiB
C
|
//
|
||
|
// Created by beerpsi on 4/13/2024.
|
||
|
//
|
||
|
|
||
|
#ifndef SEGATOOLS_CONFIGURATOR_OPTION_H
|
||
|
#define SEGATOOLS_CONFIGURATOR_OPTION_H
|
||
|
|
||
|
#include <memory>
|
||
|
#include <string>
|
||
|
#include <vector>
|
||
|
|
||
|
#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<std::pair<std::string, std::string>> 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<std::vector<Option>> parse_options();
|
||
|
|
||
|
|
||
|
#endif //SEGATOOLS_CONFIGURATOR_OPTION_H
|