The Battle for Wesnoth  1.15.1+dev
Classes | Public Types | Public Member Functions | Protected Member Functions | Static Protected Member Functions | Protected Attributes | Static Private Attributes | List of all members
events::map_command_handler< Worker > Class Template Referenceabstract

#include <map_command_handler.hpp>

Classes

struct  command
 

Public Types

typedef void(Worker::* command_handler) ()
 
typedef std::map< std::string, commandcommand_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 commandget_command (const std::string &cmd) const
 
commandget_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 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_
 

Detailed Description

template<class Worker>
class events::map_command_handler< Worker >

Definition at line 121 of file map_command_handler.hpp.

Member Typedef Documentation

◆ command_alias_map

template<class Worker>
typedef std::map<std::string, std::string> events::map_command_handler< Worker >::command_alias_map

Definition at line 147 of file map_command_handler.hpp.

◆ command_handler

template<class Worker>
typedef void(Worker::* events::map_command_handler< Worker >::command_handler) ()

Definition at line 124 of file map_command_handler.hpp.

◆ command_map

template<class Worker>
typedef std::map<std::string, command> events::map_command_handler< Worker >::command_map

Definition at line 146 of file map_command_handler.hpp.

Constructor & Destructor Documentation

◆ map_command_handler()

template<class Worker>
events::map_command_handler< Worker >::map_command_handler ( )
inline

Definition at line 149 of file map_command_handler.hpp.

◆ ~map_command_handler()

template<class Worker>
virtual events::map_command_handler< Worker >::~map_command_handler ( )
inlinevirtual

Definition at line 153 of file map_command_handler.hpp.

Member Function Documentation

◆ command_failed()

template<class Worker>
void events::map_command_handler< Worker >::command_failed ( const std::string &  message,
bool  = false 
)
inline

Definition at line 208 of file map_command_handler.hpp.

◆ command_failed_need_arg()

template<class Worker>
void events::map_command_handler< Worker >::command_failed_need_arg ( int  argn)
inlineprotected

Definition at line 262 of file map_command_handler.hpp.

◆ dispatch()

template<class Worker>
void events::map_command_handler< Worker >::dispatch ( std::string  cmd)
inline

◆ empty()

template<class Worker>
bool events::map_command_handler< Worker >::empty ( ) const
inline

Definition at line 155 of file map_command_handler.hpp.

◆ get_actual_cmd()

template<class Worker>
std::string events::map_command_handler< Worker >::get_actual_cmd ( const std::string &  cmd) const
inlineprotected

Definition at line 273 of file map_command_handler.hpp.

◆ get_aliases()

template<class Worker>
static const std::vector<std::string> events::map_command_handler< Worker >::get_aliases ( const std::string &  cmd)
inlinestaticprotected

Definition at line 380 of file map_command_handler.hpp.

◆ get_arg()

template<class Worker>
virtual std::string events::map_command_handler< Worker >::get_arg ( unsigned  argn) const
inlineprotectedvirtual

Reimplemented in events::console_handler.

Definition at line 249 of file map_command_handler.hpp.

◆ get_cmd()

template<class Worker>
virtual std::string events::map_command_handler< Worker >::get_cmd ( ) const
inlineprotectedvirtual

Reimplemented in events::console_handler.

Definition at line 258 of file map_command_handler.hpp.

◆ get_command() [1/2]

template<class Worker>
const command* events::map_command_handler< Worker >::get_command ( const std::string &  cmd) const
inlineprotected

Definition at line 278 of file map_command_handler.hpp.

◆ get_command() [2/2]

template<class Worker>
command* events::map_command_handler< Worker >::get_command ( const std::string &  cmd)
inlineprotected

Definition at line 283 of file map_command_handler.hpp.

◆ get_command_flags_description()

template<class Worker>
virtual std::string events::map_command_handler< Worker >::get_command_flags_description ( const command ) const
inlineprotectedvirtual

Definition at line 234 of file map_command_handler.hpp.

◆ get_commands_list()

template<class Worker>
std::vector<std::string> events::map_command_handler< Worker >::get_commands_list ( ) const
inline

Definition at line 199 of file map_command_handler.hpp.

Referenced by events::menu_handler::get_commands_list().

◆ get_data()

template<class Worker>
virtual std::string events::map_command_handler< Worker >::get_data ( unsigned  argn = 1) const
inlineprotectedvirtual

Reimplemented in events::console_handler.

Definition at line 254 of file map_command_handler.hpp.

◆ get_flags_description()

template<class Worker>
virtual std::string events::map_command_handler< Worker >::get_flags_description ( ) const
inlineprotectedvirtual

Reimplemented in events::console_handler, and events::chat_command_handler.

Definition at line 229 of file map_command_handler.hpp.

◆ help()

template<class Worker>
void events::map_command_handler< Worker >::help ( )
inlineprotected

Definition at line 288 of file map_command_handler.hpp.

◆ help_command()

template<class Worker>
bool events::map_command_handler< Worker >::help_command ( const std::string &  acmd)
inlineprotected

Definition at line 318 of file map_command_handler.hpp.

◆ init_map()

template<class Worker>
virtual void events::map_command_handler< Worker >::init_map ( )
protectedpure virtual

◆ init_map_default()

template<class Worker>
void events::map_command_handler< Worker >::init_map_default ( )
inlineprotected

Definition at line 213 of file map_command_handler.hpp.

◆ is_enabled()

template<class Worker>
virtual bool events::map_command_handler< Worker >::is_enabled ( const command ) const
inlineprotectedvirtual

Definition at line 240 of file map_command_handler.hpp.

◆ parse_cmd()

template<class Worker>
virtual void events::map_command_handler< Worker >::parse_cmd ( const std::string &  cmd_string)
inlineprotectedvirtual

Definition at line 244 of file map_command_handler.hpp.

◆ print()

template<class Worker>
virtual void events::map_command_handler< Worker >::print ( const std::string &  title,
const std::string &  message 
)
protectedpure virtual

◆ print_usage()

template<class Worker>
void events::map_command_handler< Worker >::print_usage ( )
inlineprotected

Definition at line 268 of file map_command_handler.hpp.

◆ register_alias()

template<class Worker>
virtual void events::map_command_handler< Worker >::register_alias ( const std::string &  to_cmd,
const std::string &  cmd 
)
inlineprotectedvirtual

Reimplemented in events::console_handler.

Definition at line 373 of file map_command_handler.hpp.

◆ register_command()

template<class Worker>
virtual void events::map_command_handler< Worker >::register_command ( const std::string &  cmd,
command_handler  h,
const std::string &  help = "",
const std::string &  usage = "",
const std::string &  flags = "" 
)
inlineprotectedvirtual

Reimplemented in events::console_handler.

Definition at line 361 of file map_command_handler.hpp.

◆ set_cmd_prefix()

template<class Worker>
static void events::map_command_handler< Worker >::set_cmd_prefix ( const std::string &  value)
inlinestaticprotected

Definition at line 357 of file map_command_handler.hpp.

◆ set_help_on_unknown()

template<class Worker>
static void events::map_command_handler< Worker >::set_help_on_unknown ( bool  value)
inlinestaticprotected

Definition at line 352 of file map_command_handler.hpp.

Member Data Documentation

◆ cap_

template<class Worker>
cmd_arg_parser events::map_command_handler< Worker >::cap_
protected

Definition at line 349 of file map_command_handler.hpp.

◆ cmd_prefix_

template<class Worker>
std::string events::map_command_handler< Worker >::cmd_prefix_
staticprivate

Definition at line 396 of file map_command_handler.hpp.

◆ command_alias_map_

template<class Worker>
map_command_handler< Worker >::command_alias_map events::map_command_handler< Worker >::command_alias_map_
staticprivate

Definition at line 393 of file map_command_handler.hpp.

◆ command_map_

template<class Worker>
map_command_handler< Worker >::command_map events::map_command_handler< Worker >::command_map_
staticprivate

Definition at line 392 of file map_command_handler.hpp.

◆ help_on_unknown_

template<class Worker>
bool events::map_command_handler< Worker >::help_on_unknown_ = true
staticprivate

Definition at line 394 of file map_command_handler.hpp.

◆ show_unavailable_

template<class Worker>
bool events::map_command_handler< Worker >::show_unavailable_ = false
staticprivate

Definition at line 395 of file map_command_handler.hpp.


The documentation for this class was generated from the following file: