Parser class.
More...
#include <commandline_parser.hpp>
|
| parser (const char *name) |
| Default constructor.
|
|
void | add_option (const std::string &option, const bool takes_value, const std::string &help_text, const std::set< std::string > &values={}) |
| Add commandline option.
|
|
void | show_help (const std::string &command) const |
| Display help.
|
|
void | parse (const int argc, const char *argv[]) |
| Parse the command line.
|
|
bool | is_option_set (const std::string &option) const |
| Check if option is set.
|
|
template<typename T > |
T | get_option_value (const std::string &option) const |
| Get the option value.
|
|
◆ add_option()
void commandline::parser::add_option |
( |
const std::string & |
option, |
|
|
const bool |
takes_value, |
|
|
const std::string & |
help_text, |
|
|
const std::set< std::string > & |
values = {} |
|
) |
| |
|
inline |
Add commandline option.
- Parameters
-
[in] | option | The command option. |
[in] | takes_value | Flag to indicate the option takes a value. |
[in] | help_text | The help text of the option. |
[in] | values | An optional set of values. |
◆ get_option_value()
template<typename T >
T commandline::parser::get_option_value |
( |
const std::string & |
option | ) |
const |
|
inline |
Get the option value.
- Template Parameters
-
◆ is_option_set()
bool commandline::parser::is_option_set |
( |
const std::string & |
option | ) |
const |
|
inline |
Check if option is set.
- Parameters
-
[in] | option | The option to check. |
◆ parse()
void commandline::parser::parse |
( |
const int |
argc, |
|
|
const char * |
argv[] |
|
) |
| |
|
inline |
Parse the command line.
- Parameters
-
[in] | argc | Number of commandline arguments. |
[in] | argv | Array of commandline arguments. |
◆ show_help()
void commandline::parser::show_help |
( |
const std::string & |
command | ) |
const |
|
inline |
Display help.
- Parameters
-
[in] | command | Name of the program. |
The documentation for this class was generated from the following file: