210 const std::string value,
396 bool displayShort=
true,
397 bool displayLong=
true)
const;
555 #include "CmdArg.icc" CmdArg::Syntax syntax() const
Retrieve the syntax flags for this argument.
virtual bool parse(const char *arg, const char *&endptr, CmdLine &cmd)=0
Parse a value string.
virtual std::string valueAsString() const =0
Returns the argument's value.
virtual ~CmdArg()
Destructor.
argument value must be in the same token
item was matched as a keyword
value was in a separate token
virtual std::string getDefaultValueString() const
Returns the default value as a string.
void setFlags(CmdArg::CmdLineFlags f)
Toggles specified flags.
item was matched as an option
Syntax
Flags that define the argument syntax.
bool modified() const
Returns true if the argument was parsed at the last parsing run.
The CmdArg class is the abstract base class for all command line arguments.
virtual unsigned int fixedSize() const
Return fixed size if this CmdArg is a fixed list, return 0 otherwise.
CmdArg::CmdLineFlags pFlags
argument is not to be printed in usage
bool hasSyntax(CmdArg::Syntax s) const
Returns true if the argument's syntax flags contain s.
const std::string description() const
Get the description (help-message) of this argument.
void adjustSyntax()
Adjust and correct specified syntax flags.
bool hasFlag(CmdArg::CmdLineFlags f) const
Returns true if the argument's flags contain f.
virtual bool hasDefaultValue() const
Returns true if a default value was specified.
argument value is a list of fixed size
item was matched as a positional argument
const std::string synopsis(bool displayShort=true, bool displayLong=true) const
Generates and returns the arguments synopsis.
The CmdLine class is a parser for command line arguments.
CmdArg::CmdLineFlags flags() const
Retrieve the flags that say how this argument was specified.
CmdLineFlags
Flags that say how the argument was specied on the command-line.
argument value is required
argument value is optional
CmdArg(char shortName, const std::string longName, const std::string valueName, const std::string description, CmdArg::Syntax syntax_flags=isOPTVALREQ)
Create an argument that takes a value.
bool given() const
Returns true if the argument was parsed in any of the parsing runs.
std::string pErrorMessage
unsigned int sequence() const
Get the sequence number corresponding to the last time this argument was matched on the command-line...
const std::string errorMsg() const
Returns error message of last parsing.
virtual unsigned int remainingSize() const
Return number of remaining values if this CmdArg is a fixed list, return 0 otherwise.
argument value must be in a separate token
char shortName() const
Returns the argument's short name.
void clearFlags(CmdArg::CmdLineFlags f=ALLFLAGS)
Clears the specified flags.
void setErrorMsg(const std::string &msg)
Sets the error message.
virtual void clearFixedList()
If the argument is a fixed list, this function clears all its values.
const std::string valueName() const
Returns the argument's value name.
const std::string longName() const
Returns the argument's long name.
void clearErrorMsg()
Clears the error message.
virtual std::string valueTypeAsString() const =0
Returns the argument's value type.