openMSX
Public Types | Public Member Functions | List of all members
openmsx::EnumSetting< T > Class Template Reference

#include <Reactor.hh>

Inheritance diagram for openmsx::EnumSetting< T >:
Inheritance graph
[legend]
Collaboration diagram for openmsx::EnumSetting< T >:
Collaboration graph
[legend]

Public Types

using Map = std::vector< std::pair< std::string, T > >
 
- Public Types inherited from openmsx::Setting
enum  SaveSetting { SAVE, DONT_SAVE, DONT_TRANSFER }
 

Public Member Functions

 EnumSetting (CommandController &commandController, std::string_view name, std::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...
 
getEnum () const noexcept
 
void setEnum (T e)
 
std::string_view getString () const
 
template<>
bool getEnum () const noexcept
 
- Public Member Functions inherited from openmsx::Setting
 Setting (const Setting &)=delete
 
Settingoperator= (const Setting &)=delete
 
virtual ~Setting ()
 
const TclObjectgetValue () const final override
 Gets the current value of this setting as a TclObject. More...
 
void setRestoreValue (const TclObject &newRestoreValue)
 Set restore value. More...
 
void setChecker (std::function< void(TclObject &)> checkFunc_)
 Set value-check-callback. More...
 
void setValue (const TclObject &newValue) final override
 Change the value of this setting to the given value. More...
 
std::string_view getDescription () const final override
 pure virtual methods /// More...
 
TclObject getDefaultValue () const final override
 Get the default value of this setting. More...
 
TclObject getRestoreValue () const final override
 Get the value that will be set after a Tcl 'unset' command. More...
 
void setValueDirect (const TclObject &newValue) final override
 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 override
 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 override
 Does this setting need to be transfered on reverse. More...
 
void setDontSaveValue (const TclObject &dontSaveValue) final override
 This value will never end up in the settings.xml file. More...
 
CommandControllergetCommandController () const
 
InterpretergetInterpreter () const
 
- Public Member Functions inherited from openmsx::BaseSetting
const TclObjectgetFullNameObj () const
 Get the name of this setting. More...
 
const TclObjectgetBaseNameObj () 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...
 
- Public Member Functions inherited from openmsx::Subject< Setting >
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, std::string_view description, const TclObject &initialValue, SaveSetting save=SAVE)
 
void init ()
 
void notifyPropertyChange () const
 
- Protected Member Functions inherited from openmsx::BaseSetting
 BaseSetting (std::string_view name)
 
 BaseSetting (const TclObject &name)
 
 ~BaseSetting ()=default
 
- Protected Member Functions inherited from openmsx::Subject< Setting >
 Subject ()=default
 
 ~Subject ()
 
void notify () const
 

Detailed Description

template<typename T>
class openmsx::EnumSetting< T >

Definition at line 54 of file Reactor.hh.

Member Typedef Documentation

◆ Map

template<typename T>
using openmsx::EnumSetting< T >::Map = std::vector<std::pair<std::string, T> >

Definition at line 35 of file EnumSetting.hh.

Constructor & Destructor Documentation

◆ EnumSetting()

template<typename T>
openmsx::EnumSetting< T >::EnumSetting ( CommandController commandController,
std::string_view  name,
std::string_view  description,
initialValue,
Map &&  map_,
SaveSetting  save = SAVE 
)

Definition at line 58 of file EnumSetting.hh.

Member Function Documentation

◆ additionalInfo()

template<typename T >
void openmsx::EnumSetting< T >::additionalInfo ( TclObject result) const
overridevirtual

Helper method for info().

Implements openmsx::BaseSetting.

Definition at line 80 of file EnumSetting.hh.

◆ getEnum() [1/2]

template<typename T >
T openmsx::EnumSetting< T >::getEnum ( ) const
noexcept

◆ getEnum() [2/2]

template<>
bool openmsx::EnumSetting< bool >::getEnum ( ) const
inlinenoexcept

Definition at line 96 of file EnumSetting.hh.

◆ getString()

template<typename T >
std::string_view openmsx::EnumSetting< T >::getString ( ) const

Definition at line 109 of file EnumSetting.hh.

Referenced by openmsx::CommandLineParser::parse().

◆ getTypeString()

template<typename T >
std::string_view openmsx::EnumSetting< T >::getTypeString ( ) const
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 74 of file EnumSetting.hh.

◆ setEnum()

template<typename T>
void openmsx::EnumSetting< T >::setEnum ( e)

Definition at line 103 of file EnumSetting.hh.

Referenced by openmsx::RenderSettings::RenderSettings().

◆ tabCompletion()

template<typename T >
void openmsx::EnumSetting< T >::tabCompletion ( std::vector< std::string > &  tokens) const
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 86 of file EnumSetting.hh.


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