openMSX
CommandController.hh
Go to the documentation of this file.
1 #ifndef COMMANDCONTROLLER_HH
2 #define COMMANDCONTROLLER_HH
3 
4 #include "TclObject.hh"
5 #include <string_view>
6 
7 namespace openmsx {
8 
9 class CommandCompleter;
10 class Command;
11 class CliConnection;
12 class Setting;
13 class BaseSetting;
14 class CliComm;
15 class Interpreter;
16 
18 {
19 public:
23  virtual void registerCompleter(CommandCompleter& completer,
24  std::string_view str) = 0;
25  virtual void unregisterCompleter(CommandCompleter& completer,
26  std::string_view str) = 0;
27 
31  virtual void registerCommand(Command& command,
32  const std::string& str) = 0;
33  virtual void unregisterCommand(Command& command,
34  std::string_view str) = 0;
35 
39  virtual bool hasCommand(std::string_view command) const = 0;
40 
44  virtual TclObject executeCommand(const std::string& command,
45  CliConnection* connection = nullptr) = 0;
46 
49  virtual void registerSetting(Setting& setting) = 0;
50  virtual void unregisterSetting(Setting& setting) = 0;
51 
52  virtual CliComm& getCliComm() = 0;
53  virtual Interpreter& getInterpreter() = 0;
54 
55 protected:
56  CommandController() = default;
57  ~CommandController() = default;
58 };
59 
60 } // namespace openmsx
61 
62 #endif
openmsx::CommandController::hasCommand
virtual bool hasCommand(std::string_view command) const =0
Does a command with this name already exist?
openmsx::CommandController::getInterpreter
virtual Interpreter & getInterpreter()=0
openmsx::CommandController
Definition: CommandController.hh:17
TclObject.hh
openmsx::CommandController::registerCompleter
virtual void registerCompleter(CommandCompleter &completer, std::string_view str)=0
(Un)register a command completer, used to complete build-in Tcl cmds
openmsx::CommandController::unregisterCommand
virtual void unregisterCommand(Command &command, std::string_view str)=0
openmsx::Setting
Definition: Setting.hh:119
openmsx::CliConnection
Definition: CliConnection.hh:19
openmsx::CommandController::executeCommand
virtual TclObject executeCommand(const std::string &command, CliConnection *connection=nullptr)=0
Execute the given command.
openmsx::CommandCompleter
Definition: Command.hh:19
openmsx::CommandController::getCliComm
virtual CliComm & getCliComm()=0
openmsx::CommandController::unregisterCompleter
virtual void unregisterCompleter(CommandCompleter &completer, std::string_view str)=0
openmsx::CommandController::registerCommand
virtual void registerCommand(Command &command, const std::string &str)=0
(Un)register a command
openmsx::Command
Definition: Command.hh:40
openmsx::CliComm
Definition: CliComm.hh:10
openmsx::CommandController::~CommandController
~CommandController()=default
openmsx::TclObject
Definition: TclObject.hh:21
openmsx::CommandController::registerSetting
virtual void registerSetting(Setting &setting)=0
TODO.
openmsx::CommandController::CommandController
CommandController()=default
openmsx::Interpreter
Definition: Interpreter.hh:16
openmsx::CommandController::unregisterSetting
virtual void unregisterSetting(Setting &setting)=0
openmsx
Thanks to enen for testing this on a real cartridge:
Definition: Autofire.cc:5