openMSX
TclCallback.hh
Go to the documentation of this file.
1#ifndef TCLCALLBACK_HH
2#define TCLCALLBACK_HH
3
5#include "StringSetting.hh"
6#include "TclObject.hh"
7#include <optional>
8#include <string_view>
9
10namespace openmsx {
11
12class CommandController;
13
15{
16public:
18 std::string_view name,
19 static_string_view description,
20 std::string_view defaultValue,
21 Setting::SaveSetting saveSetting,
22 bool useCliComm = true);
24
25 TclObject execute() const;
26 TclObject execute(int arg1) const;
27 TclObject execute(int arg1, int arg2) const;
28 TclObject execute(int arg1, std::string_view arg2) const;
29 TclObject execute(std::string_view arg1, std::string_view arg2) const;
30
31 [[nodiscard]] TclObject getValue() const;
32 [[nodiscard]] StringSetting& getSetting() const { return callbackSetting; }
33
34private:
35 TclObject executeCommon(TclObject& command) const;
36
37 std::optional<StringSetting> callbackSetting2;
38 StringSetting& callbackSetting;
39 const bool useCliComm;
40};
41
42} // namespace openmsx
43
44#endif
BaseSetting * setting
Definition: Interpreter.cc:28
TclObject getValue() const
Definition: TclCallback.cc:31
TclObject execute() const
Definition: TclCallback.cc:36
TclCallback(CommandController &controller, std::string_view name, static_string_view description, std::string_view defaultValue, Setting::SaveSetting saveSetting, bool useCliComm=true)
Definition: TclCallback.cc:10
StringSetting & getSetting() const
Definition: TclCallback.hh:32
static_string_view
This file implemented 3 utility functions:
Definition: Autofire.cc:9