|
MFMv2.0.10
Movable Feast Machine Simulator 2.0.10
|
#include <VArguments.h>
Public Member Functions | |
| VArguments () | |
| void | Die (const char *format,...) |
| void | RegisterArgument (const char *description, const char *filter, VArgumentHandleValue func, void *handlerArg, bool runFunc) |
| void | RegisterSection (const char *label) |
| void | ProcessArguments (u32 argc, const char **argv) |
| const char * | Get (const char *argName) const |
| u32 | GetInt (const char *argName) const |
| bool | Appeared (const char *argName) const |
| void | Usage () const |
A class which holds a variable number of command line arguments. This is normally used when a driver needs to have unique command line arguments.
| MFM::VArguments::VArguments | ( | ) |
Constructs a new empty VArguments collection.
| bool MFM::VArguments::Appeared | ( | const char * | argName | ) | const |
Checks to see if a particular argument was encountered on the command line during ProcessArguments .
| argName | The name of the argument being checked for command line membership. |
true if this argument was encountered on the command line, else false. | void MFM::VArguments::Die | ( | const char * | format, |
| ... | |||
| ) |
Fails, to be called upon an illegal command line argument. This method terminates wiht exit(0) .
| format | The format used to print a printf-style format string describing the failure. |
| const char * MFM::VArguments::Get | ( | const char * | argName | ) | const |
Retrieve a command line argument which has been generated by Gather. If this argument is not found, FAIL(ILLEGAL_ARGUMENT) is invoked.
| argName | The name of the argument to retrieve from this VArguments. |
| u32 MFM::VArguments::GetInt | ( | const char * | argName | ) | const |
Retrieve a command line argument which has been generated by Gather. If this argument is not found, FAIL(ILLEGAL_ARGUMENT) is invoked. The argument retrieved is passed through atoi and the value is returned.
| argName | The name of the argument to retrieve from this VArguments. |
| void MFM::VArguments::ProcessArguments | ( | u32 | argc, |
| const char ** | argv | ||
| ) |
To be called after all arguments are registered. This will parse all command line arguments given into the internally held format.
| argc | The amount of command line arguments in argv. |
| argv | The command line arguments. |
| void MFM::VArguments::RegisterArgument | ( | const char * | description, |
| const char * | filter, | ||
| VArgumentHandleValue | func, | ||
| void * | handlerArg, | ||
| bool | runFunc | ||
| ) |
Registers a new command line argument to this VArguments instance.
| description | The description of this argument, printed out upon displaying this program's usage. |
| filter | The filter used to differentiate between command line arguments, separated by the '|' character. For instance, "-h|--help" matches both "-h" and "--help". |
| func | The function called upon encounterin this command line argument when given by the user. This is called on the value gotten by the user, unless otherwise specified. |
| handlerArg | The argument specified to func upon being called. |
| runFunc | If true, will ask for one command line argument. If not, will treat as a flag and simply execute func with NULL as its argument. |
| void MFM::VArguments::RegisterSection | ( | const char * | label | ) |
Defines a new command line argument section in this VArguments instance. Subsequent RegisterArgument calls will be described as part of section label, unless and until another RegisterSection call.
| label | The name of the section, printed out as part of program usage help. |
| void MFM::VArguments::Usage | ( | ) | const |
Prints all held arguments to stdout. This is called when the default 'help' command line argument is invoked.
1.8.6