#include <options_description.hpp>
Inherited by boost::program_options::option_description_easy_init< Derived >, and boost::program_options::option_description_easy_init< p_option_description >.
Inheritance diagram for boost::program_options::option_description:
Public Types | |
typedef boost::function2< void, boost::any &, const std::vector< std::string > & > | validator_function |
The type of function which perform validation of option parameters. | |
typedef boost::function1< void, const boost::any & > | notify_function |
The type of function which will be called to notify about final value of option. | |
typedef boost::function1< void, option_description & > | initialize_function |
The type of function that is used to initialize option_description. | |
Public Member Functions | |
std::string | format_name () const |
Returns the option name, formatted suitably for usage message. | |
std::string | format_parameter () const |
Return the parameter name and properties, formatted suitably for usage message. | |
Construction | |
option_description (const char *name, const char *parameter_name) | |
Creates an option_description instance with the specified name and parameter_name. | |
option_description (const char *name, const char *parameter, const char *description) | |
Same as above, but also sets the description for this option. | |
option_description (const char *name, const initialize_function &f) | |
Initializes *this from name, assuming empty parameter_name. | |
option_description (const char *name, const initialize_function &f, const char *description) | |
Initialized *this from name and description, and assuming empty parameter_name. | |
option_description & | name (const char *name) |
Sets the long name and short name, using the following convention: - if there's no "," character in 'name', it specifies long name - otherwise, the part before "," specifies long name and the part after -- long name. | |
option_description & | description (const char *desc) |
Sets the description. | |
option_description & | parameter (const char *parameter) |
Sets the parameter name. | |
option_description & | flags (char f) |
Sets flags to the passed value. | |
option_description & | default_value (const char *) |
Sets default value of the option. | |
option_description & | default_parameter (const char *) |
Sets default value of the option's parameter. | |
option_description & | validator (const validator_function &) |
Sets validator to be used for the options's parameter. | |
option_description & | notify (const notify_function &) |
Sets notify function to be used with this option. | |
Syntantic properties | |
const std::string & | short_name () const |
Name to be used with short-style option ("-w"). | |
const std::string & | long_name () const |
Name to be used with long-style option ("--whatever"). | |
const std::string & | description () const |
Explanation of this option. | |
const std::string & | parameter () const |
Name of the parameter. | |
char | flags () const |
Flags that apply to this variable. | |
Semantic properties | |
const std::string & | default_value () const |
Returns default value. | |
const std::string & | default_parameter () const |
Returns detaul parameter's value. | |
const validator_function & | validator () const |
Function that performs validation and fixup on value. | |
const notify_function & | notify () const |
Function that should be called when value of the variable is finally set. |
There are two kinds of properties of an option. First describe it syntactically and are used only to validate input. Second affect interpretation of the option, for example default value for it or function that should be called when the value is finally know. Routines which perform parsing never use second kind of properties -- they are side effect free.
|
The type of function which perform validation of option parameters. It will be called with the current value of option as the first parameter (possible empty 'any'), and with values specified in the next occurence of option. It should update the value, or throw. |
|
The type of function which will be called to notify about final value of option.
|
|
The type of function that is used to initialize option_description.
|
|
Creates an option_description instance with the specified name and parameter_name. Name is set by call to this->name. Flags will be set this way:
|
|
Same as above, but also sets the description for this option.
|
|
Initializes *this from name, assuming empty parameter_name. |
|
Initialized *this from name and description, and assuming empty parameter_name. After that, calls 'f' on *this. |
|
Sets the long name and short name, using the following convention: - if there's no "," character in 'name', it specifies long name - otherwise, the part before "," specifies long name and the part after -- long name.
|
|
Sets the description.
Reimplemented in boost::program_options::option_description_easy_init< Derived >, and boost::program_options::option_description_easy_init< p_option_description >. |
|
Sets the parameter name.
Reimplemented in boost::program_options::option_description_easy_init< Derived >, and boost::program_options::option_description_easy_init< p_option_description >. |
|
Sets flags to the passed value. The value of 'c' has the same meaning as in cmdline::add_option. Reimplemented in boost::program_options::option_description_easy_init< Derived >, and boost::program_options::option_description_easy_init< p_option_description >. |
|
Sets default value of the option.
Reimplemented in boost::program_options::option_description_easy_init< Derived >, and boost::program_options::option_description_easy_init< p_option_description >. |
|
Sets default value of the option's parameter.
Reimplemented in boost::program_options::option_description_easy_init< Derived >, and boost::program_options::option_description_easy_init< p_option_description >. |
|
Sets validator to be used for the options's parameter.
Reimplemented in boost::program_options::option_description_easy_init< Derived >, and boost::program_options::option_description_easy_init< p_option_description >. |
|
Sets notify function to be used with this option.
Reimplemented in boost::program_options::option_description_easy_init< Derived >, and boost::program_options::option_description_easy_init< p_option_description >. |
|
Name to be used with short-style option ("-w").
|
|
Name to be used with long-style option ("--whatever").
|
|
Explanation of this option.
|
|
Name of the parameter.
|
|
Flags that apply to this variable.
|
|
Returns default value.
|
|
Returns detaul parameter's value.
|
|
Function that performs validation and fixup on value.
|
|
Function that should be called when value of the variable is finally set.
|
|
Returns the option name, formatted suitably for usage message.
|
|
Return the parameter name and properties, formatted suitably for usage message.
|