29class ProcessSettingsControl;
63 virtual std::vector<SettingBase*> Enumerate(std::string_view scope = {})
const = 0;
70 virtual std::vector<ConsoleCommand*> EnumerateCommands(std::string_view scope = {})
const = 0;
77 [[nodiscard]]
virtual Result<void> SetText(std::string_view name, std::string_view text) = 0;
87 std::string_view text) = 0;
95 virtual void AddAlias(std::string_view old_name, std::string_view new_name) = 0;
103 [[nodiscard]]
virtual bool IsAlias(std::string_view name)
const = 0;
108 [[nodiscard]]
virtual Result<void> Reset(std::string_view name) = 0;
115 [[nodiscard]]
virtual Result<void> Run(std::string_view name, std::string_view args) = 0;
118 virtual std::vector<std::string> GetRestartPending()
const = 0;
125 [[nodiscard]]
virtual Result<void> Save(
const std::filesystem::path& file)
const = 0;
133 [[nodiscard]]
virtual Result<void> Load(
const std::filesystem::path& file,
147 std::vector<SettingBase*>
Enumerate(std::string_view scope = {})
const override;
154 std::string_view text)
override;
156 void AddAlias(std::string_view old_name, std::string_view new_name)
override;
158 [[nodiscard]]
bool IsAlias(std::string_view name)
const override;
162 [[nodiscard]]
Result<void> Run(std::string_view name, std::string_view args)
override;
172 friend REX_API SettingsRegistry& GetSettingsRegistry();
173 friend class ProcessSettingsControl;
179 void ApplyEnvironment();
185 std::vector<std::string> TakeNotices();
191 std::vector<UnknownSetting> TakeUnknown();
195 friend class SettingBase;
196 friend class ConsoleCommand;
197 void Detach(SettingBase& setting);
198 void Detach(ConsoleCommand& command);
199 bool ApplyOldLogFile(
SettingLayer layer, std::string_view name, std::string_view text,
203 std::unique_ptr<State> state_;
208#define REX_SETTINGS() ::rex::GetSettingsRegistry()
Definition settings_registry.h:38
Definition settings_registry.h:139
std::vector< std::string > GetRestartPending() const override
void AddAlias(std::string_view old_name, std::string_view new_name) override
std::vector< SettingBase * > Enumerate(std::string_view scope={}) const override
Result< void > Save(const std::filesystem::path &file) const override
Result< void > Reset(std::string_view name) override
Result< void > SetText(std::string_view name, std::string_view text) override
Result< void > SetText(SettingLayer layer, std::string_view name, std::string_view text) override
bool IsAlias(std::string_view name) const override
std::vector< ConsoleCommand * > EnumerateCommands(std::string_view scope={}) const override
Result< void > Run(std::string_view name, std::string_view args) override
void Unregister(SettingOwner &owner) override
Result< void > Load(const std::filesystem::path &file, SettingLayer layer=SettingLayer::kRuntime) override
Result< void > Register(SettingOwner &owner) override
Result< SettingBase * > Find(std::string_view name) const override
Interfaces, factory and module declaration.
#define REX_DECLARE_INTERFACE(Name, version)
Definition module.h:114
std::expected< T, Error > Result
Definition result.h:98
SettingLayer
Definition setting.h:50
@ kRuntime
Definition setting.h:56
Typed settings and the owners that declare them.
Definition settings_registry.h:32
std::string name
Definition settings_registry.h:33
SettingLayer layer
Definition settings_registry.h:34
Integer types, byte order wrappers and size literals.
Move only function, const propagating pointer and scope guard.