MySQL++: mysqlpp::CommandLineBase Class Reference
mysqlpp::CommandLineBase Class Referenceabstract

Parses command line arguments and holds the results. More...

`#include <cmdline.h>`

Inheritance diagram for mysqlpp::CommandLineBase:
[legend]

## 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.

## Detailed Description

Parses command line arguments and holds the results.

This class just contains common functionality and data structures; instantiable subclasses follow.

## Member Typedef Documentation

## ArgumentList

typedef std::vector<std::string> mysqlpp::CommandLineBase::ArgumentList

Type for a list of arguments.

Public types

## Constructor & Destructor Documentation

## CommandLineBase()

mysqlpp::CommandLineBase::CommandLineBase | ( | int | argc,
|  | char *const | argv[],
|  | const char * | opts
| ) |  |

inline protected

Hidden ctor to prevent instantiation.

Subclass interface

## Member Function Documentation

## extra_args()

const ArgumentList& mysqlpp::CommandLineBase::extra_args | ( |  | ) | const

inline

Get reference to list of command line arguments past the last flag and its possible argument.

Public interface

## parse_error()

void mysqlpp::CommandLineBase::parse_error | ( | const char * | message = `0` | ) |

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().

The documentation for this class was generated from the following files:

- cmdline.h
- cmdline.cpp