tlx
|
base class of all options and parameters More...
Public Member Functions | |
Argument (char key, const std::string &longkey, const std::string &keytype, const std::string &desc, bool required) | |
contructor filling most attributes | |
virtual | ~Argument ()=default |
empty virtual destructor | |
virtual const char * | type_name () const =0 |
return formatted type name to user | |
virtual bool | process (int &argc, const char *const *&argv)=0 |
process one item from command line for this argument | |
virtual void | print_value (std::ostream &os) const =0 |
format value to ostream | |
std::string | param_text () const |
return 'longkey [keytype]' | |
std::string | option_text () const |
return '-s, –longkey [keytype]' |
Public Attributes | |
char | key_ |
single letter short option, or 0 is none | |
std::string | longkey_ |
long option key or name for parameters | |
std::string | keytype_ |
option type description, e.g. "<#>" to indicate numbers | |
std::string | desc_ |
longer description, which will be wrapped | |
bool | required_ |
required, process() fails if the option/parameter is not found. | |
bool | found_ |
found during processing of command line | |
bool | repeated_ |
repeated argument, i.e. std::vector<std::string> |
base class of all options and parameters
Definition at line 33 of file cmdline_parser.cpp.
|
inline |
contructor filling most attributes
Definition at line 53 of file cmdline_parser.cpp.
|
virtualdefault |
empty virtual destructor
|
inline |
return '-s, –longkey [keytype]'
Definition at line 80 of file cmdline_parser.cpp.
|
inline |
return 'longkey [keytype]'
Definition at line 71 of file cmdline_parser.cpp.
|
pure virtual |
format value to ostream
Implemented in CmdlineParser::ArgumentBool, CmdlineParser::ArgumentBytes32, CmdlineParser::ArgumentBytes64, CmdlineParser::ArgumentDouble, CmdlineParser::ArgumentFloat, CmdlineParser::ArgumentInt, CmdlineParser::ArgumentSizeT, CmdlineParser::ArgumentString, CmdlineParser::ArgumentStringlist, and CmdlineParser::ArgumentUnsigned.
|
pure virtual |
process one item from command line for this argument
Implemented in CmdlineParser::ArgumentBool, CmdlineParser::ArgumentBytes32, CmdlineParser::ArgumentBytes64, CmdlineParser::ArgumentDouble, CmdlineParser::ArgumentFloat, CmdlineParser::ArgumentInt, CmdlineParser::ArgumentSizeT, CmdlineParser::ArgumentString, CmdlineParser::ArgumentStringlist, and CmdlineParser::ArgumentUnsigned.
|
pure virtual |
return formatted type name to user
Implemented in CmdlineParser::ArgumentBool, CmdlineParser::ArgumentBytes32, CmdlineParser::ArgumentBytes64, CmdlineParser::ArgumentDouble, CmdlineParser::ArgumentFloat, CmdlineParser::ArgumentInt, CmdlineParser::ArgumentSizeT, CmdlineParser::ArgumentString, CmdlineParser::ArgumentStringlist, and CmdlineParser::ArgumentUnsigned.
std::string desc_ |
longer description, which will be wrapped
Definition at line 43 of file cmdline_parser.cpp.
bool found_ |
found during processing of command line
Definition at line 47 of file cmdline_parser.cpp.
char key_ |
single letter short option, or 0 is none
Definition at line 37 of file cmdline_parser.cpp.
std::string keytype_ |
option type description, e.g. "<#>" to indicate numbers
Definition at line 41 of file cmdline_parser.cpp.
std::string longkey_ |
long option key or name for parameters
Definition at line 39 of file cmdline_parser.cpp.
bool repeated_ |
repeated argument, i.e. std::vector<std::string>
Definition at line 49 of file cmdline_parser.cpp.
bool required_ |
required, process() fails if the option/parameter is not found.
Definition at line 45 of file cmdline_parser.cpp.