OXYGENHUB
◆ main openmsx / src / commands / CommandController.hh
1.4 KiB · C++ · last changed chore(): initial commit 1 month ago source blame history raw
1
#ifndef COMMANDCONTROLLER_HH
2
#define COMMANDCONTROLLER_HH
3
4
#include "TclObject.hh"
5
#include "zstring_view.hh"
6
#include <string_view>
7
8
namespace openmsx {
9
10
class CommandCompleter;
11
class Command;
12
class CliConnection;
13
class Setting;
14
class BaseSetting;
15
class CliComm;
16
class Interpreter;
17
18
class CommandController
19
{
20
public:
21
	/**
22
	 * (Un)register a command completer, used to complete build-in Tcl cmds
23
	 */
24
	virtual void   registerCompleter(CommandCompleter& completer,
25
	                                 std::string_view str) = 0;
26
	virtual void unregisterCompleter(CommandCompleter& completer,
27
	                                 std::string_view str) = 0;
28
29
	/**
30
	 * (Un)register a command
31
	 */
32
	virtual void   registerCommand(Command& command,
33
	                               zstring_view str) = 0;
34
	virtual void unregisterCommand(Command& command,
35
	                               std::string_view str) = 0;
36
37
	/**
38
	 * Execute the given command
39
	 */
40
	virtual TclObject executeCommand(zstring_view command,
41
	                                 CliConnection* connection = nullptr) = 0;
42
43
	/** TODO
44
	 */
45
	virtual void   registerSetting(Setting& setting) = 0;
46
	virtual void unregisterSetting(Setting& setting) = 0;
47
48
	virtual CliComm& getCliComm() = 0;
49
	virtual Interpreter& getInterpreter() = 0;
50
51
protected:
52
	CommandController() = default;
53
	~CommandController() = default;
54
};
55
56
} // namespace openmsx
57
58
#endif