#include <CommandLine.h>
It provides functions for parametered and flag-only options (i.e. arguments starting with slash or hyphen, followed by a pre-defined number of parameters), as well as enumerating the remaining arguments.
Definition at line 22 of file CommandLine.h.
Public Member Functions | |
CommandLine () | |
Creates a new CommandLine object. | |
void | declareOption (const String &name, int expectedParameters) |
Declares an option to have a well-defined number of parameters. | |
const ArrayList< String > * | getOptionParameters (const String &name) const |
Returns the actual parameters of an option. | |
const ArrayList< String > & | getParameters () const |
Returns the parameters in the command line not being part of any option. | |
const String & | getProgramName () const |
Returns the name of the program (argv[0]). | |
bool | hasOption (const String &name) const |
Returns whether a given option actually occurs in the command line. | |
void | readFrom (int argc, const char **argv) |
Reads a given command line into this object. | |
void | readFromDefault () |
Reads the default command line (__argc and __argv) into this object. | |
~CommandLine () | |
Destroys the CommandLine object. | |
Private Attributes | |
StringKeyHashMap< Option > | options |
A hashtable containing the found option names as keys and Option objects as values. | |
ArrayList< String > | parameters |
The parameters in the command line without the options. | |
String | programName |
The name of the program. |
|
Creates a new CommandLine object.
|
|
Destroys the CommandLine object.
|
|
Declares an option to have a well-defined number of parameters.
|
|
Returns the actual parameters of an option. For example, if the arguments are '/A /E a b c', and the option '/E' is defined with 2 expected parameters, this method returns 'a' and 'b'.
|
|
Returns the parameters in the command line not being part of any option.
|
|
Returns the name of the program (argv[0]).
|
|
Returns whether a given option actually occurs in the command line.
|
|
Reads a given command line into this object.
|
|
Reads the default command line (__argc and __argv) into this object.
|
|
A hashtable containing the found option names as keys and Option objects as values.
Definition at line 75 of file CommandLine.h. |
|
The parameters in the command line without the options.
Definition at line 80 of file CommandLine.h. |
|
The name of the program. This is the first element of the argv array. Definition at line 86 of file CommandLine.h. |