| 1 |
#ifndef TCLCALLBACK_HH |
| 2 |
#define TCLCALLBACK_HH |
| 3 |
|
| 4 |
#include "StringSetting.hh" |
| 5 |
#include "TclObject.hh" |
| 6 |
|
| 7 |
#include "static_string_view.hh" |
| 8 |
|
| 9 |
#include <optional> |
| 10 |
#include <string_view> |
| 11 |
|
| 12 |
namespace openmsx { |
| 13 |
|
| 14 |
class CommandController; |
| 15 |
|
| 16 |
class TclCallback |
| 17 |
{ |
| 18 |
public: |
| 19 |
friend class TclCallbackMessages; |
| 20 |
|
| 21 |
TclCallback(CommandController& controller, |
| 22 |
std::string_view name, |
| 23 |
static_string_view description, |
| 24 |
std::string_view defaultValue, |
| 25 |
Setting::Save saveSetting, |
| 26 |
bool isMessageCallback = false); |
| 27 |
explicit TclCallback(StringSetting& setting); |
| 28 |
|
| 29 |
TclObject execute() const; |
| 30 |
TclObject execute(int arg1) const; |
| 31 |
TclObject execute(int arg1, int arg2) const; |
| 32 |
TclObject execute(int arg1, std::string_view arg2) const; |
| 33 |
TclObject execute(std::string_view arg1, std::string_view arg2) const; |
| 34 |
|
| 35 |
[[nodiscard]] TclObject getValue() const; |
| 36 |
[[nodiscard]] StringSetting& getSetting() const { return callbackSetting; } |
| 37 |
|
| 38 |
private: |
| 39 |
TclObject executeCommon(TclObject& command) const; |
| 40 |
|
| 41 |
std::optional<StringSetting> callbackSetting2; |
| 42 |
StringSetting& callbackSetting; |
| 43 |
const bool isMessageCallback; |
| 44 |
}; |
| 45 |
|
| 46 |
} |
| 47 |
|
| 48 |
#endif |