#include <options_description.hpp>
Public Types | |
typedef boost::function2< void, std::ostream &, const option_description & > | formatter |
User-provided function for formatting option_description instances. | |
Public Member Functions | |
options_description () | |
Creates the instance. | |
options_description (const std::string &caption) | |
Creates the instance. | |
void | add (shared_ptr< option_description > desc) |
Adds new variable description. | |
void | add (const options_description &desc) |
Adds a group of option description. | |
option_description_easy_init< p_option_description > | add_options () |
Returns an object of implementation-defined type suitable for adding options to options_description. | |
template<class T> option_description_easy_init< T > | add_options () |
Returns an object suitable for adding options of user-defined class T to options_description instance. | |
unsigned | count (const std::string &name) const |
Count the number of description with given name. | |
unsigned | count_approx (const std::string &prefix) const |
Count the number of descriptions having the given string as prefix. | |
const option_description & | find (const std::string &name) const |
Returns description given a name. | |
const option_description & | find_approx (const std::string &prefix) const |
Returns description given a prefix. | |
std::set< std::string > | keys () const |
Returns all such strings x for which count(x) == 1. | |
std::set< std::string > | primary_keys () const |
For each option description stored, contains long name if not empty, if it is empty, short name is returned. | |
std::set< std::string > | approximations (const std::string &prefix) const |
Returns all such long options for which 'prefix' is prefix. | |
void | output (std::ostream &os, formatter f) const |
Output 'desc' to the specified streeam, calling 'f' to output each option_description element. | |
Friends | |
std::ostream & | operator<< (std::ostream &os, const options_description &desc) |
Produces a human readable output of 'desc', listing options, their descriptions and allowed parameters. |
This provides convenient interface for adding new option (the add_options) method, and facilities to search for options by name.
See here for option adding interface discussion.
|
User-provided function for formatting option_description instances.
|
|
Creates the instance.
|
|
Creates the instance. The 'caption' parameter gives the name of this 'options_description' instance. Primarily usefull for output. |
|
Adds new variable description. Throws duplicate_variable_error if either short or long name matches that of already present one. |
|
Adds a group of option description. This have the same effect as adding all option_descriptions in 'desc' individually, except that output operator will show a separate group. |
|
Returns an object of implementation-defined type suitable for adding options to options_description. The object returned will have these methods:
|
|
Returns an object suitable for adding options of user-defined class T to options_description instance. This function is not available when using the borland's compiler. |
|
Count the number of description with given name. Returns 0 or 1. The 'name' parameter can be either name of long option, and short option prepended by '-'. |
|
Count the number of descriptions having the given string as prefix. This makes sense only for long options. |
|
Returns description given a name.
|
|
Returns description given a prefix. Throws
|
|
Returns all such strings x for which count(x) == 1.
|
|
For each option description stored, contains long name if not empty, if it is empty, short name is returned.
|
|
Returns all such long options for which 'prefix' is prefix.
|
|
Output 'desc' to the specified streeam, calling 'f' to output each option_description element.
|
|
Produces a human readable output of 'desc', listing options, their descriptions and allowed parameters. Other options_description instances previously passed to add will be output separately. |