#include <option_parser.h>
|
template<typename T > |
option_parser & | operator() (T &value, const std::string &flag, const std::string &help) |
|
template<typename T > |
option_parser & | operator() (const value_container< T > &value, const std::string &flag, const std::string &help) |
|
bool | is_help_requested (int argc, const char **argv) |
|
void | parse (int &argc, const char **argv) |
|
void | check_for_unknown_options (const int argc, const char **argv) |
|
void | display_help (std::ostream &out, const char *prefix="\t", const char *sep=": ", const char *postfix="\n") |
|
Container for options
Performs:
- Option parsing from the command line
- Display help message
void check_for_unknown_options |
( |
const int |
argc, |
|
|
const char ** |
argv |
|
) |
| |
|
inline |
Check for unknown options
If any exist, throw an exception
void display_help |
( |
std::ostream & |
out, |
|
|
const char * |
prefix = "\t" , |
|
|
const char * |
sep = ": " , |
|
|
const char * |
postfix = "\n" |
|
) |
| |
|
inline |
Write option description to the given output stream
- Parameters
-
out | output stream |
prefix | prefix to option description |
sep | separator between option name and description |
postfix | trailing text |
bool is_help_requested |
( |
int |
argc, |
|
|
const char ** |
argv |
|
) |
| |
|
inline |
Check if help was requested
- Parameters
-
argc | number of arguments |
argv | list of string arguments |
- Returns
- true if help was requested
option_parser& operator() |
( |
T & |
value, |
|
|
const std::string & |
flag, |
|
|
const std::string & |
help |
|
) |
| |
|
inline |
Add option with corresponding value to the container
- Parameters
-
value | reference to value to update (most be persistent!) |
flag | name of the option |
help | option description |
- Returns
- reference to self
Add option with corresponding value to the container
- Parameters
-
value | reference to value to update (most be persistent!) |
flag | name of the option |
help | option description |
- Returns
- reference to self
void parse |
( |
int & |
argc, |
|
|
const char ** |
argv |
|
) |
| |
|
inline |
Parse a command line
- Parameters
-
argc | number of arguments |
argv | list of string arguments |
The documentation for this class was generated from the following file: