![]() |
appkit
1.5.1
RoadNarrows Robotics Application Kit
|
Compiled command form defintion class. More...
#include <CmdFormDef.h>
Public Member Functions | |
| CmdFormDef () | |
| Default constructor. | |
| CmdFormDef (const std::string &strSyntax) | |
| Initialization constructor. | |
| CmdFormDef (const CmdFormDef &src) | |
| Copy constructor. More... | |
| virtual | ~CmdFormDef () |
| Destructor. | |
| CmdFormDef & | operator= (const CmdFormDef &rhs) |
| Assignment operator. More... | |
| bool | isDefined () const |
| int | getParentCmdUid () const |
| Get parent command's unique id. More... | |
| int | getIndex () const |
| Get forms's index. More... | |
| std::string | getSyntax () const |
| Get form's extended usage syntax. | |
| const CmdArgDef & | at (const int nIndex) const |
| Get form's argument at index. More... | |
| const CmdArgDef & | operator[] (const int nIndex) const |
| Index operator. More... | |
| int | numOfArgs () const |
| Get the total number of arguments. More... | |
| int | numOfRequiredArgs () const |
| Get the total number of required arguments. More... | |
| int | numOfOptionalArgs () const |
| Get the total number of optional arguments. More... | |
Protected Member Functions | |
| void | reset () |
| Reset form definition to pre-compiled state. | |
| void | setParent (const int nCmdUid) |
| Set parent's command id. More... | |
| void | setIndex (const int nIndex) |
| Set forms's index. More... | |
| void | setSyntax (const std::string &strSyntax) |
| Set command's extended usage syntax. More... | |
| void | pushArg (CmdArgDef &argdef) |
| Push argument to end of argument list. More... | |
| CmdArgDef & | argAt (const int nIndex) |
| Get form's modifiable argument at index. More... | |
| CmdArgDef & | lastArg () |
| Get the last pushed argument. More... | |
Protected Attributes | |
| int | m_nCmdUid |
| parent command's unique id | |
| int | m_nIndex |
| forms index | |
| std::string | m_strSyntax |
| command extened usage syntax | |
| ArgDefVec | m_argDefs |
| command argument definitions | |
| int | m_nArgcReq |
| number of required arguments | |
| int | m_nArgcOpt |
| number of optional arguments | |
Friends | |
| class | CmdDef |
| class | CommandLine |
| std::ostream & | operator<< (std::ostream &os, const CmdFormDef &formdef) |
| Insert object into output stream. More... | |
Compiled command form defintion class.
Definition at line 91 of file CmdFormDef.h.
| CmdFormDef::CmdFormDef | ( | const CmdFormDef & | src | ) |
Copy constructor.
| src | Source object. |
Definition at line 113 of file CmdFormDef.cxx.
References m_argDefs, m_nArgcOpt, m_nArgcReq, m_nCmdUid, m_nIndex, and m_strSyntax.
|
protected |
Get form's modifiable argument at index.
Protected version of at().
| nIndex | Argument index. |
Definition at line 188 of file CmdFormDef.cxx.
References rnr::cmd::noargdef.
Referenced by rnr::cmd::CommandLine::rlArgDefs().
| const CmdArgDef & CmdFormDef::at | ( | const int | nIndex | ) | const |
Get form's argument at index.
| nIndex | Argument index. |
Definition at line 176 of file CmdFormDef.cxx.
References rnr::cmd::noargdef.
Referenced by getSyntax(), rnr::cmd::CommandLine::matchCommand(), rnr::cmd::CommandLine::matchCommandForm(), and operator[]().
|
inline |
Get forms's index.
Definition at line 152 of file CmdFormDef.h.
References m_nIndex.
Referenced by rnr::cmd::CommandLine::compile(), rnr::cmd::CommandLine::matchCommandForm(), rnr::cmd::CommandLine::parseArgv0(), and rnr::cmd::CommandLine::parseSyntax().
|
inline |
Get parent command's unique id.
Definition at line 142 of file CmdFormDef.h.
References m_nCmdUid.
Referenced by rnr::cmd::CommandLine::matchCommandForm().
|
protected |
Get the last pushed argument.
Definition at line 200 of file CmdFormDef.cxx.
References rnr::io::deltaindent(), rnr::io::indent(), m_argDefs, m_nCmdUid, m_nIndex, m_strSyntax, rnr::cmd::noargdef, numOfArgs(), numOfOptionalArgs(), numOfRequiredArgs(), and operator<<().
Referenced by rnr::cmd::CommandLine::parseArgv0(), rnr::cmd::CommandLine::parseLiteralArg(), rnr::cmd::CommandLine::parseOptionalArgList(), rnr::cmd::CommandLine::parseVariableArg(), and rnr::cmd::CommandLine::parseXorListArg().
|
inline |
Get the total number of arguments.
The first argument (argv0) is the command.
Definition at line 195 of file CmdFormDef.h.
References m_argDefs.
Referenced by lastArg(), rnr::cmd::CommandLine::matchCommandForm(), rnr::cmd::CommandLine::numOfArgs(), rnr::cmd::CommandLine::parseLiteralArg(), rnr::cmd::CommandLine::parseSyntax(), rnr::cmd::CommandLine::parseXorListArg(), and rnr::cmd::CommandLine::rlArgDefs().
|
inline |
Get the total number of optional arguments.
Optional arguments start at argument index numOfRequiredArgs().
Definition at line 221 of file CmdFormDef.h.
References m_nArgcOpt, and operator<<.
Referenced by lastArg(), and rnr::cmd::CommandLine::numOfOptionalArgs().
|
inline |
Get the total number of required arguments.
The required number includes the command argv0.
Required arguments start at argument index 0.
Definition at line 209 of file CmdFormDef.h.
References m_nArgcReq.
Referenced by lastArg(), rnr::cmd::CommandLine::matchCommandForm(), and rnr::cmd::CommandLine::numOfRequiredArgs().
| CmdFormDef & CmdFormDef::operator= | ( | const CmdFormDef & | rhs | ) |
Assignment operator.
| rhs | Right-hand side object. |
Definition at line 127 of file CmdFormDef.cxx.
References m_argDefs, m_nArgcOpt, m_nArgcReq, m_nCmdUid, m_nIndex, and m_strSyntax.
|
inline |
Index operator.
Get form's argument at index.
| nIndex | Argument index. |
Definition at line 183 of file CmdFormDef.h.
References at().
|
protected |
Push argument to end of argument list.
| argdef | Command argument definition. |
Definition at line 167 of file CmdFormDef.cxx.
References rnr::cmd::CmdArgDef::setIndex(), and rnr::cmd::CmdArgDef::setParent().
Referenced by rnr::cmd::CommandLine::parseLiteralArg(), rnr::cmd::CommandLine::parseVariableArg(), and rnr::cmd::CommandLine::parseXorListArg().
|
protected |
Set forms's index.
| nIndex | Zero based index. |
Definition at line 157 of file CmdFormDef.cxx.
Referenced by rnr::cmd::CmdDef::pushForm().
|
protected |
Set parent's command id.
| nCmdUid | Command unique id. |
Definition at line 152 of file CmdFormDef.cxx.
Referenced by rnr::cmd::CmdDef::pushForm().
|
protected |
Set command's extended usage syntax.
| strSyntax | Syntax string. |
Definition at line 162 of file CmdFormDef.cxx.
|
friend |
Insert object into output stream.
| os | Output stream. |
| formdef | Object to insert. |
Referenced by numOfOptionalArgs().