openMSX
|
#include <EnumSetting.hh>
Public Types | |
using | Map = EnumSettingBase::Map |
Public Types inherited from openmsx::EnumSettingBase | |
using | Map = std::vector< MapEntry > |
Public Types inherited from openmsx::Setting | |
enum class | Save { YES , NO , NO_AND_DONT_TRANSFER } |
Public Member Functions | |
EnumSetting (CommandController &commandController, std::string_view name, static_string_view description, T initialValue, Map &&map_, Save save=Save::YES) | |
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. | |
void | additionalInfo (TclObject &result) const override |
Helper method for info(). | |
void | tabCompletion (std::vector< std::string > &tokens) const override |
Complete a partly typed value. | |
T | getEnum () const noexcept |
void | setEnum (T e) |
std::string_view | getString () const |
bool | getEnum () const noexcept |
Public Member Functions inherited from openmsx::EnumSettingBase | |
const auto & | getMap () const |
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 |
Public Member Functions inherited from openmsx::Setting | |
Setting (const Setting &)=delete | |
Setting (Setting &&)=delete | |
Setting & | operator= (const Setting &)=delete |
Setting & | operator= (Setting &&)=delete |
virtual | ~Setting () |
const TclObject & | getValue () const final |
Gets the current value of this setting as a TclObject. | |
std::optional< TclObject > | getOptionalValue () const final |
Like getValue(), but in case of error returns an empty optional instead of throwing an exception. | |
void | setChecker (std::function< void(TclObject &)> checkFunc_) |
Set value-check-callback. | |
void | setValue (const TclObject &newValue) final |
Change the value of this setting to the given value. | |
std::string_view | getDescription () const final |
pure virtual methods /// | |
TclObject | getDefaultValue () const final |
Get the default value of this setting. | |
void | setValueDirect (const TclObject &newValue) final |
Similar to setValue(), but doesn't trigger Tcl traces. | |
void | tabCompletion (std::vector< std::string > &tokens) const override |
Complete a partly typed value. | |
bool | needLoadSave () const final |
Does this setting need to be loaded or saved (settings.xml). | |
void | additionalInfo (TclObject &result) const override |
Helper method for info(). | |
bool | needTransfer () const final |
Does this setting need to be transfered on reverse. | |
CommandController & | getCommandController () const |
Interpreter & | getInterpreter () const |
Public Member Functions inherited from openmsx::BaseSetting | |
const TclObject & | getFullNameObj () const |
Get the name of this setting. | |
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. | |
void | info (TclObject &result) const |
For SettingInfo. | |
Public Member Functions inherited from openmsx::Subject< Setting > | |
Subject (const Subject &)=delete | |
Subject (Subject &&)=delete | |
Subject & | operator= (const Subject &)=delete |
Subject & | operator= (Subject &&)=delete |
void | attach (Observer< Setting > &observer) |
void | detach (Observer< Setting > &observer) |
bool | anyObservers () const |
Additional Inherited Members | |
Protected Member Functions inherited from openmsx::Setting | |
Setting (CommandController &commandController, std::string_view name, static_string_view description, const TclObject &initialValue, Save save=Save::YES) | |
void | init () |
void | notifyPropertyChange () const |
Protected Member Functions inherited from openmsx::BaseSetting | |
BaseSetting (std::string_view name) | |
BaseSetting (TclObject name) | |
~BaseSetting ()=default | |
Protected Member Functions inherited from openmsx::Subject< Setting > | |
Subject ()=default | |
~Subject () | |
void | notify () const |
Definition at line 53 of file EnumSetting.hh.
using openmsx::EnumSetting< T >::Map = EnumSettingBase::Map |
Definition at line 56 of file EnumSetting.hh.
openmsx::EnumSetting< T >::EnumSetting | ( | CommandController & | commandController, |
std::string_view | name, | ||
static_string_view | description, | ||
T | initialValue, | ||
Map && | map_, | ||
Save | save = Save::YES |
||
) |
Definition at line 79 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 100 of file EnumSetting.hh.
References openmsx::EnumSettingBase::additionalInfoBase().
|
noexcept |
Definition at line 112 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 116 of file EnumSetting.hh.
References openmsx::EnumSettingBase::fromStringBase(), openmsx::EnumSetting< T >::getString(), and openmsx::Setting::getValue().
std::string_view openmsx::EnumSetting< T >::getString | ( | ) | const |
Definition at line 129 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 94 of file EnumSetting.hh.
void openmsx::EnumSetting< T >::setEnum | ( | T | e | ) |
Definition at line 123 of file EnumSetting.hh.
References 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 106 of file EnumSetting.hh.
References openmsx::EnumSettingBase::tabCompletionBase().