openMSX
StringSetting.hh
Go to the documentation of this file.
1#ifndef STRINGSETTING_HH
2#define STRINGSETTING_HH
3
4#include "Setting.hh"
5
6namespace openmsx {
7
8class StringSetting final : public Setting
9{
10public:
11 StringSetting(CommandController& commandController,
12 std::string_view name, static_string_view description,
13 std::string_view initialValue, Save save = Save::YES);
14
15 [[nodiscard]] std::string_view getTypeString() const override;
16
17 [[nodiscard]] zstring_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
const TclObject & getValue() const final
Gets the current value of this setting as a TclObject.
Definition Setting.hh:134
void setValue(const TclObject &newValue) final
Change the value of this setting to the given value.
Definition Setting.cc:81
zstring_view getString() const noexcept
std::string_view getTypeString() const override
Returns a string describing the setting type (integer, string, ..) Could be used in a GUI to pick an ...
void setString(std::string_view str)
zstring_view getString() const
Definition TclObject.cc:141
static_string_view
Like std::string_view, but with the extra guarantee that it refers to a zero-terminated string.
This file implemented 3 utility functions:
Definition Autofire.cc:11