The base class for all command line options.
More...
#include <mia/core/cmdoption.hh>
|
static const bool | not_required |
| readability constant to show that an option is not required More...
|
|
static const bool | required |
| readability constant to show that an option is required More...
|
|
The base class for all command line options.
The base class of all possible command line options. It defines the interface of the options as well as some basic functionality to create help strings.
Definition at line 50 of file cmdoption.hh.
CCmdOption::CCmdOption |
( |
char |
short_opt, |
|
|
const char * |
long_opt, |
|
|
const char * |
long_help, |
|
|
const char * |
short_help, |
|
|
bool |
required |
|
) |
| |
The constructor
- Parameters
-
short_opt | the short option character |
long_opt | the long option name |
long_help | a long help string |
short_help | help to print out when only usage information is requested |
required | set to true if the option must be set by the user |
virtual CCmdOption::~CCmdOption |
( |
) | |
|
|
virtual |
ensure virtual destruction
Add this option to the given option maps
- Parameters
-
sm | a CShortoptionMap to add this option to |
lm | a CLongoptionMap to add this option to |
void CCmdOption::clear_required |
( |
) | |
|
|
protected |
clear the "required" flag
virtual void CCmdOption::do_get_long_help |
( |
std::ostream & |
os) | |
const |
|
protectedvirtual |
write the long help string to a stream
- Parameters
-
void CCmdOption::get_long_help |
( |
std::ostream & |
os) | |
const |
Print the long option name of the option to an output stream
- Parameters
-
std::string CCmdOption::get_long_help_xml |
( |
xmlpp::Element & |
parent, |
|
|
HandlerHelpMap & |
handler_map |
|
) |
| const |
Returns help string tailered for the XML help creation system and adds used plug-in handlers to the helper map
- Parameters
-
| parent | the parent xml node to which to add documentation |
[in,out] | handler_map | the map of possibely recoursively called plug-in handlers |
- Returns
- the text relate to the help
const char* CCmdOption::get_long_option |
( |
) | |
const |
- Returns
- the long name of the option
size_t CCmdOption::get_needed_args |
( |
) | |
const |
- Returns
- how many arguments after the option argument on the command line will be used by this option
void CCmdOption::get_opt_help |
( |
std::ostream & |
os) | |
const |
Print the help of the option to an output stream
- Parameters
-
char CCmdOption::get_short_option |
( |
) | |
const |
- Returns
- the long name of the option
const std::string CCmdOption::get_value_as_string |
( |
) | |
const |
- Returns
- the options value as string
bool CCmdOption::is_required |
( |
) | |
const |
- Returns
- true if the option is a required option and hasn't been set
const char* CCmdOption::long_help |
( |
) | |
const |
- Returns
- the long help string
void CCmdOption::post_set |
( |
) | |
|
This function must be called after the parameter was set through a string in order to handle complex initialization like done for factory based command line parameters
void CCmdOption::print_short_help |
( |
std::ostream & |
os) | |
const |
Print the short help of the option to an output stream
- Parameters
-
void CCmdOption::set_value |
( |
const char * |
str_value) | |
|
Set the value of the option parameter based on the input string
- Parameters
-
str_value | the string value to be vonverted to the option value |
void CCmdOption::write_value |
( |
std::ostream & |
os) | |
const |
Writes out the value of the option to an output stream
- Parameters
-
os | the output stream to write this options value to |
const bool CCmdOption::not_required |
|
static |
readability constant to show that an option is not required
Definition at line 54 of file cmdoption.hh.
const bool CCmdOption::required |
|
static |
readability constant to show that an option is required
Definition at line 57 of file cmdoption.hh.
The documentation for this class was generated from the following file: