MySQL++
3.3.0
|
Parses command line arguments and holds the results. More...
#include <cmdline.h>
Public Types | |
typedef std::vector< std::string > | ArgumentList |
Type for a list of arguments. More... | |
typedef ArgumentList::const_iterator | ArgumentListIt |
Iterator into ArgumentList. | |
Public Member Functions | |
const ArgumentList & | extra_args () const |
Get reference to list of command line arguments past the last flag and its possible argument. More... | |
operator void * () const | |
Return truthy value if command line was parsed successfully. | |
Protected Member Functions | |
CommandLineBase (int argc, char *const argv[], const char *opts) | |
Hidden ctor to prevent instantiation. More... | |
virtual | ~CommandLineBase () |
Hidden dtor to prevent instantiation. | |
void | finish_parse () |
If object is still marked as "successful", save non-option arguments to extra_args_ list. Subclass ctor should call this after the parse_next() loop gets EOF. | |
const char * | option_argument () const |
Accessor for getopt()'s optarg global. | |
int | option_index () const |
Accessor for getopt()'s optind global. | |
void | parse_error (const char *message=0) |
Called by a subclass when encountering a command line parsing error. More... | |
int | parse_next () const |
Wrapper for getopt() | |
virtual void | print_usage () const =0 |
Show a message explaining the program's proper usage. | |
const char * | program_name () const |
Get the file name of the program's executable. | |
bool | successful () const |
Returns true if nothing has gone wrong since calling the ctor. | |
Parses command line arguments and holds the results.
This class just contains common functionality and data structures; instantiable subclasses follow.
typedef std::vector<std::string> mysqlpp::CommandLineBase::ArgumentList |
Type for a list of arguments.
Public types
|
inlineprotected |
Hidden ctor to prevent instantiation.
Subclass interface
|
inline |
Get reference to list of command line arguments past the last flag and its possible argument.
Public interface
|
protected |
Called by a subclass when encountering a command line parsing error.
Prints the passed message, calls subclass's print_usage(), and marks the object as no longer successful.
References print_usage().
Referenced by mysqlpp::ssqlsxlat::CommandLine::CommandLine(), and mysqlpp::examples::CommandLine::CommandLine().