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  string_view name, string_view description,
13  string_view initialValue, SaveSetting save = SAVE);
14 
15  string_view getTypeString() const override;
16 
17  string_view getString() const noexcept { return getValue().getString(); }
18  void setString(string_view str) { setValue(TclObject(str)); }
19 };
20 
21 } // namespace openmsx
22 
23 #endif
StringSetting(CommandController &commandController, string_view name, string_view description, string_view initialValue, SaveSetting save=SAVE)
Definition: StringSetting.cc:5
string_view getString() const
Definition: TclObject.cc:102
void setString(string_view str)
const TclObject & getValue() const final override
Gets the current value of this setting as a TclObject.
Definition: Setting.hh:134
Thanks to enen for testing this on a real cartridge:
Definition: Autofire.cc:5
string_view getString() const noexcept
void setValue(const TclObject &newValue) final override
Change the value of this setting to the given value.
Definition: Setting.cc:88
This class implements a (close approximation) of the std::string_view class.
Definition: string_view.hh:16
string_view getTypeString() const override
Returns a string describing the setting type (integer, string, ..) Could be used in a GUI to pick an ...