![]() |
Home | Libraries | People | FAQ | More |
boost::program_options::options_description —
class options_description { public: // construct/copy/destruct options_description(); options_description(const std::string &); // public member functions void add(shared_ptr< option_description >) ; options_description & add(const options_description &) ; options_description_easy_init add_options() ; unsigned count(const std::string &) const; unsigned count_approx(const std::string &) const; const option_description & find(const std::string &) const; const option_description & find_approx(const std::string &) const; std::set< std::string > keys() const; std::set< std::string > primary_keys() const; std::set< std::string > approximations(const std::string &) const; void print(std::ostream &) const; // private member functions approximation_range find_approximation(const std::string &) const; };
A set of option descriptions. 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.
option_description
void add(shared_ptr< option_description > desc) ;
Adds new variable description. Throws duplicate_variable_error if either short or long name matches that of already present one.
options_description & add(const options_description & desc) ;
Adds a group of option description. This has the same effect as adding all option_descriptions in 'desc' individually, except that output operator will show a separate group. Returns *this.
options_description_easy_init add_options() ;
Returns an object of implementation-defined type suitable for adding options to options_description. The returned object will have overloaded operator() with parameter type matching 'option_description' constructors. Calling the operator will create new option_description instance and add it.
unsigned count(const std::string & name) const;
Count the number of option descriptions with given name. Returns 0 or 1. The 'name' parameter can be either name of long option, and short option prefixed by '-'.
unsigned count_approx(const std::string & prefix) const;
Count the number of descriptions having the given string as prefix. This makes sense only for long options.
const option_description & find(const std::string & name) const;
Returns description given a name.
Requires: count(name) == 1
const option_description & find_approx(const std::string & prefix) const;
Returns description given a prefix. Throws
Requires: count_approx(name) == 1
std::set< std::string > keys() const;
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;
void print(std::ostream & os) const;
Output 'desc' to the specified stream, calling 'f' to output each option_description element.
Copyright © 2002-2004 Vladimir Prus |