#include <rex/settings_registry.h>
|
|
class | ProcessSettingsControl |
|
class | SettingBase |
|
class | ConsoleCommand |
|
SettingsRegistry & | GetSettingsRegistry () |
The process settings registry, reached through GetSettingsRegistry() and, for modules, ISettingsRegistry.
◆ AddAlias()
| void rex::SettingsRegistry::AddAlias |
( |
std::string_view | old_name, |
|
|
std::string_view | new_name ) |
|
overridevirtual |
Maps an old name to the setting that replaced it. Each use of an old name adds one notice.
- Parameters
-
| new_name | The new full name, empty when the old name was removed and its values are ignored. |
Implements rex::ISettingsRegistry.
◆ Enumerate()
| std::vector< SettingBase * > rex::SettingsRegistry::Enumerate |
( |
std::string_view | scope = {} | ) |
const |
|
overridevirtual |
Lists registered settings, sorted by name.
- Parameters
-
| scope | Only settings under this scope, every setting when empty. |
Implements rex::ISettingsRegistry.
◆ EnumerateCommands()
| std::vector< ConsoleCommand * > rex::SettingsRegistry::EnumerateCommands |
( |
std::string_view | scope = {} | ) |
const |
|
overridevirtual |
Lists registered commands, sorted by name.
- Parameters
-
| scope | Only commands under this scope, every command when empty. |
Implements rex::ISettingsRegistry.
◆ Find()
| Result< SettingBase * > rex::SettingsRegistry::Find |
( |
std::string_view | name | ) |
const |
|
nodiscardoverridevirtual |
◆ GetRestartPending()
| std::vector< std::string > rex::SettingsRegistry::GetRestartPending |
( |
| ) |
const |
|
overridevirtual |
◆ IsAlias()
| bool rex::SettingsRegistry::IsAlias |
( |
std::string_view | name | ) |
const |
|
nodiscardoverridevirtual |
Reports whether a name is an old name in the alias table, removed names included.
- Parameters
-
- Returns
- True when SetText resolves the name through an alias.
Implements rex::ISettingsRegistry.
◆ Load()
Reads a TOML file into the runtime layer. Old names apply through the alias table.
- Parameters
-
| layer | The layer the values apply at. |
- Returns
- Ok, or an error naming the file and the first refused value.
Implements rex::ISettingsRegistry.
◆ Register()
Registers an owner and applies values waiting for its settings.
- Returns
- Ok, or an error naming both owners when a full name is already registered.
Implements rex::ISettingsRegistry.
◆ Reset()
| Result< void > rex::SettingsRegistry::Reset |
( |
std::string_view | name | ) |
|
|
nodiscardoverridevirtual |
Returns a setting to its default. The result is Ok, kNotFound, or an error when it is frozen.
Implements rex::ISettingsRegistry.
◆ Run()
| Result< void > rex::SettingsRegistry::Run |
( |
std::string_view | name, |
|
|
std::string_view | args ) |
|
nodiscardoverridevirtual |
◆ Save()
| Result< void > rex::SettingsRegistry::Save |
( |
const std::filesystem::path & | file | ) |
const |
|
nodiscardoverridevirtual |
Writes every saved setting that differs from its default to a TOML file.
- Returns
- Ok, or an error when the file cannot be written.
Implements rex::ISettingsRegistry.
◆ SetText() [1/2]
| Result< void > rex::SettingsRegistry::SetText |
( |
SettingLayer | layer, |
|
|
std::string_view | name, |
|
|
std::string_view | text ) |
|
nodiscardoverridevirtual |
Sets a setting from text at a layer. A name nothing registered yet waits and applies when its owner registers. A value a higher layer holds is kept, not an error.
- Parameters
-
| name | The full name, or an old name from the alias table. |
- Returns
- Ok, or the setting's refusal.
Implements rex::ISettingsRegistry.
◆ SetText() [2/2]
| Result< void > rex::SettingsRegistry::SetText |
( |
std::string_view | name, |
|
|
std::string_view | text ) |
|
nodiscardoverridevirtual |
Sets a setting from text at the runtime layer. An old name applies to its new setting.
- Returns
- Ok, kNotFound, or the setting's refusal.
Implements rex::ISettingsRegistry.
◆ Unregister()
| void rex::SettingsRegistry::Unregister |
( |
SettingOwner & | owner | ) |
|
|
overridevirtual |
Removes an owner. Its current values wait here for the next owner of the same names.
Implements rex::ISettingsRegistry.
The documentation for this class was generated from the following file: