ZNC  trunk
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Public Types | Public Member Functions | Static Public Member Functions | Static Private Member Functions | List of all members
CModCommand Class Reference

A helper class for handling commands in modules. More...

#include <Modules.h>

+ Inheritance diagram for CModCommand:
+ Collaboration diagram for CModCommand:

Public Types

typedef void(CModule::* ModCmdFunc )(const CString &sLine)
 Type for the callback function that handles the actual command. More...
 
typedef std::function< void(const
CString &sLine)> 
CmdFunc
 

Public Member Functions

 CModCommand ()
 Default constructor, needed so that this can be saved in a std::map. More...
 
 CModCommand (const CString &sCmd, CModule *pMod, ModCmdFunc func, const CString &sArgs, const CString &sDesc)
 Construct a new CModCommand. More...
 
 CModCommand (const CString &sCmd, CmdFunc func, const COptionalTranslation &Args, const COptionalTranslation &Desc)
 
 CModCommand (const CModCommand &other)=default
 Copy constructor, needed so that this can be saved in a std::map. More...
 
CModCommandoperator= (const CModCommand &other)=default
 Assignment operator, needed so that this can be saved in a std::map. More...
 
void AddHelp (CTable &Table) const
 Add this command to the CTable instance. More...
 
const CStringGetCommand () const
 
CmdFunc GetFunction () const
 
CString GetArgs () const
 
CString GetDescription () const
 
void Call (const CString &sLine) const
 

Static Public Member Functions

static void InitHelp (CTable &Table)
 Initialize a CTable so that it can be used with AddHelp(). More...
 

Static Private Member Functions

static CString t_s (const CString &sEnglish, const CString &sContext="")
 
static CInlineFormatMessage t_f (const CString &sEnglish, const CString &sContext="")
 
static CInlineFormatMessage t_p (const CString &sEnglish, const CString &sEnglishes, int iNum, const CString &sContext="")
 
static CDelayedTranslation t_d (const CString &sEnglish, const CString &sContext="")
 

Detailed Description

A helper class for handling commands in modules.

Member Typedef Documentation

typedef std::function<void(const CString& sLine)> CModCommand::CmdFunc
typedef void(CModule::* CModCommand::ModCmdFunc)(const CString &sLine)

Type for the callback function that handles the actual command.

Constructor & Destructor Documentation

CModCommand::CModCommand ( )

Default constructor, needed so that this can be saved in a std::map.

CModCommand::CModCommand ( const CString sCmd,
CModule pMod,
ModCmdFunc  func,
const CString sArgs,
const CString sDesc 
)

Construct a new CModCommand.

Parameters
sCmdThe name of the command.
funcThe command's callback function.
sArgsHelp text describing the arguments to this command.
sDescHelp text describing what this command does.
CModCommand::CModCommand ( const CString sCmd,
CmdFunc  func,
const COptionalTranslation Args,
const COptionalTranslation Desc 
)
CModCommand::CModCommand ( const CModCommand other)
default

Copy constructor, needed so that this can be saved in a std::map.

Parameters
otherObject to copy from.

Member Function Documentation

void CModCommand::AddHelp ( CTable Table) const

Add this command to the CTable instance.

Parameters
TableInstance of CTable to which this should be added.
Warning
The Table should be initialized via InitHelp().
void CModCommand::Call ( const CString sLine) const
inline
CString CModCommand::GetArgs ( ) const
inline
const CString& CModCommand::GetCommand ( ) const
inline
CString CModCommand::GetDescription ( ) const
inline
CmdFunc CModCommand::GetFunction ( ) const
inline
static void CModCommand::InitHelp ( CTable Table)
static

Initialize a CTable so that it can be used with AddHelp().

Parameters
TableThe instance of CTable to initialize.
CModCommand& CModCommand::operator= ( const CModCommand other)
default

Assignment operator, needed so that this can be saved in a std::map.

Parameters
otherObject to copy from.

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