dlinear
0.0.1
Delta-complete SMT solver for linear programming
|
Used to parse command line arguments and produce a corresponding Config object to be used throughout the execution. More...
#include <ArgParser.h>
Public Member Functions | |
ArgParser () | |
Construct a new argparser object. | |
void | Parse (int argc, const char **argv) |
Parse the command line arguments. | |
std::string | prompt () const |
Get read-only access to the printable console prompt of the program. | |
Config | ToConfig () const |
Convert the parser to a Config. | |
template<class T > | |
T | get (const std::string &key) const |
Get the value of a parameter from the internal parser. | |
Static Public Member Functions | |
static std::string | version () |
Get read-only access to the version of the program. | |
static std::string | repository_status () |
Get read-only access to the hash status of the repository. | |
Private Member Functions | |
void | AddOptions () |
Add all the options, positional arguments and flags to the parser. | |
void | ValidateOptions () |
Validate the options, ensuring the correctness of the parameters and the consistency of the options. | |
Used to parse command line arguments and produce a corresponding Config object to be used throughout the execution.
The default values of each parameter are defined in the Config class. Besides parsing, a validation step is performed to ensure the correctness of the parameters. If an inconsistency is found, an explication of the error is printed to the console. Under the hood, it uses the argparse library.
Definition at line 27 of file ArgParser.h.
|
inlinenodiscard |
Get the value of a parameter from the internal parser.
T | type of the parameter |
key | name of the parameter |
std::invalid_argument | if the key is not found |
Definition at line 61 of file ArgParser.h.
void dlinear::ArgParser::Parse | ( | int | argc, |
const char ** | argv ) |
Parse the command line arguments.
argc | number of arguments |
argv | array of arguments as strings |
Definition at line 77 of file ArgParser.cpp.
|
nodiscard |
Get read-only access to the printable console prompt of the program.
Definition at line 276 of file ArgParser.cpp.
|
staticnodiscard |
Get read-only access to the hash status of the repository.
Definition at line 274 of file ArgParser.cpp.
|
nodiscard |
Convert the parser to a Config.
The Config object will be used throughout the program to pass the configuration to all the components.
Definition at line 185 of file ArgParser.cpp.
|
private |
Validate the options, ensuring the correctness of the parameters and the consistency of the options.
std::invalid_argument | if the options are inconsistent or incorrect. |
std::runtime_error | if an error occurs during parsing. |
Definition at line 230 of file ArgParser.cpp.
|
staticnodiscard |
Get read-only access to the version of the program.
Definition at line 272 of file ArgParser.cpp.