64 #include "rnr/rnrconfig.h" 126 bool CmdDef::isDefined()
const 128 return (m_nUid >= 0) &&
129 !m_strName.empty() &&
130 (numOfForms() > 0) &&
131 m_formDefs[0].isDefined();
136 for(
size_t i = 0; i < m_formDefs.size(); ++i)
138 m_formDefs[i].reset();
142 void CmdDef::setUid(
const int uid)
147 void CmdDef::setName(
const string &strName)
152 void CmdDef::addHelp(
const char *sSynopsis,
const char *sLongDesc)
154 string strSynopsis(sSynopsis != NULL? sSynopsis:
"");
155 string strLongDesc(sLongDesc != NULL? sLongDesc:
"");
157 addHelp(strSynopsis, strLongDesc);
160 void CmdDef::addHelp(
const string &strSynopsis,
const string &strLongDesc)
162 m_strSynopsis = strSynopsis;
163 m_strLongDesc = strLongDesc;
168 int nIndex = numOfForms();
172 m_formDefs.push_back(formdef);
177 if( (nIndex >= 0) && (nIndex < m_formDefs.size()) )
179 return m_formDefs[nIndex];
189 if( (nIndex >= 0) && (nIndex < m_formDefs.size()) )
191 return m_formDefs[nIndex];
203 os <<
indent() <<
"{" << endl;
213 os <<
indent() <<
"{" << endl;
217 for(
size_t i = 0; i < cmddef.
m_formDefs.size(); ++i)
230 os <<
indent() <<
"}" << endl;
Command line extended argument interface.
std::string m_strSynopsis
short command synopsis
int m_nUid
command unique id
osManipIndent indent()
Left indent at current stream indentation level.
std::string m_strLongDesc
long command description
const int NoUid
Special values.
Of string spaces and their strangian operators.
Compiled command definition class.
std::string m_strName
command name
std::string m_strSyntax
parsable command extended usage syntax
Stream I/O manipulators and helpers.
Command line command definition class interface.
Command line argument definition class interface.
Command line core data types.
int numOfForms() const
Get the total number command forms.
osManipIndent deltaindent(const long nDelta)
Set relative delta indentation level.
std::ostream & operator<<(std::ostream &os, const timespec &obj)
A timespec insertion operator.
CmdFormDefVec m_formDefs
vector of command forms
static CmdFormDef noformdef
constant "no form def" form definition