For parsing command line options, equivalent to UNIX getopt() function. More...
#include <libppbase/base/CommandLine.h>
Public Member Functions | |
CommandLine (int argc, const char **argv, const char *optstring, bool bopterr=true) | |
Constructor. | |
void | dump (int ret) const |
Dumps the internal state to stdout. | |
int | getopt () |
Returns the next command line option. | |
const char * | optarg () const |
Returns the option argument. | |
int | optind () const |
Returns the current position in the command line. | |
int | optopt () const |
Returns the value of the unknow option, in case getopt returned '?'. |
For parsing command line options, equivalent to UNIX getopt() function.
base::CommandLine::CommandLine | ( | int | argc, | |
const char ** | argv, | |||
const char * | optstring, | |||
bool | bopterr = true | |||
) |
Constructor.
argc | number of arguments, pass argc from main() here | |
argv | command line arguments, pass argv from main() here | |
optstring | pass option string here | |
bopterr | true to print error messages, false to inhibit them |
void base::CommandLine::dump | ( | int | ret | ) | const |
Dumps the internal state to stdout.
ret | the return code from getopt |
int base::CommandLine::getopt | ( | ) |
Returns the next command line option.
const char* base::CommandLine::optarg | ( | ) | const |
Returns the option argument.
int base::CommandLine::optind | ( | ) | const |
Returns the current position in the command line.
int base::CommandLine::optopt | ( | ) | const |
Returns the value of the unknow option, in case getopt returned '?'.