#include <map_command_handler.hpp>
Classes | |
struct | command |
Public Types | |
typedef void(Worker::* | command_handler) () |
typedef std::map< std::string, command > | command_map |
typedef std::map< std::string, std::string > | command_alias_map |
Public Member Functions | |
map_command_handler () | |
virtual | ~map_command_handler () |
bool | empty () const |
void | dispatch (std::string cmd) |
std::vector< std::string > | get_commands_list () const |
void | command_failed (const std::string &message, bool=false) |
Protected Member Functions | |
void | init_map_default () |
virtual void | init_map ()=0 |
virtual void | print (const std::string &title, const std::string &message)=0 |
virtual std::string | get_flags_description () const |
virtual std::string | get_command_flags_description (const command &) const |
virtual bool | is_enabled (const command &) const |
virtual void | parse_cmd (const std::string &cmd_string) |
virtual std::string | get_arg (unsigned argn) const |
virtual std::string | get_data (unsigned argn=1) const |
virtual std::string | get_cmd () const |
void | command_failed_need_arg (int argn) |
void | print_usage () |
std::string | get_actual_cmd (const std::string &cmd) const |
const command * | get_command (const std::string &cmd) const |
command * | get_command (const std::string &cmd) |
void | help () |
bool | help_command (const std::string &acmd) |
virtual void | register_command (const std::string &cmd, command_handler h, const std::string &help="", const std::string &usage="", const std::string &flags="") |
virtual void | register_alias (const std::string &to_cmd, const std::string &cmd) |
Static Protected Member Functions | |
static void | set_help_on_unknown (bool value) |
static void | set_cmd_prefix (const std::string &value) |
static void | set_cmd_flag (bool value) |
static const std::vector< std::string > | get_aliases (const std::string &cmd) |
Protected Attributes | |
cmd_arg_parser | cap_ |
Static Private Attributes | |
static command_map | command_map_ {} |
static command_alias_map | command_alias_map_ {} |
static bool | help_on_unknown_ = true |
static bool | show_unavailable_ = false |
static std::string | cmd_prefix_ {} |
static bool | cmd_flag_ = false |
Definition at line 122 of file map_command_handler.hpp.
typedef std::map<std::string, std::string> events::map_command_handler< Worker >::command_alias_map |
Definition at line 148 of file map_command_handler.hpp.
typedef void(Worker::* events::map_command_handler< Worker >::command_handler) () |
Definition at line 125 of file map_command_handler.hpp.
typedef std::map<std::string, command> events::map_command_handler< Worker >::command_map |
Definition at line 147 of file map_command_handler.hpp.
|
inline |
Definition at line 150 of file map_command_handler.hpp.
|
inlinevirtual |
Definition at line 154 of file map_command_handler.hpp.
|
inline |
Definition at line 244 of file map_command_handler.hpp.
References _(), events::map_command_handler< Worker >::get_cmd(), and events::map_command_handler< Worker >::print().
Referenced by events::map_command_handler< Worker >::command_failed_need_arg().
|
inlineprotected |
Definition at line 298 of file map_command_handler.hpp.
References events::map_command_handler< Worker >::command_failed(), and VGETTEXT.
|
inline |
Definition at line 161 of file map_command_handler.hpp.
References _(), c, events::map_command_handler< Worker >::cmd_flag_, events::map_command_handler< Worker >::cmd_prefix_, events::map_command_handler< Worker >::command_map_, data, edit_distance_approx(), events::map_command_handler< Worker >::empty(), events::map_command_handler< Worker >::get_actual_cmd(), events::map_command_handler< Worker >::get_cmd(), events::map_command_handler< Worker >::get_command(), events::map_command_handler< Worker >::get_data(), events::map_command_handler< Worker >::help_on_unknown_, i, utf8::index(), events::map_command_handler< Worker >::init_map(), events::map_command_handler< Worker >::init_map_default(), events::map_command_handler< Worker >::is_enabled(), events::map_command_handler< Worker >::parse_cmd(), events::map_command_handler< Worker >::print(), and VGETTEXT.
Referenced by events::menu_handler::do_command(), events::chat_handler::do_speak(), and events::menu_handler::get_commands_list().
|
inline |
Definition at line 156 of file map_command_handler.hpp.
References events::map_command_handler< Worker >::command_map_.
Referenced by events::map_command_handler< Worker >::dispatch().
|
inlineprotected |
Definition at line 309 of file map_command_handler.hpp.
References events::map_command_handler< Worker >::command_alias_map_, and i.
Referenced by events::map_command_handler< Worker >::dispatch(), and events::map_command_handler< Worker >::help_command().
|
inlinestaticprotected |
Definition at line 438 of file map_command_handler.hpp.
References events::map_command_handler< Worker >::command_alias_map_, i, and p.
Referenced by events::map_command_handler< Worker >::help_command().
|
inlineprotectedvirtual |
Reimplemented in events::console_handler.
Definition at line 285 of file map_command_handler.hpp.
References events::map_command_handler< Worker >::cap_, and events::cmd_arg_parser::get_arg().
Referenced by events::map_command_handler< Worker >::help().
|
inlineprotectedvirtual |
Reimplemented in events::console_handler.
Definition at line 294 of file map_command_handler.hpp.
References events::map_command_handler< Worker >::cap_, and events::cmd_arg_parser::get_cmd().
Referenced by events::map_command_handler< Worker >::command_failed(), events::map_command_handler< Worker >::dispatch(), and events::map_command_handler< Worker >::print_usage().
|
inlineprotected |
Definition at line 319 of file map_command_handler.hpp.
References events::map_command_handler< Worker >::command_map_, and i.
|
inlineprotected |
Definition at line 314 of file map_command_handler.hpp.
References events::map_command_handler< Worker >::command_map_, and i.
Referenced by events::map_command_handler< Worker >::dispatch(), and events::map_command_handler< Worker >::help_command().
|
inlineprotectedvirtual |
Definition at line 270 of file map_command_handler.hpp.
Referenced by events::map_command_handler< Worker >::help_command().
|
inline |
Definition at line 235 of file map_command_handler.hpp.
References events::map_command_handler< Worker >::command_map_, and i.
Referenced by events::menu_handler::get_commands_list().
|
inlineprotectedvirtual |
Reimplemented in events::console_handler.
Definition at line 290 of file map_command_handler.hpp.
References events::map_command_handler< Worker >::cap_, and events::cmd_arg_parser::get_data().
Referenced by events::map_command_handler< Worker >::dispatch().
|
inlineprotectedvirtual |
Reimplemented in events::console_handler, and events::chat_command_handler.
Definition at line 265 of file map_command_handler.hpp.
Referenced by events::map_command_handler< Worker >::help().
|
inlineprotected |
Definition at line 324 of file map_command_handler.hpp.
References _(), events::map_command_handler< Worker >::cmd_flag_, events::map_command_handler< Worker >::cmd_prefix_, events::map_command_handler< Worker >::command_map_, events::map_command_handler< Worker >::get_arg(), events::map_command_handler< Worker >::get_flags_description(), events::map_command_handler< Worker >::help_command(), i, events::map_command_handler< Worker >::is_enabled(), events::map_command_handler< Worker >::print(), events::map_command_handler< Worker >::show_unavailable_, and VGETTEXT.
|
inlineprotected |
Definition at line 359 of file map_command_handler.hpp.
References _(), _n(), c, events::map_command_handler< Worker >::cmd_flag_, events::map_command_handler< Worker >::cmd_prefix_, events::map_command_handler< Worker >::get_actual_cmd(), events::map_command_handler< Worker >::get_aliases(), events::map_command_handler< Worker >::get_command(), events::map_command_handler< Worker >::get_command_flags_description(), utils::join(), and events::map_command_handler< Worker >::print().
Referenced by events::map_command_handler< Worker >::help(), and events::map_command_handler< Worker >::print_usage().
|
protectedpure virtual |
Implemented in events::console_handler, and events::chat_command_handler.
Referenced by events::map_command_handler< Worker >::dispatch().
|
inlineprotected |
Definition at line 249 of file map_command_handler.hpp.
References _(), and events::map_command_handler< Worker >::register_command().
Referenced by events::map_command_handler< Worker >::dispatch().
|
inlineprotectedvirtual |
Definition at line 276 of file map_command_handler.hpp.
Referenced by events::map_command_handler< Worker >::dispatch(), and events::map_command_handler< Worker >::help().
|
inlineprotectedvirtual |
Definition at line 280 of file map_command_handler.hpp.
References events::map_command_handler< Worker >::cap_, and events::cmd_arg_parser::parse().
Referenced by events::map_command_handler< Worker >::dispatch().
|
protectedpure virtual |
Implemented in events::console_handler, and events::chat_command_handler.
Referenced by events::map_command_handler< Worker >::command_failed(), events::map_command_handler< Worker >::dispatch(), events::map_command_handler< Worker >::help(), and events::map_command_handler< Worker >::help_command().
|
inlineprotected |
Definition at line 304 of file map_command_handler.hpp.
References events::map_command_handler< Worker >::get_cmd(), and events::map_command_handler< Worker >::help_command().
|
inlineprotectedvirtual |
Reimplemented in events::console_handler.
Definition at line 431 of file map_command_handler.hpp.
References events::map_command_handler< Worker >::command_alias_map_.
|
inlineprotectedvirtual |
Reimplemented in events::console_handler.
Definition at line 419 of file map_command_handler.hpp.
References c, events::map_command_handler< Worker >::command_map_, and h.
Referenced by events::map_command_handler< Worker >::init_map_default().
|
inlinestaticprotected |
Definition at line 415 of file map_command_handler.hpp.
References events::map_command_handler< Worker >::cmd_flag_.
|
inlinestaticprotected |
Definition at line 408 of file map_command_handler.hpp.
References events::map_command_handler< Worker >::cmd_prefix_.
|
inlinestaticprotected |
Definition at line 403 of file map_command_handler.hpp.
References events::map_command_handler< Worker >::help_on_unknown_.
|
protected |
|
inlinestaticprivate |
|
inlinestaticprivate |
|
inlinestaticprivate |
Definition at line 451 of file map_command_handler.hpp.
Referenced by events::map_command_handler< Worker >::get_actual_cmd(), events::map_command_handler< Worker >::get_aliases(), and events::map_command_handler< Worker >::register_alias().
|
inlinestaticprivate |
Definition at line 450 of file map_command_handler.hpp.
Referenced by events::map_command_handler< Worker >::dispatch(), events::map_command_handler< Worker >::empty(), events::map_command_handler< Worker >::get_command(), events::map_command_handler< Worker >::get_commands_list(), events::map_command_handler< Worker >::help(), and events::map_command_handler< Worker >::register_command().
|
inlinestaticprivate |
Definition at line 452 of file map_command_handler.hpp.
Referenced by events::map_command_handler< Worker >::dispatch(), and events::map_command_handler< Worker >::set_help_on_unknown().
|
inlinestaticprivate |
Definition at line 453 of file map_command_handler.hpp.
Referenced by events::map_command_handler< Worker >::help().