openMSX
StringSetting.hh
Go to the documentation of this file.
1 #ifndef STRINGSETTING_HH
2 #define STRINGSETTING_HH
3 
4 #include "Setting.hh"
5 
6 namespace openmsx {
7 
8 class StringSetting final : public Setting
9 {
10 public:
11  StringSetting(CommandController& commandController,
12  std::string_view name, std::string_view description,
13  std::string_view initialValue, SaveSetting save = SAVE);
14 
15  std::string_view getTypeString() const override;
16 
17  std::string_view getString() const noexcept { return getValue().getString(); }
18  void setString(std::string_view str) { setValue(TclObject(str)); }
19 };
20 
21 } // namespace openmsx
22 
23 #endif
openmsx::CommandController
Definition: CommandController.hh:18
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::Setting::setValue
void setValue(const TclObject &newValue) final override
Change the value of this setting to the given value.
Definition: Setting.cc:89
openmsx::StringSetting::StringSetting
StringSetting(CommandController &commandController, std::string_view name, std::string_view description, std::string_view initialValue, SaveSetting save=SAVE)
Definition: StringSetting.cc:5
openmsx::Setting
Definition: Setting.hh:120
openmsx::StringSetting::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: StringSetting.cc:14
openmsx::StringSetting::getString
std::string_view getString() const noexcept
Definition: StringSetting.hh:17
openmsx::StringSetting
Definition: StringSetting.hh:9
openmsx::Setting::SaveSetting
SaveSetting
Definition: Setting.hh:125
openmsx::Setting::SAVE
@ SAVE
Definition: Setting.hh:126
openmsx::TclObject::getString
std::string_view getString() const
Definition: TclObject.cc:102
openmsx::TclObject
Definition: TclObject.hh:22
openmsx::StringSetting::setString
void setString(std::string_view str)
Definition: StringSetting.hh:18
openmsx
This file implemented 3 utility functions:
Definition: Autofire.cc:5