ZNC
trunk
|
A helper class for handling commands in modules. More...
#include <Modules.h>
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... | |
CModCommand & | operator= (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 CString & | GetCommand () 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... | |
A helper class for handling commands in modules.
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.
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.
sCmd | The name of the command. |
func | The command's callback function. |
sArgs | Help text describing the arguments to this command. |
sDesc | Help text describing what this command does. |
CModCommand::CModCommand | ( | const CString & | sCmd, |
CmdFunc | func, | ||
const COptionalTranslation & | Args, | ||
const COptionalTranslation & | Desc | ||
) |
|
default |
Copy constructor, needed so that this can be saved in a std::map.
other | Object to copy from. |
void CModCommand::AddHelp | ( | CTable & | Table | ) | const |
Add this command to the CTable instance.
Table | Instance of CTable to which this should be added. |
|
inline |
|
inline |
|
inline |
|
inline |
References COptionalTranslation::Resolve().
|
inline |
|
static |
|
default |
Assignment operator, needed so that this can be saved in a std::map.
other | Object to copy from. |