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