#include <ArArgumentParser.h>
Public Member Functions | |
void | addDefaultArgument (const char *argument) |
Adds a string as a default argument. | |
ArArgumentParser (ArArgumentBuilder *builder) | |
Constructor, takes an argument builder. | |
ArArgumentParser (int *argc, char **argv) | |
Constructor, takes the argc argv. | |
bool | checkArgument (char *argument) |
Returns true if the argument was found. | |
bool | checkArgumentVar (char *argument,...) |
Returns true if the argument was found. | |
bool | checkHelpAndWarnUnparsed (unsigned int numArgsOkay=0) |
Checks for the help strings and warns about unparsed arguments. | |
char * | checkParameterArgument (char *argument, bool returnFirst=false) |
Returns the word/argument after given argument. | |
bool | checkParameterArgumentBool (char *argument, bool *dest, bool *wasReallySet=NULL, bool returnFirst=false) |
Returns the word/argument after given argument. | |
bool | checkParameterArgumentBoolVar (bool *wasReallySet, bool *dest, char *argument,...) |
Returns the word/argument after given argument. | |
bool | checkParameterArgumentInteger (char *argument, int *dest, bool *wasReallySet=NULL, bool returnFirst=false) |
Returns the integer after given argument. | |
bool | checkParameterArgumentIntegerVar (bool *wasReallySet, int *dest, char *argument,...) |
Returns the integer after given argument. | |
bool | checkParameterArgumentString (char *argument, const char **dest, bool *wasReallySet=NULL, bool returnFirst=false) |
Returns the word/argument after given argument. | |
bool | checkParameterArgumentStringVar (bool *wasReallySet, const char **dest, char *argument,...) |
Returns the word/argument after given argument. | |
char * | checkParameterArgumentVar (char *argument,...) |
Returns the word/argument after given argument. | |
const char * | getArg (size_t whichArg) const |
Gets a specific argument. | |
size_t | getArgc (void) const |
Gets how many arguments are left in this parser. | |
char ** | getArgv (void) const |
Gets the argv. | |
void | loadDefaultArguments (void) |
Adds args from default files and environmental variables. | |
void | log (void) const |
Prints out the arguments left in this parser. | |
void | removeArg (size_t which) |
Internal function to remove an argument that was parsed. | |
~ArArgumentParser () | |
Destructor. | |
Static Public Member Functions | |
static void | addDefaultArgumentEnv (const char *env) |
Adds another file or environmental variable to the list of defaults. | |
static void | addDefaultArgumentFile (const char *file) |
Adds another file or environmental variable to the list of defaults. | |
static void | logDefaultArgumentLocations (void) |
Logs the default argument locations. | |
Protected Attributes | |
int * | myArgc |
char ** | myArgv |
ArArgumentBuilder * | myBuilder |
char | myEmptyArg [1] |
bool | myOwnBuilder |
bool | myUsingBuilder |
Static Protected Attributes | |
static std::list< bool > | ourDefaultArgumentLocIsFile |
static std::list< std::string > | ourDefaultArgumentLocs |
This class is made for parsing arguments form an argc/argv set, an argument builder or just a string (for winmain)
It will also load up some default arguments you call loadDefaultArguments. You can add files or environmental variables to the list of default argument locations with addDefaultArgumentLocation.
Definition at line 43 of file ArArgumentParser.h.
|
Constructor, takes the argc argv.
Definition at line 41 of file ArArgumentParser.cpp. |
|
Constructor, takes an argument builder.
Definition at line 56 of file ArArgumentParser.cpp. |
|
Adds another file or environmental variable to the list of defaults. This adds an environmental variable to the list of default argument locations. Definition at line 583 of file ArArgumentParser.cpp. Referenced by Aria::init(). |
|
Adds another file or environmental variable to the list of defaults. This adds a file to the list of default argument locations. Definition at line 572 of file ArArgumentParser.cpp. Referenced by Aria::init(). |
|
Returns true if the argument was found.
Definition at line 92 of file ArArgumentParser.cpp. References getArgc(), getArgv(), and removeArg(). Referenced by checkArgumentVar(), checkHelpAndWarnUnparsed(), and ArDaemonizer::daemonize(). |
|
Checks for the help strings and warns about unparsed arguments. This function returns false if there was a help request in the parser (so the program should show the help and exit) and also warns about unhandled arguments (it doesn't mind them, just says they're around). Definition at line 613 of file ArArgumentParser.cpp. References checkArgument(), getArg(), getArgc(), and ArLog::log(). |
|
Returns the word/argument after given argument.
Definition at line 396 of file ArArgumentParser.cpp. References getArgc(), getArgv(), and removeArg(). Referenced by checkParameterArgumentBool(), checkParameterArgumentInteger(), checkParameterArgumentString(), and checkParameterArgumentVar(). |
|
Returns the word/argument after given argument. This is like checkParameterArgument but lets you fail out if the argument is there but the parameter for it is not
Definition at line 229 of file ArArgumentParser.cpp. References checkParameterArgument(), and ArLog::log(). Referenced by checkParameterArgumentBoolVar(). |
|
Returns the word/argument after given argument. This is like checkParameterArgument but lets you fail out if the argument is there but the parameter for it is not
Definition at line 200 of file ArArgumentParser.cpp. References checkParameterArgumentBool(). |
|
Returns the integer after given argument. This is like checkParameterArgument but lets you fail out if the argument is there but the parameter for it is not
Definition at line 321 of file ArArgumentParser.cpp. References checkParameterArgument(), and ArLog::log(). Referenced by checkParameterArgumentIntegerVar(). |
|
Returns the integer after given argument. This is like checkParameterArgument but lets you fail out if the argument is there but the parameter for it is not
Definition at line 292 of file ArArgumentParser.cpp. References checkParameterArgumentInteger(). |
|
Returns the word/argument after given argument. This is like checkParameterArgument but lets you fail out if the argument is there but the parameter for it is not
Definition at line 157 of file ArArgumentParser.cpp. References checkParameterArgument(), and ArLog::log(). Referenced by checkParameterArgumentStringVar(). |
|
Returns the word/argument after given argument. This is like checkParameterArgument but lets you fail out if the argument is there but the parameter for it is not
Definition at line 128 of file ArArgumentParser.cpp. References checkParameterArgumentString(). |
|
Returns the word/argument after given argument.
Definition at line 374 of file ArArgumentParser.cpp. References checkParameterArgument(). |
|
Adds args from default files and environmental variables. NOTE, if you use this function your normal argc (from main) won't reflect reality anymore, you'll have to use the parser.getArgc() to get the actual argument count. This is a little wierd but is this way so lots of people don't have to change lots of code. This goes through the list of default argument locations, if the string is an environmental variable it adds the value of the variable to the list of defaults, otherwise it tries to load a string from the file and add that to the list. You can add more default locations with addDefaultArgumentLocation. Definition at line 521 of file ArArgumentParser.cpp. References ArArgumentBuilder::addPlain(), ArArgumentBuilder::addStrings(), and ArLog::log(). |