openMSX
Public Member Functions | Protected Member Functions | List of all members
openmsx::BaseSetting Class Referenceabstract

#include <Setting.hh>

Inheritance diagram for openmsx::BaseSetting:
Inheritance graph
[legend]

Public Member Functions

const TclObjectgetFullNameObj () const
 Get the name of this setting.
 
const TclObjectgetBaseNameObj () const
 
std::string_view getFullName () const
 
std::string_view getBaseName () const
 
void setPrefix (std::string_view prefix)
 Set a machine specific prefix.
 
void info (TclObject &result) const
 For SettingInfo.
 
virtual std::string_view getDescription () const =0
 pure virtual methods ///
 
virtual std::string_view getTypeString () const =0
 Returns a string describing the setting type (integer, string, ..) Could be used in a GUI to pick an appropriate setting widget.
 
virtual void additionalInfo (TclObject &result) const =0
 Helper method for info().
 
virtual void tabCompletion (std::vector< std::string > &tokens) const =0
 Complete a partly typed value.
 
virtual const TclObjectgetValue () const =0
 Get current value as a TclObject.
 
virtual std::optional< TclObjectgetOptionalValue () const =0
 Like getValue(), but in case of error returns an empty optional instead of throwing an exception.
 
virtual TclObject getDefaultValue () const =0
 Get the default value of this setting.
 
virtual void setValue (const TclObject &value)=0
 Change the value of this setting to the given value.
 
virtual void setValueDirect (const TclObject &value)=0
 Similar to setValue(), but doesn't trigger Tcl traces.
 
virtual bool needLoadSave () const =0
 Does this setting need to be loaded or saved (settings.xml).
 
virtual bool needTransfer () const =0
 Does this setting need to be transfered on reverse.
 

Protected Member Functions

 BaseSetting (std::string_view name)
 
 BaseSetting (TclObject name)
 
 ~BaseSetting ()=default
 

Detailed Description

Definition at line 20 of file Setting.hh.

Constructor & Destructor Documentation

◆ BaseSetting() [1/2]

openmsx::BaseSetting::BaseSetting ( std::string_view  name)
explicitprotected

Definition at line 15 of file Setting.cc.

◆ BaseSetting() [2/2]

openmsx::BaseSetting::BaseSetting ( TclObject  name)
explicitprotected

Definition at line 21 of file Setting.cc.

◆ ~BaseSetting()

openmsx::BaseSetting::~BaseSetting ( )
protecteddefault

Member Function Documentation

◆ additionalInfo()

virtual void openmsx::BaseSetting::additionalInfo ( TclObject result) const
pure virtual

◆ getBaseName()

std::string_view openmsx::BaseSetting::getBaseName ( ) const
inline

◆ getBaseNameObj()

const TclObject & openmsx::BaseSetting::getBaseNameObj ( ) const
inline

Definition at line 36 of file Setting.hh.

Referenced by openmsx::Setting::setValueDirect().

◆ getDefaultValue()

virtual TclObject openmsx::BaseSetting::getDefaultValue ( ) const
pure virtual

Get the default value of this setting.

This is the initial value of the setting. Default values don't get saved in 'settings.xml'. This is also the value used for a Tcl 'unset' command.

Implemented in openmsx::Setting, and openmsx::ProxySetting.

Referenced by info().

◆ getDescription()

virtual std::string_view openmsx::BaseSetting::getDescription ( ) const
pure virtual

pure virtual methods ///

Get a description of this setting that can be presented to the user.

Implemented in openmsx::Setting, and openmsx::ProxySetting.

◆ getFullName()

std::string_view openmsx::BaseSetting::getFullName ( ) const
inline

◆ getFullNameObj()

const TclObject & openmsx::BaseSetting::getFullNameObj ( ) const
inline

Get the name of this setting.

For global settings 'fullName' and 'baseName' are the same. For machine specific settings 'fullName' is the fully qualified name, and 'baseName' is the name without machine-prefix. For example: fullName = "::machine1::PSG_volume" baseName = "PSG_volume"

Definition at line 35 of file Setting.hh.

Referenced by openmsx::Interpreter::registerSetting(), and openmsx::Setting::setValue().

◆ getOptionalValue()

virtual std::optional< TclObject > openmsx::BaseSetting::getOptionalValue ( ) const
pure virtual

Like getValue(), but in case of error returns an empty optional instead of throwing an exception.

Implemented in openmsx::Setting, and openmsx::ProxySetting.

◆ getTypeString()

virtual std::string_view openmsx::BaseSetting::getTypeString ( ) const
pure virtual

◆ getValue()

virtual const TclObject & openmsx::BaseSetting::getValue ( ) const
pure virtual

Get current value as a TclObject.

Implemented in openmsx::Setting, and openmsx::ProxySetting.

Referenced by openmsx::ComboBox(), and openmsx::InputText().

◆ info()

void openmsx::BaseSetting::info ( TclObject result) const

◆ needLoadSave()

virtual bool openmsx::BaseSetting::needLoadSave ( ) const
pure virtual

Does this setting need to be loaded or saved (settings.xml).

Implemented in openmsx::Setting, and openmsx::ProxySetting.

◆ needTransfer()

virtual bool openmsx::BaseSetting::needTransfer ( ) const
pure virtual

Does this setting need to be transfered on reverse.

Implemented in openmsx::Setting, and openmsx::ProxySetting.

◆ setPrefix()

void openmsx::BaseSetting::setPrefix ( std::string_view  prefix)
inline

Set a machine specific prefix.

Definition at line 42 of file Setting.hh.

References getBaseName(), and tmpStrCat().

◆ setValue()

virtual void openmsx::BaseSetting::setValue ( const TclObject value)
pure virtual

Change the value of this setting to the given value.

This method will trigger Tcl traces. This value still passes via the 'checker-callback' (see below), so the value may be adjusted. Or in case of an invalid value this method may throw.

Implemented in openmsx::Setting, and openmsx::ProxySetting.

Referenced by openmsx::InputText(), and openmsx::ProxySetting::setValue().

◆ setValueDirect()

virtual void openmsx::BaseSetting::setValueDirect ( const TclObject value)
pure virtual

Similar to setValue(), but doesn't trigger Tcl traces.

Like setValue(), the given value may be adjusted or rejected. Should only be used by the Interpreter class.

Implemented in openmsx::Setting, and openmsx::ProxySetting.

Referenced by openmsx::Interpreter::registerSetting().

◆ tabCompletion()

virtual void openmsx::BaseSetting::tabCompletion ( std::vector< std::string > &  tokens) const
pure virtual

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