tlx
CmdlineParser::Argument Struct Referenceabstract

base class of all options and parameters More...

Inheritance diagram for CmdlineParser::Argument:
CmdlineParser::ArgumentBool CmdlineParser::ArgumentBytes32 CmdlineParser::ArgumentBytes64 CmdlineParser::ArgumentDouble CmdlineParser::ArgumentFloat CmdlineParser::ArgumentInt CmdlineParser::ArgumentSizeT CmdlineParser::ArgumentString CmdlineParser::ArgumentStringlist CmdlineParser::ArgumentUnsigned

Public Member Functions

 Argument (char key, const std::string &longkey, const std::string &keytype, const std::string &desc, bool required)
 contructor filling most attributes More...
 
virtual ~Argument ()=default
 empty virtual destructor More...
 
virtual const char * type_name () const =0
 return formatted type name to user More...
 
virtual bool process (int &argc, const char *const *&argv)=0
 process one item from command line for this argument More...
 
virtual void print_value (std::ostream &os) const =0
 format value to ostream More...
 
std::string param_text () const
 return 'longkey [keytype]' More...
 
std::string option_text () const
 return '-s, –longkey [keytype]' More...
 

Public Attributes

char key_
 single letter short option, or 0 is none More...
 
std::string longkey_
 long option key or name for parameters More...
 
std::string keytype_
 option type description, e.g. "<#>" to indicate numbers More...
 
std::string desc_
 longer description, which will be wrapped More...
 
bool required_
 required, process() fails if the option/parameter is not found. More...
 
bool found_
 found during processing of command line More...
 
bool repeated_
 repeated argument, i.e. std::vector<std::string> More...
 

Detailed Description

base class of all options and parameters

Definition at line 31 of file cmdline_parser.cpp.

Constructor & Destructor Documentation

Argument ( char  key,
const std::string &  longkey,
const std::string &  keytype,
const std::string &  desc,
bool  required 
)
inline

contructor filling most attributes

Definition at line 49 of file cmdline_parser.cpp.

virtual ~Argument ( )
virtualdefault

empty virtual destructor

Member Function Documentation

std::string option_text ( ) const
inline

return '-s, –longkey [keytype]'

Definition at line 76 of file cmdline_parser.cpp.

std::string param_text ( ) const
inline

return 'longkey [keytype]'

Definition at line 67 of file cmdline_parser.cpp.

Member Data Documentation

std::string desc_

longer description, which will be wrapped

Definition at line 40 of file cmdline_parser.cpp.

bool found_

found during processing of command line

Definition at line 44 of file cmdline_parser.cpp.

char key_

single letter short option, or 0 is none

Definition at line 34 of file cmdline_parser.cpp.

std::string keytype_

option type description, e.g. "<#>" to indicate numbers

Definition at line 38 of file cmdline_parser.cpp.

std::string longkey_

long option key or name for parameters

Definition at line 36 of file cmdline_parser.cpp.

bool repeated_

repeated argument, i.e. std::vector<std::string>

Definition at line 46 of file cmdline_parser.cpp.

bool required_

required, process() fails if the option/parameter is not found.

Definition at line 42 of file cmdline_parser.cpp.


The documentation for this struct was generated from the following file: