Command parses command line arguments in a variety of formats. Command format is either:. More...
#include <CommandLine.h>
Public Member Functions | |
CommandLine (const CommandLine &cl) | |
CommandLine (const int argc, const char **argv) | |
CommandLine & | operator= (const CommandLine &cl) |
bool | Parse (const int argc, const char **argv) |
void | Clear () |
bool | HasSwitch (const String &argNoDashOrSlash) const |
String & | GetSwitch (const String argNoDashOrSlash) const |
String & | GetSwitch (const String &argNoDashOrSlash, const String &defValue) |
String & | GetSwitch (const int idx) const |
String & | GetArg (int idx) const |
int | GetArgCount () const |
int | GetSwitchCount () const |
void | SetSwitch (const String &key, const String &value) |
void | ValidateMem () const |
void | CheckMem () const |
Protected Member Functions | |
String | ParseValue (const String &str, const bool unixStyle) |
Protected Attributes | |
Vector< String > | m_switches |
Hashtable< String, String > | m_switchIdx |
Vector< String > | m_args |
Command parses command line arguments in a variety of formats. Command format is either:.
Definition at line 43 of file CommandLine.h.
bool CommandLine::Parse | ( | const int | argc, | |
const char ** | argv | |||
) |
Parse can handle unix style -X, --name, and --name=val as well as windows /X:val. The style cannot be mixed, since "-X:/dir" wouldn't work as expected. Quoted values are supported.
NOTE: argv[0] (the program name) is also added.
Definition at line 131 of file CommandLine.cpp.
References Vector< T >::Add().