args-parser 6.3.3
|
Argument with one value that can be present only once in the command line. More...
#include <arg.hpp>
Public Member Functions | |
template<typename T > | |
Arg (Char flag, T &&name, bool isWithValue=false, bool isRequired=false) | |
Construct argument with flag and name. | |
Arg (Char flag, bool isWithValue=false, bool isRequired=false) | |
Construct argument only with flag, without name. | |
template<typename T > | |
Arg (T &&name, bool isWithValue=false, bool isRequired=false) | |
Construct argument only with name, without flag. | |
virtual | ~Arg () |
ArgType | type () const override |
String | name () const override |
bool | isWithValue () const override |
void | setWithValue (bool on=true) |
Set is this argument with value. | |
bool | isRequired () const override |
void | setRequired (bool on=true) |
Set required. | |
bool | isDefined () const override |
void | setDefined (bool on=true) |
Set defined. | |
virtual const String & | value () const |
virtual void | setValue (const String &v) |
Set value. | |
const String & | flag () const override |
void | setFlag (Char f) |
Set flag. | |
const String & | argumentName () const override |
void | setArgumentName (const String &name) |
Set argument name. | |
const String & | valueSpecifier () const override |
void | setValueSpecifier (const String &vs) |
Set value specifier. | |
const String & | description () const override |
void | setDescription (const String &desc) |
Set description. | |
const String & | longDescription () const override |
void | setLongDescription (const String &desc) |
Set long description. | |
virtual const String & | defaultValue () const |
virtual void | setDefaultValue (const String &v) |
Set default value. | |
bool | isMisspelledName (const String &name, StringList &possibleNames) const override |
void | clear () override |
Clear state of the argument. | |
Public Member Functions inherited from Args::ArgIface | |
ArgIface () | |
virtual | ~ArgIface () |
CmdLine * | cmdLine () const |
Protected Member Functions | |
ArgIface * | findArgument (const String &name) override |
void | process (Context &context) override |
Process argument's staff, for example take values from context. | |
void | checkCorrectnessBeforeParsing (StringList &flags, StringList &names) const override |
Check correctness of the argument before parsing. | |
void | checkCorrectnessAfterParsing () const override |
Check correctness of the argument after parsing. | |
Protected Member Functions inherited from Args::ArgIface | |
virtual void | setCmdLine (CmdLine *cmdLine) |
Set command line parser. | |
Argument with one value that can be present only once in the command line.
Args::Arg::Arg | ( | Char | flag, |
T && | name, | ||
bool | isWithValue = false , |
||
bool | isRequired = false |
||
) |
|
inlineexplicit |
|
explicit |
|
inlineoverridevirtual |
|
inlineoverrideprotectedvirtual |
Check correctness of the argument after parsing.
Implements Args::ArgIface.
|
inlineoverrideprotectedvirtual |
Check correctness of the argument before parsing.
Implementation of this method must add his flag and name to the flags and names.
flags | All known flags. |
names | All known names. |
Implements Args::ArgIface.
|
inlineoverridevirtual |
|
inlinevirtual |
|
inlineoverridevirtual |
Implements Args::ArgIface.
Pointer | to the ArgIface if this argument handles argument with the given name. |
nullptr | if this argument doesn't know about argument with name. |
name | Name of the argument. Can be for example "-t" or "--timeout". |
Implements Args::ArgIface.
|
inlineoverridevirtual |
|
inlineoverridevirtual |
|
inlineoverridevirtual |
name | Name to check (misspelled). |
possibleNames | List of possible names for the given misspelled name. |
Implements Args::ArgIface.
|
inlineoverridevirtual |
Implements Args::ArgIface.
|
inlineoverridevirtual |
Implements Args::ArgIface.
|
inlineoverridevirtual |
Implements Args::ArgIface.
|
inlineoverridevirtual |
If name is empty returned value should be a flag. I.e. for example "-t" or "--timeout"
Implements Args::ArgIface.
|
inlineoverrideprotectedvirtual |
Process argument's staff, for example take values from context.
This method invokes exactly at that moment when parser has found this argument.
context | Context of the command line. |
Implements Args::ArgIface.
Reimplemented in Args::Help, and Args::MultiArg.
|
inline |
|
inlinevirtual |
|
inline |
|
inline |
|
inline |
|
inline |
|
inlinevirtual |
|
inline |
|
inline |
|
inlineoverridevirtual |
|
inlinevirtual |
Reimplemented in Args::MultiArg.
|
inlineoverridevirtual |