Main   Classes   Namespace members   Examples   Recipes   Rationale   Related pages

boost::program_options::options_and_arguments Class Reference

Holds the result of parsing command line or any other source. More...

#include <parsers.hpp>

List of all members.

Public Member Functions

const options_t & options () const
 Options given, in the order of occurence.

const std::vector< std::string > & arguments () const
 Arguments given, in the order of occurence.

const std::string & operator[] (const std::string &name) const
 Returns the result of calling 'get_value'.

const std::string & get_value (const std::string &name) const
 Returns value of option or empty string if the option is not present.

const std::vector< std::string > & get_values (const std::string &name) const
 Returns all values of the specified option.

const std::vector< std::vector<
std::string > > & 
get_all_values (const std::string &name) const
 Returns all values of all occurences of the specified option.

unsigned count (const std::string &name) const
 Checks if option is present.

void add_option (const std::string &name, const std::vector< std::string > &value)
 Adds new option occurence.

void add_argument (const std::string &argument)
 Adds new argument.

void merge_occurences (const std::string &name)
 If there are several occurences of option 'name', merges values in all of them together.


Detailed Description

Holds the result of parsing command line or any other source.

The option naming depends on the entity which created the class instances, but the usual convention is the same as for cmdline::option_name.


Member Function Documentation

const std::vector< std::pair< std::string, vector< vector< string > > > > & boost::program_options::options_and_arguments::options   const
 

Options given, in the order of occurence.

First element is the name stored according to name conventions above. Second element is the value specified for the option. Note that none of parse* function below perform any calls to validator or to notify routine. Side effect is that it's always possible to tell is an value was specified, since "--foobar=" syntax is not allowed.

const std::vector< std::string > & boost::program_options::options_and_arguments::arguments   const
 

Arguments given, in the order of occurence.

const std::string & boost::program_options::options_and_arguments::operator[] const std::string &    name const
 

Returns the result of calling 'get_value'.

const std::string & boost::program_options::options_and_arguments::get_value const std::string &    name const
 

Returns value of option or empty string if the option is not present.

Returning empty string if option not found is for convenience; note that the function is const. This function recognizes option names as given in data source.

Exceptions:
multiple_values multiple_occurences

const std::vector< std::string > & boost::program_options::options_and_arguments::get_values const std::string &    name const
 

Returns all values of the specified option.

If option is not present, returns an empty vector.

Exceptions:
multiple_occurences 

const std::vector< std::vector< std::string > > & boost::program_options::options_and_arguments::get_all_values const std::string &    name const
 

Returns all values of all occurences of the specified option.

If the option is not present, returns an empty vector.

unsigned boost::program_options::options_and_arguments::count const std::string &    name const
 

Checks if option is present.

void boost::program_options::options_and_arguments::add_option const std::string &    name,
const std::vector< std::string > &    value
 

Adds new option occurence.

void boost::program_options::options_and_arguments::add_argument const std::string &    argument
 

Adds new argument.

void boost::program_options::options_and_arguments::merge_occurences const std::string &    name
 

If there are several occurences of option 'name', merges values in all of them together.

Otherwise, has no effect.


The documentation for this class was generated from the following files:
Generated on 23 May 2003 with
doxygen