1#ifndef GLOBALCOMMANDCONTROLLER_HH
2#define GLOBALCOMMANDCONTROLLER_HH
21class EventDistributor;
56 void source(
const std::string& script);
66 std::string_view str)
override;
68 std::string_view str)
override;
72 std::string_view str)
override;
83 [[nodiscard]] std::string
tabCompletion(std::string_view command);
100 using ProxySettings =
101 std::vector<std::pair<std::unique_ptr<ProxySetting>,
unsigned>>;
102 ProxySettings::iterator findProxySetting(std::string_view name);
114 struct HelpCmd final :
Command {
116 void execute(std::span<const TclObject> tokens,
TclObject& result)
override;
117 [[nodiscard]] std::string help(std::span<const TclObject> tokens)
const override;
118 void tabCompletion(std::vector<std::string>& tokens)
const override;
121 struct TabCompletionCmd final : Command {
122 explicit TabCompletionCmd(GlobalCommandController& controller);
123 void execute(std::span<const TclObject> tokens, TclObject& result)
override;
124 [[nodiscard]] std::string help(std::span<const TclObject> tokens)
const override;
127 struct UpdateCmd final : Command {
129 void execute(std::span<const TclObject> tokens, TclObject& result)
override;
130 [[nodiscard]] std::string help(std::span<const TclObject> tokens)
const override;
131 void tabCompletion(std::vector<std::string>& tokens)
const override;
133 CliConnection& getConnection();
136 struct PlatformInfo final : InfoTopic {
137 explicit PlatformInfo(InfoCommand& openMSXInfoCommand);
138 void execute(std::span<const TclObject> tokens,
139 TclObject& result)
const override;
140 [[nodiscard]] std::string help(std::span<const TclObject> tokens)
const override;
143 struct VersionInfo final : InfoTopic {
144 explicit VersionInfo(InfoCommand& openMSXInfoCommand);
145 void execute(std::span<const TclObject> tokens,
146 TclObject& result)
const override;
147 [[nodiscard]] std::string help(std::span<const TclObject> tokens)
const override;
150 RomInfoTopic romInfoTopic;
152 struct NameFromProxy {
153 template<
typename Pair>
154 [[nodiscard]]
const std::string& operator()(
const Pair& p)
const {
155 return p.second->getName();
159 ProxySettings proxySettings;
CommandController()=default
~GlobalCommandControllerBase()
hash_map< std::string, CommandCompleter *, XXHasher > commandCompleters
void registerProxySetting(const Setting &setting)
SettingsConfig & getSettingsConfig()
Reactor & getReactor() const
Interpreter & getInterpreter() override
InfoCommand & getOpenMSXInfoCommand()
void unregisterProxySetting(const Setting &setting)
GlobalCommandController(GlobalCommandController &&)=delete
GlobalCommandController(const GlobalCommandController &)=delete
void registerSetting(Setting &setting) override
TODO.
std::string tabCompletion(std::string_view command)
Complete the given command.
void registerProxyCommand(std::string_view name)
CliComm & getCliComm() override
void unregisterProxyCommand(std::string_view name)
void registerCommand(Command &command, zstring_view str) override
(Un)register a command
void registerCompleter(CommandCompleter &completer, std::string_view str) override
(Un)register a command completer, used to complete build-in Tcl cmds
TclObject executeCommand(zstring_view command, CliConnection *connection=nullptr) override
Execute the given command.
void unregisterSetting(Setting &setting) override
GlobalCommandController & operator=(GlobalCommandController &&)=delete
const HotKey & getHotKey() const
GlobalCommandController & operator=(const GlobalCommandController &)=delete
void unregisterCompleter(CommandCompleter &completer, std::string_view str) override
void unregisterCommand(Command &command, std::string_view str) override
CliConnection * getConnection() const
bool isComplete(zstring_view command)
Returns true iff the command is complete (all braces, quotes etc.
SettingsManager & getSettingsManager()
void source(const std::string &script)
Executes all defined auto commands.
~GlobalCommandController()
Contains the main loop of openMSX.
SettingsManager & getSettingsManager()
Like std::string_view, but with the extra guarantee that it refers to a zero-terminated string.
This file implemented 3 utility functions: