From f259af9326b4e2140f856f1651eaeb0d74537621 Mon Sep 17 00:00:00 2001 From: Maxime Coste Date: Sun, 15 Jan 2012 03:02:08 +0000 Subject: CommandManager: add flags support and IgnoreSemiColons flag commands are now registred with flags, and the IgnoreSemiColons flag permit to specify a command which needs all the parameters on the line, bypassing the command sequence operator ';'. the hook command is tagged as such. --- src/command_manager.hh | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) (limited to 'src/command_manager.hh') diff --git a/src/command_manager.hh b/src/command_manager.hh index 6b73b47d..125db6e1 100644 --- a/src/command_manager.hh +++ b/src/command_manager.hh @@ -53,6 +53,12 @@ private: class CommandManager : public Singleton { public: + enum Flags + { + None = 0, + IgnoreSemiColons = 1, + }; + void execute(const std::string& command_line, const Context& context); void execute(const CommandParameters& params, const Context& context); @@ -60,19 +66,22 @@ public: void register_command(const std::string& command_name, Command command, + unsigned flags = None, const CommandCompleter& completer = CommandCompleter()); void register_command(const std::vector& command_names, Command command, + unsigned flags = None, const CommandCompleter& completer = CommandCompleter()); private: - struct CommandAndCompleter + struct CommandDescriptor { Command command; + unsigned flags; CommandCompleter completer; }; - std::unordered_map m_commands; + std::unordered_map m_commands; }; } -- cgit v1.2.3