1#ifndef GLOBALCOMMANDCONTROLLER_HH
2#define GLOBALCOMMANDCONTROLLER_HH
21class EventDistributor;
55 void source(
const std::string& script);
65 std::string_view str)
override;
67 std::string_view str)
override;
71 std::string_view str)
override;
82 [[nodiscard]] std::string
tabCompletion(std::string_view command);
98 std::vector<std::pair<std::unique_ptr<ProxySetting>,
unsigned>>;
99 ProxySettings::iterator findProxySetting(std::string_view name);
111 struct HelpCmd final :
Command {
113 void execute(std::span<const TclObject> tokens,
TclObject& result)
override;
114 [[nodiscard]] std::string help(std::span<const TclObject> tokens)
const override;
115 void tabCompletion(std::vector<std::string>& tokens)
const override;
118 struct TabCompletionCmd final : Command {
120 void execute(std::span<const TclObject> tokens, TclObject& result)
override;
121 [[nodiscard]] std::string help(std::span<const TclObject> tokens)
const override;
124 struct UpdateCmd final : Command {
126 void execute(std::span<const TclObject> tokens, TclObject& result)
override;
127 [[nodiscard]] std::string help(std::span<const TclObject> tokens)
const override;
128 void tabCompletion(std::vector<std::string>& tokens)
const override;
133 struct PlatformInfo final : InfoTopic {
134 explicit PlatformInfo(InfoCommand& openMSXInfoCommand);
135 void execute(std::span<const TclObject> tokens,
136 TclObject& result)
const override;
137 [[nodiscard]] std::string help(std::span<const TclObject> tokens)
const override;
140 struct VersionInfo final : InfoTopic {
141 explicit VersionInfo(InfoCommand& openMSXInfoCommand);
142 void execute(std::span<const TclObject> tokens,
143 TclObject& result)
const override;
144 [[nodiscard]] std::string help(std::span<const TclObject> tokens)
const override;
147 RomInfoTopic romInfoTopic;
149 struct NameFromProxy {
150 template<
typename Pair>
151 [[nodiscard]]
const std::string& operator()(
const Pair& p)
const {
152 return p.second->getName();
156 ProxySettings proxySettings;
CommandController()=default
~GlobalCommandControllerBase()
hash_map< std::string, CommandCompleter *, XXHasher > commandCompleters
SettingsConfig & getSettingsConfig()
Interpreter & getInterpreter() override
InfoCommand & getOpenMSXInfoCommand()
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
void registerProxySetting(Setting &setting)
TclObject executeCommand(zstring_view command, CliConnection *connection=nullptr) override
Execute the given command.
void unregisterProxySetting(Setting &setting)
void unregisterSetting(Setting &setting) override
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: