openMSX
Command.cc
Go to the documentation of this file.
1#include "Command.hh"
5#include "checked_cast.hh"
6
7namespace openmsx {
8
9// class CommandCompleter
10
12 std::string_view name_)
13 : Completer(name_)
14 , commandController(controller_)
15{
17}
18
23
24// TODO: getCommandController(), getGlobalCommandController() and
25// getInterpreter() occur both here and in Setting.
26
28{
29 if (auto* globalCommandController =
30 dynamic_cast<GlobalCommandController*>(&commandController)) {
31 return *globalCommandController;
32 } else {
33 return checked_cast<MSXCommandController*>(&commandController)
34 ->getGlobalCommandController();
35 }
36}
37
42
47
48// class Command
49
50Command::Command(CommandController& controller_, std::string_view name_)
51 : CommandCompleter(controller_, name_)
52{
54}
55
60
61void Command::tabCompletion(std::vector<std::string>& /*tokens*/) const
62{
63 // do nothing
64}
65
66} // namespace openmsx
CliComm & getCliComm() const
Definition Command.cc:43
CommandCompleter(const CommandCompleter &)=delete
CommandController & getCommandController() const
Definition Command.hh:26
Interpreter & getInterpreter() const final
Definition Command.cc:38
GlobalCommandController & getGlobalCommandController() const
Definition Command.cc:27
virtual void registerCommand(Command &command, zstring_view str)=0
(Un)register a command
virtual Interpreter & getInterpreter()=0
virtual CliComm & getCliComm()=0
virtual void unregisterCommand(Command &command, std::string_view str)=0
virtual void registerCompleter(CommandCompleter &completer, std::string_view str)=0
(Un)register a command completer, used to complete build-in Tcl cmds
virtual void unregisterCompleter(CommandCompleter &completer, std::string_view str)=0
Command(CommandController &controller, std::string_view name)
Definition Command.cc:50
void tabCompletion(std::vector< std::string > &tokens) const override
Attempt tab completion for this command.
Definition Command.cc:61
const std::string & getName() const
Definition Completer.hh:23
This file implemented 3 utility functions:
Definition Autofire.cc:9