openMSX
TclCallback.hh
Go to the documentation of this file.
1 #ifndef TCLCALLBACK_HH
2 #define TCLCALLBACK_HH
3 
4 #include "TclObject.hh"
5 #include "string_view.hh"
6 #include <memory>
7 
8 namespace openmsx {
9 
10 class CommandController;
11 class StringSetting;
12 
14 {
15 public:
16  TclCallback(CommandController& controller,
17  string_view name,
18  string_view description,
19  bool useCliComm = true,
20  bool save = true);
21  explicit TclCallback(StringSetting& setting);
22  ~TclCallback();
23 
25  TclObject execute(int arg1);
26  TclObject execute(int arg1, int arg2);
27  TclObject execute(int arg1, string_view arg2);
29 
30  TclObject getValue() const;
31  StringSetting& getSetting() const { return callbackSetting; }
32 
33 private:
34  TclObject executeCommon(TclObject& command);
35 
36  std::unique_ptr<StringSetting> callbackSetting2; // can be nullptr
37  StringSetting& callbackSetting;
38  const bool useCliComm;
39 };
40 
41 } // namespace openmsx
42 
43 #endif
StringSetting & getSetting() const
Definition: TclCallback.hh:31
TclCallback(CommandController &controller, string_view name, string_view description, bool useCliComm=true, bool save=true)
Definition: TclCallback.cc:13
TclObject getValue() const
Definition: TclCallback.cc:35
TclObject execute()
Definition: TclCallback.cc:40
Thanks to enen for testing this on a real cartridge:
Definition: Autofire.cc:5
This class implements a (close approximation) of the std::string_view class.
Definition: string_view.hh:16