#include <ArgumentParser.hpp>
Implements a basic argument parser according to the standard using GNU-Getopt
| util::ArgumentParser::ArgumentParser |
( |
int |
argc, |
|
|
char * |
argv[] |
|
) |
| |
CTor, parses the arguments and fills all fields. If –help is found printHelp() is called and the program gets terminated. If no argument is passed the help is printed as well.
- Exceptions
-
| std::runtime_error | if any of the required flags doesn't exist or contains an invalid value |
- Parameters
-
| argc | the number of arguments, as passed into main |
| argv | an array of all arguments, as passed into main |
| auto util::ArgumentParser::getMatch |
( |
| ) |
const -> std::string |
Get the match-config file name as passed by -m or –match. It is guaranteed that this is a valid string but not that the file actually exists or is valid.
- Returns
- a string containing the argument passed with -m or –match
| auto util::ArgumentParser::getPort |
( |
| ) |
const -> uint16_t |
Returns the port if provided by -p or –port, else returns the default port of 8080.
- Returns
- a uint16_t containing the port
| auto util::ArgumentParser::getVerbosity |
( |
| ) |
const -> unsigned int |
Returns the verbosity if provided by -v or –verbosity, else the default verbosity of 0
- Returns
- a unsigned int containing the verbosity
| void util::ArgumentParser::printHelp |
( |
| ) |
|
|
static |
Prints the help message, gets called by the CTor if the -h or –help flag is set.
The documentation for this class was generated from the following files: