A class which holds a represention of the argc/argv command line array, and supports simple command-line parsing.
More...
|
| Arg (int argc, char **argv) |
| Constructor taking argc/argv. More...
|
|
| Arg (const G::StringArray &) |
| Constructor taking an array of command-line arguments. More...
|
|
| Arg () |
| Default constructor. Initialise with parse().
|
|
void | parse (HINSTANCE hinstance, const std::string &command_line_tail) |
| Parses the given command-line tail, splitting it up into an array of tokens. More...
|
|
void | parse (const std::string &command_line) |
| Parses the given command line, splitting it up into an array of tokens. More...
|
|
void | reparse (const std::string &command_line_tail) |
| Reinitialises the object with the given command-line tail. More...
|
|
std::size_t | c () const |
| Returns the number of tokens in the command line, including the program name. More...
|
|
std::string | v (std::size_t i) const |
| Returns the i'th argument. More...
|
|
std::string | v (std::size_t i, const std::string &default_) const |
| Returns the i'th argument or the default if out of range. More...
|
|
std::string | prefix () const |
| Returns the basename of v(0) without any extension. More...
|
|
bool | contains (const std::string &option, std::size_t option_args=0U, bool case_sensitive=true) const |
| Returns true if the command line contains the given option with enough command line arguments left to satisfy the required number of option arguments. More...
|
|
std::size_t | count (const std::string &option) |
| Returns the number of times the given string appears in the list of arguments. More...
|
|
std::size_t | index (const std::string &option, std::size_t option_args=0U, std::size_t default_=0U) const |
| Returns the index of the given option. More...
|
|
std::size_t | match (const std::string &prefix) const |
| Returns the index of the first argument that matches the given prefix. More...
|
|
bool | remove (const std::string &option, std::size_t option_args=0U) |
| Removes the given option and its arguments. More...
|
|
std::string | removeAt (std::size_t option_index, std::size_t option_args=0U) |
| Removes the given argument and the following 'option_args' ones. More...
|
|
StringArray | array (unsigned int shift=0U) const |
| Returns the arguments as a string array, with an optional shift. More...
|
|
A class which holds a represention of the argc/argv command line array, and supports simple command-line parsing.
A copy of argv[0] is squirrelled away and made accessible via a static method.
- See also
- G::GetOpt
Definition at line 43 of file garg.h.