56 #ifndef _RNR_CMD_ARG_DEF_H 57 #define _RNR_CMD_ARG_DEF_H 236 const std::string &
literalAt(
const int nIndex)
const;
267 bool inRange(
const long value)
const;
269 bool inRange(
const double value)
const;
363 double match(
const std::string &strArg,
364 const bool bIgnoreCase =
false)
const;
376 const bool bIgnoreCase =
false)
const;
387 const bool bIgnoreCase =
false)
const;
429 friend std::ostream &
operator<<(std::ostream &os,
456 void setParent(
const int nCmdUid,
const int nFormIndex);
470 void setName(
const std::string &strName);
505 void orFlags(
const unsigned uFlags);
516 #endif // _RNR_CMD_ARG_DEF_H argument has a mutually exclusive list
CmdArgDef()
Default constructor.
std::string constructSyntax() const
Construct syntax equivalent string from argument data.
Command line extended argument interface.
str::StringVec m_literals
literal argument valid values
Command EXTended ARGument class holding parsed command context and the raw and converted argmument va...
friend std::ostream & operator<<(std::ostream &os, const CmdArgDef &argdef)
Insert object into output stream.
std::vector< std::string > StringVec
Useful types.
floating point number (double)
double match(const std::string &strArg, const bool bIgnoreCase=false) const
Match argument string against argument definition pattern.
std::string constructLiteralList(const std::string sep=" ") const
Construct literal list string.
static const std::string lookupFlagNames(const unsigned uFlags)
Look up argument flags, given flags value.
CmdArgDef & operator=(const CmdArgDef &rhs)
Assignment operator.
int numOfLiterals() const
Get the number of mutually exclusive literals.
void setRanges(const RangeVec &ranges)
Set numeric range values.
bool inRange(const long value) const
Check if value is in the specified range.
int m_nCmdUid
parent command's unique id
ArgFlags
Argument flag modifiers.
Number minimum and maximum (sub)range.
Command argument compiled definition class.
unsigned m_uFlags
argument modifiers
const std::string & getRegEx() const
Get the pre-compiled regular expression.
void setParent(const int nCmdUid, const int nFormIndex)
Set parent's command and form id's.
Of string spaces and their strangian operators.
void addLiteralValue(const std::string &strValue)
Add literal value to list of argument values.
void orFlags(const unsigned uFlags)
Or flags into argment modifier flags.
const std::string & literalAt(const int nIndex) const
Get literal value at index.
int m_nIndex
argument index
int m_nFormIndex
parent command's form index
void setType(const ArgType eType)
Set argument's type.
int getParentFormIndex() const
Get parent command form's index.
bool isCommand() const
Test if argument is the command argument (argv0).
Compiled command definition class.
static const std::string lookupArgSymbol(const CmdArgDef::ArgType eType)
Look up argument symbol, given argument type.
CmdExtArg convert(const std::string &strArg, const bool bIgnoreCase=false) const
Convert argument string to type.
unsigned getFlags() const
Get argument's modifier flags.
int getParentCmdUid() const
Get parent command's unique id.
virtual ~CmdArgDef()
Destructor.
RegEx m_re
reg expression argument valid pattern
ArgType m_eType
argument type
bool isOptional() const
Test if argument is an optional argument.
bool isDefined() const
Test if argument definition is sufficiently defined.
std::string m_strName
argument name
ArgType
Argument type enumeration.
int matchLiteral(const std::string &strArg, const bool bIgnoreCase=false) const
Match argument agains literal enumeration list.
std::vector< CmdArgDef > ArgDefVec
vector of argument defs
void setRegEx(const RegEx &re)
Set regular expression value.
identifier (C conforming)
ArgType getType() const
Get argument's type.
const std::string & getName() const
Get argument's name.
Command line core data types.
std::vector< range > RangeVec
vector of subranges
static CmdArgDef::ArgType lookupArgType(const std::string strSymbol)
Look up argument type, given argument type symbol.
The Regular Expression Class interface.
void setIndex(const int nIndex)
Set arguments's command line index.
std::string constructRangeList(const std::string sep=",") const
Construct ranges string.
const RangeVec & getRanges() const
Get numeric range values.
any (quoted) character sequence
RangeVec m_ranges
numeric argument valid ranges
int getIndex() const
Get argument's command line index.
const std::string & getRegEx() const
Get regular expression value.
argument supports repetition
void setName(const std::string &strName)
Set argument's name.
any non-whitespace contiguous char sequence