openMSX
IntegerSetting.hh
Go to the documentation of this file.
1 #ifndef INTEGERSETTING_HH
2 #define INTEGERSETTING_HH
3 
4 #include "Setting.hh"
5 
6 namespace openmsx {
7 
10 class IntegerSetting final : public Setting
11 {
12 public:
13  IntegerSetting(CommandController& commandController,
14  std::string_view name, std::string_view description,
15  int initialValue, int minValue, int maxValue,
16  SaveSetting save = SAVE);
17 
18  std::string_view getTypeString() const override;
19  void additionalInfo(TclObject& result) const override;
20 
21  int getInt() const noexcept { return getValue().getInt(getInterpreter()); }
22  void setInt(int i);
23 
24 private:
25  const int minValue;
26  const int maxValue;
27 };
28 
29 } // namespace openmsx
30 
31 #endif
openmsx::Setting::getInterpreter
Interpreter & getInterpreter() const
Definition: Setting.cc:162
openmsx::CommandController
Definition: CommandController.hh:17
Setting.hh
openmsx::Setting::getValue
const TclObject & getValue() const final override
Gets the current value of this setting as a TclObject.
Definition: Setting.hh:135
openmsx::IntegerSetting::getTypeString
std::string_view getTypeString() const override
Returns a string describing the setting type (integer, string, ..) Could be used in a GUI to pick an ...
Definition: IntegerSetting.cc:22
openmsx::IntegerSetting::additionalInfo
void additionalInfo(TclObject &result) const override
Helper method for info().
Definition: IntegerSetting.cc:27
openmsx::Setting
Definition: Setting.hh:119
openmsx::IntegerSetting::getInt
int getInt() const noexcept
Definition: IntegerSetting.hh:21
openmsx::IntegerSetting::IntegerSetting
IntegerSetting(CommandController &commandController, std::string_view name, std::string_view description, int initialValue, int minValue, int maxValue, SaveSetting save=SAVE)
Definition: IntegerSetting.cc:5
openmsx::TclObject::getInt
int getInt(Interpreter &interp) const
Definition: TclObject.cc:72
openmsx::IntegerSetting::setInt
void setInt(int i)
Definition: IntegerSetting.cc:32
openmsx::Setting::SaveSetting
SaveSetting
Definition: Setting.hh:125
openmsx::Setting::SAVE
@ SAVE
Definition: Setting.hh:126
openmsx::IntegerSetting
A Setting with an integer value.
Definition: IntegerSetting.hh:10
openmsx::TclObject
Definition: TclObject.hh:21
openmsx
Thanks to enen for testing this on a real cartridge:
Definition: Autofire.cc:5