openMSX
|
#include <EnumSetting.hh>
Public Types | |
using | Map = EnumSettingBase::Map |
![]() | |
using | Map = std::vector< MapEntry > |
![]() | |
enum | SaveSetting { SAVE , DONT_SAVE , DONT_TRANSFER } |
Public Member Functions | |
EnumSetting (CommandController &commandController, std::string_view name, static_string_view description, T initialValue, Map &&map_, SaveSetting save=SAVE) | |
std::string_view | getTypeString () const override |
Returns a string describing the setting type (integer, string, ..) Could be used in a GUI to pick an appropriate setting widget. More... | |
void | additionalInfo (TclObject &result) const override |
Helper method for info(). More... | |
void | tabCompletion (std::vector< std::string > &tokens) const override |
Complete a partly typed value. More... | |
T | getEnum () const noexcept |
void | setEnum (T e) |
std::string_view | getString () const |
bool | getEnum () const noexcept |
![]() | |
const auto & | getMap () const |
![]() | |
Setting (const Setting &)=delete | |
Setting & | operator= (const Setting &)=delete |
virtual | ~Setting () |
const TclObject & | getValue () const final |
Gets the current value of this setting as a TclObject. More... | |
std::optional< TclObject > | getOptionalValue () const final |
Like getValue(), but in case of error returns an empty optional instead of throwing an exception. More... | |
void | setChecker (std::function< void(TclObject &)> checkFunc_) |
Set value-check-callback. More... | |
void | setValue (const TclObject &newValue) final |
Change the value of this setting to the given value. More... | |
std::string_view | getDescription () const final |
pure virtual methods /// More... | |
TclObject | getDefaultValue () const final |
Get the default value of this setting. More... | |
void | setValueDirect (const TclObject &newValue) final |
Similar to setValue(), but doesn't trigger Tcl traces. More... | |
void | tabCompletion (std::vector< std::string > &tokens) const override |
Complete a partly typed value. More... | |
bool | needLoadSave () const final |
Does this setting need to be loaded or saved (settings.xml). More... | |
void | additionalInfo (TclObject &result) const override |
Helper method for info(). More... | |
bool | needTransfer () const final |
Does this setting need to be transfered on reverse. More... | |
CommandController & | getCommandController () const |
Interpreter & | getInterpreter () const |
![]() | |
const TclObject & | getFullNameObj () const |
Get the name of this setting. More... | |
const TclObject & | getBaseNameObj () const |
std::string_view | getFullName () const |
std::string_view | getBaseName () const |
void | setPrefix (std::string_view prefix) |
Set a machine specific prefix. More... | |
void | info (TclObject &result) const |
For SettingInfo. More... | |
virtual std::string_view | getDescription () const =0 |
pure virtual methods /// More... | |
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. More... | |
virtual void | additionalInfo (TclObject &result) const =0 |
Helper method for info(). More... | |
virtual void | tabCompletion (std::vector< std::string > &tokens) const =0 |
Complete a partly typed value. More... | |
virtual const TclObject & | getValue () const =0 |
Get current value as a TclObject. More... | |
virtual std::optional< TclObject > | getOptionalValue () const =0 |
Like getValue(), but in case of error returns an empty optional instead of throwing an exception. More... | |
virtual TclObject | getDefaultValue () const =0 |
Get the default value of this setting. More... | |
virtual void | setValue (const TclObject &value)=0 |
Change the value of this setting to the given value. More... | |
virtual void | setValueDirect (const TclObject &value)=0 |
Similar to setValue(), but doesn't trigger Tcl traces. More... | |
virtual bool | needLoadSave () const =0 |
Does this setting need to be loaded or saved (settings.xml). More... | |
virtual bool | needTransfer () const =0 |
Does this setting need to be transfered on reverse. More... | |
![]() | |
void | attach (Observer< Setting > &observer) |
void | detach (Observer< Setting > &observer) |
bool | anyObservers () const |
Additional Inherited Members | |
![]() | |
EnumSettingBase (Map &&m) | |
int | fromStringBase (std::string_view str) const |
std::string_view | toStringBase (int value) const |
auto | getPossibleValues () const |
void | additionalInfoBase (TclObject &result) const |
void | tabCompletionBase (std::vector< std::string > &tokens) const |
![]() | |
Setting (CommandController &commandController, std::string_view name, static_string_view description, const TclObject &initialValue, SaveSetting save=SAVE) | |
void | init () |
void | notifyPropertyChange () const |
![]() | |
BaseSetting (std::string_view name) | |
BaseSetting (TclObject name) | |
~BaseSetting ()=default | |
![]() | |
Subject ()=default | |
~Subject () | |
void | notify () const |
Definition at line 55 of file EnumSetting.hh.
using openmsx::EnumSetting< T >::Map = EnumSettingBase::Map |
Definition at line 58 of file EnumSetting.hh.
openmsx::EnumSetting< T >::EnumSetting | ( | CommandController & | commandController, |
std::string_view | name, | ||
static_string_view | description, | ||
T | initialValue, | ||
Map && | map_, | ||
SaveSetting | save = SAVE |
||
) |
Definition at line 81 of file EnumSetting.hh.
References openmsx::EnumSettingBase::fromStringBase(), openmsx::TclObject::getString(), openmsx::Setting::init(), and openmsx::Setting::setChecker().
|
overridevirtual |
Helper method for info().
Implements openmsx::BaseSetting.
Definition at line 102 of file EnumSetting.hh.
References openmsx::EnumSettingBase::additionalInfoBase().
|
noexcept |
Definition at line 114 of file EnumSetting.hh.
References openmsx::EnumSettingBase::fromStringBase(), openmsx::EnumSetting< T >::getString(), and openmsx::Setting::getValue().
Referenced by openmsx::ResampledSoundDevice::createResampler(), openmsx::RenderSettings::getAccuracy(), openmsx::KeyboardSettings::getCodeKanaHostKey(), openmsx::RenderSettings::getDisplayDeform(), openmsx::KeyboardSettings::getKpEnterMode(), openmsx::KeyboardSettings::getMappingMode(), openmsx::RenderSettings::getRenderer(), and openmsx::RenderSettings::getScaleAlgorithm().
|
inlinenoexcept |
Definition at line 118 of file EnumSetting.hh.
References openmsx::EnumSettingBase::fromStringBase(), openmsx::EnumSetting< T >::getString(), and openmsx::Setting::getValue().
std::string_view openmsx::EnumSetting< T >::getString |
Definition at line 131 of file EnumSetting.hh.
References openmsx::TclObject::getString(), and openmsx::Setting::getValue().
Referenced by openmsx::EnumSetting< T >::getEnum(), and openmsx::CommandLineParser::parse().
|
overridevirtual |
Returns a string describing the setting type (integer, string, ..) Could be used in a GUI to pick an appropriate setting widget.
Implements openmsx::BaseSetting.
Definition at line 96 of file EnumSetting.hh.
void openmsx::EnumSetting< T >::setEnum | ( | T | e | ) |
Definition at line 125 of file EnumSetting.hh.
References Math::e, and openmsx::Setting::setValue().
|
overridevirtual |
Complete a partly typed value.
Default implementation does not complete anything, subclasses can override this to complete according to their specific value type.
Implements openmsx::BaseSetting.
Definition at line 108 of file EnumSetting.hh.
References openmsx::EnumSettingBase::tabCompletionBase().