ReXGlue SDK
Loading...
Searching...
No Matches
rex::SettingBase Class Referenceabstract

#include <rex/setting.h>

Inheritance diagram for rex::SettingBase:
[legend]

Public Member Functions

const std::string & GetName () const
const std::string & GetHelp () const
SettingType GetType () const
const SettingConstraints & GetConstraints () const
SettingOwner & GetOwner () const
SettingLayer GetLayer () const
bool IsFrozen () const
bool IsRestartPending () const
std::string GetText () const
std::string GetDefaultText () const
Result< void > Check (std::string_view text) const
Result< void > SetText (SettingLayer layer, std::string_view text)
Result< void > Reset ()

Protected Member Functions

 SettingBase (SettingOwner &owner, std::string_view name, SettingType type, std::string_view help)
SettingConstraints & EditConstraints ()
Result< void > SetFromCode (std::string_view text)
Protected Member Functions inherited from rex::NonCopyable
 NonCopyable (const NonCopyable &)=delete
NonCopyable & operator= (const NonCopyable &)=delete

Friends

class SettingOwner
class SettingsRegistry

Detailed Description

The untyped part of a setting, which the registry, the console and the overlay use.

Member Function Documentation

◆ Check()

Result< void > rex::SettingBase::Check ( std::string_view text) const
nodiscard

Checks a text against the type and the constraints without storing it.

Returns
Ok, or an error naming the setting and the reason.

◆ EditConstraints()

SettingConstraints & rex::SettingBase::EditConstraints ( )
protected

Returns the constraints for a derived class to fill from its traits.

◆ GetConstraints()

const SettingConstraints & rex::SettingBase::GetConstraints ( ) const

Returns what the setting accepts.

◆ GetLayer()

SettingLayer rex::SettingBase::GetLayer ( ) const

Returns the layer the current value came from.

◆ GetName()

const std::string & rex::SettingBase::GetName ( ) const

Returns the full name, the owner's scope and the member name, such as "apu.mute".

◆ GetText()

std::string rex::SettingBase::GetText ( ) const

Returns the value as text. A path keeps its {scope.name} references.

◆ IsFrozen()

bool rex::SettingBase::IsFrozen ( ) const

Reports whether the value can no longer change, because it is locked or past its life.

◆ IsRestartPending()

bool rex::SettingBase::IsRestartPending ( ) const

Reports whether a kRestart setting changed and waits for the next start.

◆ Reset()

Result< void > rex::SettingBase::Reset ( )
nodiscard

Returns the setting to its default and clears its layer. It fails when the setting is frozen.

◆ SetFromCode()

Result< void > rex::SettingBase::SetFromCode ( std::string_view text)
nodiscardprotected

Stores a text written by code, in the title layer before launch and the runtime layer after.

Returns
Ok, or the same errors as SetText.

◆ SetText()

Result< void > rex::SettingBase::SetText ( SettingLayer layer,
std::string_view text )
nodiscard

Stores a text at a layer.

Returns
Ok, or an error when the text fails the check, the setting is frozen, or a higher layer holds the value.

The documentation for this class was generated from the following file: