#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 |
std::string util::ArgumentParser::getAddress |
( |
| ) |
const |
Get the address
- Returns
- the value given to the address flag
std::string util::ArgumentParser::getConfigPath |
( |
| ) |
const |
Get the config path
- Returns
- the value given to the teamConfig flag
int util::ArgumentParser::getDifficulty |
( |
| ) |
const |
Return the difficulty
- Returns
- the value given to the difficulty flag or 0
std::string util::ArgumentParser::getLobbyName |
( |
| ) |
const |
Return the lobby
- Returns
- the value given to the lobby flag or "hogwarts"
int util::ArgumentParser::getPort |
( |
| ) |
const |
Return the port
- Returns
- the value given to the port flag or 4488
std::string util::ArgumentParser::getPw |
( |
| ) |
const |
Return the password
- Returns
- the value given to the password flag or "password"
std::string util::ArgumentParser::getUName |
( |
| ) |
const |
Return the username
- Returns
- the value given to the username flag or "Team10Ki"
int util::ArgumentParser::getVerbosity |
( |
| ) |
const |
Return the verbosity
- Returns
- the value given to the verbosity flag or 0
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: