openMSX
FilenameSetting.hh
Go to the documentation of this file.
1 #ifndef FILENAMESETTING_HH
2 #define FILENAMESETTING_HH
3 
4 #include "Setting.hh"
5 
6 namespace openmsx {
7 
8 class FilenameSetting final : public Setting
9 {
10 public:
11  FilenameSetting(CommandController& commandController,
12  std::string_view name, static_string_view description,
13  std::string_view initialValue);
14 
15  [[nodiscard]] std::string_view getTypeString() const override;
16  void tabCompletion(std::vector<std::string>& tokens) const override;
17 
18  [[nodiscard]] zstring_view getString() const noexcept { return getValue().getString(); }
19  void setString(std::string_view str) { setValue(TclObject(str)); }
20 };
21 
22 } // namespace openmsx
23 
24 #endif
FilenameSetting(CommandController &commandController, std::string_view name, static_string_view description, std::string_view initialValue)
void setString(std::string_view str)
void tabCompletion(std::vector< std::string > &tokens) const override
Complete a partly typed value.
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 ...
const TclObject & getValue() const final
Gets the current value of this setting as a TclObject.
Definition: Setting.hh:142
void setValue(const TclObject &newValue) final
Change the value of this setting to the given value.
Definition: Setting.cc:82
zstring_view getString() const
Definition: TclObject.cc:111
static_string_view
Like std::string_view, but with the extra guarantee that it refers to a zero-terminated string.
Definition: zstring_view.hh:22
This file implemented 3 utility functions:
Definition: Autofire.cc:9