|
RXtoRINEX
V2.1
RXtoRINEX provides tools to collect data from GPS / GNSS receivers in mobile devices, convert them to RINEX or RTK formats, and process RINEX files.
|
#include <ArgParser.h>
Public Member Functions | |
| ArgParser (void) | |
| ~ArgParser (void) | |
| int | addOption (char *, char *, char *, char *, char *) |
| int | addOption (char *, char *, char *, char *, bool) |
| int | addOperator (char *) |
| bool | getBoolOpt (int) |
| string | getStrOpt (int) |
| string | getOperator (int) |
| void | usage (string, string) |
| void | parseArgs (int, char **) |
| string | showOptValues () |
| string | showOpeValues () |
Friends | |
| class | Option |
ArgParser class defines a data container for options and operators passed as arguments in the command line. A program using ArgParser would perform the following steps after declaring an ArgParser object:
| ArgParser::ArgParser | ( | void | ) |
Constructs an empty ArgParser object.
| ArgParser::~ArgParser | ( | void | ) |
Destructs ArgParser objects.
| int ArgParser::addOperator | ( | char * | v | ) |
addOperator adds an operator with the give default string value to the ArgParser object.
| v | default value of the operator |
| int ArgParser::addOption | ( | char * | s, |
| char * | l, | ||
| char * | d, | ||
| char * | u, | ||
| char * | sv | ||
| ) |
addOption adds a string type option to the ArgParser object.
| s | short name for the option (-x) |
| l | long name for the option (–xxxxx) |
| d | a word describing the option value |
| u | an explanation on usage of this option |
| sv | default string value for the option |
| int ArgParser::addOption | ( | char * | s, |
| char * | l, | ||
| char * | d, | ||
| char * | u, | ||
| bool | bv | ||
| ) |
addOption adds a boolean type option to the ArgParser object.
| s | short name for the option (-x) |
| l | long name for the option (–xxxxx) |
| d | a word describing the option value |
| u | an explanation on usage of this option. Note that if default value is positive, explanation has to be stated in negative terms, like "Don't ..." |
| bv | default boolean value for the option |
| bool ArgParser::getBoolOpt | ( | int | id | ) |
getBoolOpt gets the current value of the boolean type option with the given identification.
| id | identification of the option |
| error | string with message, when it cannot find the option |
| string ArgParser::getOperator | ( | int | index | ) |
getOperator gets the value of the string operator located in the given index.
| index | of the operator requested in the operators vector (0 to the 1st, 1 to the 2nd, ...) |
| error | string with a message, when the operator does not exist |
| string ArgParser::getStrOpt | ( | int | id | ) |
getStrOpt gets the current value of the string type option with the given identification.
| id | identification of the option |
| error | string with message, when it cannot find the option |
| void ArgParser::parseArgs | ( | int | argc, |
| char ** | argv | ||
| ) |
parseArgs parses the argument list extracting Options and Operands to the ArgParser container. Parsing starts from argv[1], and stops when the last argument is parsed or an error is detected. Correct options and / or operands parsed from correct arguments are stored in the ArgParser object. When error is detected the parsing stops, and an exception is raised. The caller shall catch it.
| argc | number of arguments passed (as per main) |
| argv | the command line argument as provided to the program |
| error | string with a message describing the argument error |
| string ArgParser::showOpeValues | ( | ) |
showOpeValues provides the values of operators.
| string ArgParser::showOptValues | ( | ) |
showOptValues provides a text description of options and their current values.
| void ArgParser::usage | ( | string | message, |
| string | howUse | ||
| ) |
usage provides information through cerr on usage using data from the options definition.
| message | argument error to be displayed |
| howUse | text describing how to use the command line |
1.8.9.1