![]() |
appkit
1.5.1
RoadNarrows Robotics Application Kit
|
Compiled command definition class. More...
#include <CmdDef.h>
Public Member Functions | |
| CmdDef () | |
| Default constructor. | |
| CmdDef (const CmdDef &src) | |
| Copy constructor. More... | |
| virtual | ~CmdDef () |
| Destructor. | |
| CmdDef & | operator= (const CmdDef &rhs) |
| Assignment operator. More... | |
| bool | isDefined () const |
| int | getUid () const |
| Get command's unique id. More... | |
| const std::string & | getName () const |
| Return command's name. More... | |
| const std::string & | getSyntax () const |
| Return command's syntax usage. More... | |
| const std::string & | getSynopsis () const |
| Return command's synopsis. More... | |
| const std::string & | getLongDesc () const |
| Return command's long description. More... | |
| int | numOfForms () const |
| Get the total number command forms. More... | |
| const CmdFormDef & | at (const int nIndex) const |
| Get command form at index. More... | |
| const CmdFormDef & | operator[] (const int nIndex) const |
| Index operator. More... | |
Protected Member Functions | |
| void | reset () |
| Reset command definition to pre-compiled state. | |
| void | setUid (const int uid) |
| Set command's unique id. More... | |
| void | setName (const std::string &strName) |
| Set command's name. More... | |
| void | pushForm (CmdFormDef &formdef) |
| Push new command form to end of form list. More... | |
| CmdFormDef & | formAt (const int nIndex) |
| Get command modifiable form at index. More... | |
| void | addHelp (const char *sSynopsis, const char *sLongDesc) |
| Add help to command. More... | |
| void | addHelp (const std::string &strSynopsis, const std::string &strLongDesc) |
Protected Attributes | |
| int | m_nUid |
| command unique id | |
| std::string | m_strName |
| command name | |
| std::string | m_strSyntax |
| parsable command extended usage syntax | |
| std::string | m_strSynopsis |
| short command synopsis | |
| std::string | m_strLongDesc |
| long command description | |
| CmdFormDefVec | m_formDefs |
| vector of command forms | |
Friends | |
| class | CommandLine |
| std::ostream & | operator<< (std::ostream &os, const CmdDef &cmddef) |
| Insert object into output stream. More... | |
| CmdDef::CmdDef | ( | const CmdDef & | src | ) |
Copy constructor.
| src | Source object. |
Definition at line 102 of file CmdDef.cxx.
References m_formDefs, m_nUid, m_strLongDesc, m_strName, m_strSynopsis, and m_strSyntax.
|
protected |
Add help to command.
| sSynopsis | Short command synopsis. |
| sLongDesc | Long command description. |
| strSynopsis | Short command synopsis. |
| strLongDesc | Long command description. |
Definition at line 152 of file CmdDef.cxx.
| const CmdFormDef & CmdDef::at | ( | const int | nIndex | ) | const |
Get command form at index.
| nIndex | Form's index. |
Definition at line 175 of file CmdDef.cxx.
References rnr::cmd::noformdef.
Referenced by rnr::cmd::CommandLine::matchCommand(), rnr::cmd::CommandLine::numOfArgs(), numOfForms(), rnr::cmd::CommandLine::numOfOptionalArgs(), rnr::cmd::CommandLine::numOfRequiredArgs(), and operator[]().
|
protected |
Get command modifiable form at index.
Protected version of at().
| nIndex | Form's index. |
Definition at line 187 of file CmdDef.cxx.
References rnr::io::deltaindent(), rnr::io::indent(), m_formDefs, m_nUid, m_strLongDesc, m_strName, m_strSynopsis, m_strSyntax, rnr::cmd::noformdef, numOfForms(), and operator<<().
Referenced by rnr::cmd::CommandLine::compile(), and rnr::cmd::CommandLine::match().
|
inline |
Return command's long description.
Definition at line 174 of file CmdDef.h.
References m_strLongDesc.
Referenced by rnr::cmd::addons::execHelp().
|
inline |
Return command's name.
Definition at line 144 of file CmdDef.h.
References m_strName.
Referenced by rnr::cmd::CommandLine::compile(), rnr::cmd::addons::execHelp(), rnr::cmd::CommandLine::finalize(), rnr::cmd::CommandLine::matchCommand(), rnr::cmd::CommandLine::parseArgv0(), and rnr::cmd::CommandLine::parseSyntax().
|
inline |
Return command's synopsis.
Definition at line 164 of file CmdDef.h.
References m_strSynopsis.
Referenced by rnr::cmd::addons::execHelp().
|
inline |
Return command's syntax usage.
Definition at line 154 of file CmdDef.h.
References m_strSyntax.
Referenced by rnr::cmd::addons::execHelp().
|
inline |
Get command's unique id.
Definition at line 134 of file CmdDef.h.
References m_nUid.
Referenced by rnr::cmd::CommandLine::addCommand(), rnr::cmd::CommandLine::compile(), rnr::cmd::addons::execHelp(), rnr::cmd::CommandLine::execute(), rnr::cmd::CommandLine::finalize(), rnr::cmd::CommandLine::parseSyntax(), and rnr::cmd::CommandLine::removeCommand().
|
inline |
Get the total number command forms.
Definition at line 184 of file CmdDef.h.
References at(), and m_formDefs.
Referenced by rnr::cmd::CommandLine::compile(), formAt(), and rnr::cmd::CommandLine::matchCommand().
Assignment operator.
| rhs | Right-hand side object. |
Definition at line 116 of file CmdDef.cxx.
References m_formDefs, m_nUid, m_strLongDesc, m_strName, m_strSynopsis, and m_strSyntax.
|
inline |
Index operator.
Get command form at index.
| nIndex | Argument index. |
Definition at line 207 of file CmdDef.h.
References at(), and operator<<.
|
protected |
Push new command form to end of form list.
| formdef | Command form definition. |
Definition at line 166 of file CmdDef.cxx.
References rnr::cmd::CmdFormDef::setIndex(), and rnr::cmd::CmdFormDef::setParent().
Referenced by rnr::cmd::CommandLine::addCommand().
|
protected |
Set command's name.
| strName | Name string. |
Definition at line 147 of file CmdDef.cxx.
Referenced by rnr::cmd::CommandLine::parseArgv0().
|
protected |
Set command's unique id.
| uid | Unique id. |
Definition at line 142 of file CmdDef.cxx.
Referenced by rnr::cmd::CommandLine::addCommand().
|
friend |
Insert object into output stream.
| os | Output stream. |
| cmddef | Object to insert. |
Referenced by operator[]().