tlx
Loading...
Searching...
No Matches
CmdlineParser::Argument Class 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
 
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>
 

Detailed Description

base class of all options and parameters

Definition at line 33 of file cmdline_parser.cpp.

Constructor & Destructor Documentation

◆ Argument()

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 53 of file cmdline_parser.cpp.

◆ ~Argument()

virtual ~Argument ( )
virtualdefault

empty virtual destructor

Member Function Documentation

◆ option_text()

std::string option_text ( ) const
inline

return '-s, –longkey [keytype]'

Definition at line 80 of file cmdline_parser.cpp.

◆ param_text()

std::string param_text ( ) const
inline

return 'longkey [keytype]'

Definition at line 71 of file cmdline_parser.cpp.

◆ print_value()

◆ process()

◆ type_name()

Member Data Documentation

◆ desc_

std::string desc_

longer description, which will be wrapped

Definition at line 43 of file cmdline_parser.cpp.

◆ found_

bool found_

found during processing of command line

Definition at line 47 of file cmdline_parser.cpp.

◆ key_

char key_

single letter short option, or 0 is none

Definition at line 37 of file cmdline_parser.cpp.

◆ keytype_

std::string keytype_

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

Definition at line 41 of file cmdline_parser.cpp.

◆ longkey_

std::string longkey_

long option key or name for parameters

Definition at line 39 of file cmdline_parser.cpp.

◆ repeated_

bool repeated_

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

Definition at line 49 of file cmdline_parser.cpp.

◆ required_

bool required_

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

Definition at line 45 of file cmdline_parser.cpp.


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