diff options
Diffstat (limited to 'src/common/settings_common.h')
| -rw-r--r-- | src/common/settings_common.h | 78 |
1 files changed, 78 insertions, 0 deletions
diff --git a/src/common/settings_common.h b/src/common/settings_common.h new file mode 100644 index 000000000..93fddeba6 --- /dev/null +++ b/src/common/settings_common.h | |||
| @@ -0,0 +1,78 @@ | |||
| 1 | #pragma once | ||
| 2 | |||
| 3 | #include <forward_list> | ||
| 4 | #include <functional> | ||
| 5 | #include <map> | ||
| 6 | #include <string> | ||
| 7 | #include <typeindex> | ||
| 8 | #include "common/common_types.h" | ||
| 9 | |||
| 10 | namespace Settings { | ||
| 11 | |||
| 12 | enum class Category : u32 { | ||
| 13 | Audio, | ||
| 14 | Core, | ||
| 15 | Cpu, | ||
| 16 | CpuDebug, | ||
| 17 | CpuUnsafe, | ||
| 18 | Renderer, | ||
| 19 | RendererAdvanced, | ||
| 20 | RendererDebug, | ||
| 21 | System, | ||
| 22 | SystemAudio, | ||
| 23 | DataStorage, | ||
| 24 | Debugging, | ||
| 25 | DebuggingGraphics, | ||
| 26 | Miscellaneous, | ||
| 27 | Network, | ||
| 28 | WebService, | ||
| 29 | AddOns, | ||
| 30 | Controls, | ||
| 31 | Ui, | ||
| 32 | UiGeneral, | ||
| 33 | UiLayout, | ||
| 34 | UiGameList, | ||
| 35 | Screenshots, | ||
| 36 | Shortcuts, | ||
| 37 | Multiplayer, | ||
| 38 | Services, | ||
| 39 | Paths, | ||
| 40 | MaxEnum, | ||
| 41 | }; | ||
| 42 | |||
| 43 | class BasicSetting { | ||
| 44 | protected: | ||
| 45 | explicit BasicSetting() = default; | ||
| 46 | |||
| 47 | public: | ||
| 48 | virtual ~BasicSetting() = default; | ||
| 49 | |||
| 50 | virtual Category Category() const = 0; | ||
| 51 | virtual constexpr bool Switchable() const = 0; | ||
| 52 | virtual std::string ToString() const = 0; | ||
| 53 | virtual std::string ToStringGlobal() const; | ||
| 54 | virtual void LoadString(const std::string& load) = 0; | ||
| 55 | virtual std::string Canonicalize() const = 0; | ||
| 56 | virtual const std::string& GetLabel() const = 0; | ||
| 57 | virtual std::string DefaultToString() const = 0; | ||
| 58 | virtual bool Save() const = 0; | ||
| 59 | virtual std::type_index TypeId() const = 0; | ||
| 60 | virtual constexpr bool IsEnum() const = 0; | ||
| 61 | virtual bool RuntimeModfiable() const = 0; | ||
| 62 | virtual void SetGlobal(bool global) {} | ||
| 63 | virtual constexpr u32 Id() const = 0; | ||
| 64 | virtual std::string MinVal() const = 0; | ||
| 65 | virtual std::string MaxVal() const = 0; | ||
| 66 | virtual bool UsingGlobal() const; | ||
| 67 | }; | ||
| 68 | |||
| 69 | class Linkage { | ||
| 70 | public: | ||
| 71 | explicit Linkage(u32 initial_count = 0); | ||
| 72 | ~Linkage(); | ||
| 73 | std::map<Category, std::forward_list<BasicSetting*>> by_category{}; | ||
| 74 | std::vector<std::function<void()>> restore_functions{}; | ||
| 75 | u32 count; | ||
| 76 | }; | ||
| 77 | |||
| 78 | } // namespace Settings | ||