|
GClasses
|
Parses command-line args and provides methods to conveniently process them.
#include <GApp.h>
Public Member Functions | |
| GArgReader (int argc, char *argv[]) | |
| Pass the args that are passed in to main. More... | |
| GArgReader (GArgReader &other) | |
| copy constructor More... | |
| void | clear_args () |
| Clears the args. More... | |
| int | get_argc () |
| Returns the value of argc. More... | |
| int | get_pos () |
| Returns the current position–that is, the argument number. More... | |
| bool | if_pop (const char *flagName) |
| If the current arg matches flagName, advances and returns true. Otherwise, returns false (without advancing). More... | |
| bool | next_is_flag () |
| Returns true if there is another arg, and it begins with '-'. More... | |
| bool | next_is_uint () |
| Returns true if there is another arg, and it would parse accurately as an unsigned integer. More... | |
| const char * | peek () |
| Returns the current arg (without advancing) More... | |
| double | pop_double () |
| Returns the current arg as a double, and advances. Throws an exception if the end of the args was already reached before this call. More... | |
| const char * | pop_string () |
| Returns the current arg as a string, and advances. Throws an exception if the end of the args was already reached before this call. More... | |
| unsigned int | pop_uint () |
| Returns the current arg as a uint, and advances. Throws an exception if the end of the args was already reached before this call. More... | |
| void | set_argc (int argc) |
| Returns the value of argc. More... | |
| void | set_pos (int n) |
| Sets the current position. More... | |
| int | size () |
| Returns the number of remaining args. More... | |
| GClasses::GArgReader::GArgReader | ( | int | argc, |
| char * | argv[] | ||
| ) |
Pass the args that are passed in to main.
| GClasses::GArgReader::GArgReader | ( | GArgReader & | other | ) |
copy constructor
| void GClasses::GArgReader::clear_args | ( | ) |
Clears the args.
|
inline |
Returns the value of argc.
| int GClasses::GArgReader::get_pos | ( | ) |
Returns the current position–that is, the argument number.
| bool GClasses::GArgReader::if_pop | ( | const char * | flagName | ) |
If the current arg matches flagName, advances and returns true. Otherwise, returns false (without advancing).
| bool GClasses::GArgReader::next_is_flag | ( | ) |
Returns true if there is another arg, and it begins with '-'.
| bool GClasses::GArgReader::next_is_uint | ( | ) |
Returns true if there is another arg, and it would parse accurately as an unsigned integer.
| const char* GClasses::GArgReader::peek | ( | ) |
Returns the current arg (without advancing)
| double GClasses::GArgReader::pop_double | ( | ) |
Returns the current arg as a double, and advances. Throws an exception if the end of the args was already reached before this call.
| const char* GClasses::GArgReader::pop_string | ( | ) |
Returns the current arg as a string, and advances. Throws an exception if the end of the args was already reached before this call.
| unsigned int GClasses::GArgReader::pop_uint | ( | ) |
Returns the current arg as a uint, and advances. Throws an exception if the end of the args was already reached before this call.
|
inline |
Returns the value of argc.
| void GClasses::GArgReader::set_pos | ( | int | n | ) |
Sets the current position.
| int GClasses::GArgReader::size | ( | ) |
Returns the number of remaining args.