Aria
2.7.5.2
|
This class is to build arguments for things that require argc and argv. More...
#include <ArArgumentBuilder.h>
Public Member Functions | |
void | add (const char *str,...) |
Adds the given string, with varargs, separates if there are spaces. More... | |
void | addPlain (const char *str, int position=-1) |
Adds the given string, without varargs (wrapper for java) More... | |
void | addPlainAsIs (const char *str, int position=-1) |
Adds the given string, without varargs and without touching the str. More... | |
void | addStrings (char **argv, int argc, int position=-1) |
Adds the given string thats divided. More... | |
void | addStrings (int argc, char **argv, int position=-1) |
Adds the given string thats divided. More... | |
void | addStringsAsIs (int argc, char **argv, int position=-1) |
Adds the given string thats divided (but doesn't touch the strings) More... | |
ArArgumentBuilder (size_t argvLen=512, char extraSpaceChar= '\0') | |
Constructor. More... | |
ArArgumentBuilder (const ArArgumentBuilder &builder) | |
Copy Constructor. | |
void | compressQuoted (bool stripQuotationMarks=false) |
Combines quoted arguments into one. | |
const char * | getArg (size_t whichArg) const |
Gets a specific argument as a string. | |
bool | getArgBool (size_t whichArg, bool *ok=NULL) const |
Gets the value of an argument as a boolean. More... | |
size_t | getArgc (void) const |
Gets the argc. | |
double | getArgDouble (size_t whichArg, bool *ok=NULL) const |
Gets the value of an argument as a double. More... | |
int | getArgInt (size_t whichArg, bool *ok=NULL) const |
Gets the value of an argument as an integer. More... | |
char ** | getArgv (void) const |
Gets the argv. | |
const char * | getExtraString (void) const |
Gets the extra string of the input, used differently by different things. | |
const char * | getFullString (void) const |
Gets the original string of the input. | |
bool | isArgBool (size_t whichArg) const |
Sees if an argument is a bool. | |
bool | isArgDouble (size_t whichArg) const |
Sees if an argument is a double. | |
bool | isArgInt (size_t whichArg) const |
Sees if an argument is an int. | |
void | log (void) const |
Prints out the arguments. | |
void | removeArg (size_t which, bool isRebuildFullString=false) |
Delete a particular arg, you MUST finish adding before you can remove. | |
void | setExtraString (const char *str) |
Sets the extra string of the input, used differently by different things. | |
void | setFullString (const char *str) |
Sets the full string (this is so you can have a more raw full string) | |
void | setQuiet (bool isQuiet) |
Turn on this flag to reduce the number of verbose log messages. | |
virtual | ~ArArgumentBuilder () |
Destructor. | |
Protected Member Functions | |
size_t | getArgvLen (void) const |
void | internalAdd (const char *str, int position=-1) |
void | internalAddAsIs (const char *str, int position=-1) |
void | rebuildFullString () |
Protected Attributes | |
size_t | myArgc |
char ** | myArgv |
size_t | myArgvLen |
char | myExtraSpace |
std::string | myExtraString |
bool | myFirstAdd |
std::string | myFullString |
bool | myIsQuiet |
size_t | myOrigArgc |
This class is to build arguments for things that require argc and argv.
ArArgumentBuilder::ArArgumentBuilder | ( | size_t | argvLen = 512 , |
char | extraSpaceChar = '\0' |
||
) |
Constructor.
argvLen | the largest number of arguments we'll parse |
extraSpaceChar | if not NULL, then this character will also be used to break up arguments (in addition to whitespace) |
void ArArgumentBuilder::add | ( | const char * | str, |
... | |||
) |
Adds the given string, with varargs, separates if there are spaces.
Java and Python Wrappers: Not available
void ArArgumentBuilder::addPlain | ( | const char * | str, |
int | position = -1 |
||
) |
Adds the given string, without varargs (wrapper for java)
str | the string to add |
position | the position to add the string at, a position less than 0 means to add at the end, if this number is greater than how many positions exist then it will also be added at the end |
void ArArgumentBuilder::addPlainAsIs | ( | const char * | str, |
int | position = -1 |
||
) |
Adds the given string, without varargs and without touching the str.
str | the string to add |
position | the position to add the string at, a position less than 0 means to add at the end, if this number is greater than how many positions exist then it will also be added at the end |
void ArArgumentBuilder::addStrings | ( | char ** | argv, |
int | argc, | ||
int | position = -1 |
||
) |
Adds the given string thats divided.
argc | how many arguments to add |
argv | the strings to add |
position | the position to add the string at, a position less than 0 means to add at the end, if this number is greater than how many positions exist then it will also be added at the end |
void ArArgumentBuilder::addStrings | ( | int | argc, |
char ** | argv, | ||
int | position = -1 |
||
) |
Adds the given string thats divided.
argc | how many arguments to add |
argv | the strings to add |
position | the position to add the string at, a position less than 0 means to add at the end, if this number is greater than how many positions exist then it will also be added at the end |
void ArArgumentBuilder::addStringsAsIs | ( | int | argc, |
char ** | argv, | ||
int | position = -1 |
||
) |
Adds the given string thats divided (but doesn't touch the strings)
argc | how many arguments to add |
argv | the strings to add |
position | the position to add the string at, a position less than 0 means to add at the end, if this number is greater than how many positions exist then it will also be added at the end |
bool ArArgumentBuilder::getArgBool | ( | size_t | whichArg, |
bool * | ok = NULL |
||
) | const |
Gets the value of an argument as a boolean.
Valid boolean values are "true" and "false", and "1" and "0". There are two ways to to verify that the specified argument is a bool. Either call isArgBool() before calling this method, or specify a non-NULL ok parameter value. The latter is somewhat more efficient since the argument string is checked only once.
whichArg | the size_t index of the arg to retrieve; must be >= 0 and less than getArgc() |
ok | an optional pointer to a bool that will be set to true if the arg was successfully retrieved or to false if an error occurred |
double ArArgumentBuilder::getArgDouble | ( | size_t | whichArg, |
bool * | ok = NULL |
||
) | const |
Gets the value of an argument as a double.
There are two ways to to verify that the specified argument is a double. Either call isArgDouble() before calling this method, or specify a non-NULL ok parameter value. The latter is somewhat more efficient because the digit status of each character is checked only once.
whichArg | the size_t index of the arg to retrieve; must be >= 0 and less than getArgc() |
ok | an optional pointer to a bool that will be set to true if the arg was successfully retrieved or to false if an error occurred |
int ArArgumentBuilder::getArgInt | ( | size_t | whichArg, |
bool * | ok = NULL |
||
) | const |
Gets the value of an argument as an integer.
There are two ways to to verify that the specified argument is an integer. Either call isArgInt() before calling this method, or specify a non-NULL ok parameter value. The latter is somewhat more efficient because the digit status of each character is checked only once.
whichArg | the size_t index of the arg to retrieve; must be >= 0 and less than getArgc() |
ok | an optional pointer to a bool that will be set to true if the arg was successfully retrieved or to false if an error occurred |
|
protected |
Internal function that adds a string starting at some given space
str | the string to add |
position | the position to add the string at, a position less than 0 means to add at the end, if this number is greater than how many positions exist then it will also be added at the end |