settings: Define specializations for settings

Suggests to a frontend how to represent each setting.
This commit is contained in:
lat9nq 2023-06-21 03:23:36 -04:00
parent ad645c29a4
commit b2438f1fb7
4 changed files with 130 additions and 64 deletions

View file

@ -43,6 +43,17 @@ enum class Category : u32 {
MaxEnum,
};
enum class Specialization : u32 {
Default,
Time,
Hex,
List,
RuntimeList,
Scalar,
Countable,
Paired,
};
bool IsConfiguringGlobal();
void SetConfiguringGlobal(bool is_global);
@ -64,7 +75,7 @@ public:
class BasicSetting {
protected:
explicit BasicSetting(Linkage& linkage, const std::string& name, enum Category category_,
bool save_, bool runtime_modifiable_);
bool save_, bool runtime_modifiable_, Specialization spec);
public:
virtual ~BasicSetting();
@ -180,6 +191,11 @@ public:
*/
[[nodiscard]] enum Category Category() const;
/**
* @returns Extra metadata for data representation in frontend implementations.
*/
[[nodiscard]] enum Specialization Specialization() const;
/**
* Returns the label this setting was created with.
*
@ -219,6 +235,8 @@ private:
const bool save; ///< Suggests if the setting should be saved and read to a frontend config
const bool
runtime_modifiable; ///< Suggests if the setting can be modified while a guest is running
const enum Specialization
specialization; ///< Extra data to identify representation of a setting
};
} // namespace Settings