Main   Classes   Namespace members   Examples   Recipes   Rationale   Related pages

boost::program_options Namespace Reference

Namespace for the library. More...


Compounds

class  invalid_command_line_syntax
class  invalid_command_line_style
class  cmdline
 Command line parser class. More...

struct  option
class  config_file
 Standalone parser for config files in ini-line format:. More...

class  error
 Base class for all errors in the library. More...

class  invalid_syntax
class  unknown_option
 Class thrown when option name is not recognized. More...

class  ambiguous_option
 Class thrown when there's ambiguity between several possible options. More...

class  multiple_values
 Class thrown when there are several option values, but user called a method which cannot return them all. More...

class  multiple_occurences
 Class thrown when there are several occurences of an option, but user called a method which cannot return them all. More...

class  validation_error
 Class thrown when value of option is incorrect. More...

class  option_description
 Describes one possible command line/config file option. More...

class  option_description_easy_init
 Class which provides convenient creation syntax to option_description. More...

class  options_description
 A set of option descriptions. More...

class  p_option_description
class  validator
 Validates 's' and updates 'v'. More...

class  validator< std::vector< T > >
 Validates sequences. More...

class  duplicate_option_error
 Class thrown when duplicate option description is found. More...

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

class  variable_value
 Class holding value of option. More...

class  abstract_variables_map
 Implements string->string mapping with convenient value casting facilities. More...

class  variables_map
 Concrete variables map which store variables in real map. More...


Functions

template<class T> option_description::initialize_function parameter (const char *s)
 Creates initializer function.

template<class T> option_description::initialize_function parameter (const char *s, T *v)
 Creates initializer function, which sets up validation for the type T, and established notify function which store the value in *v.

const std::map< std::string,
boost::any > 
perform_semantic_actions (options_and_arguments &oa, const options_description &desc)
 Perform validation and executes all semantic actions, i.e.

options_and_arguments parse_command_line (cmdline &cmd)
 Parses the command line using the 'cmd' object.

options_and_arguments parse_command_line (const std::vector< std::string > args, const options_description &, int style=0, function1< std::pair< std::string, std::string >, const std::string & > ext=ext_parser())
 Parses a command line, gives as a sequences of tokens in args.

options_and_arguments parse_command_line (const std::vector< std::string > args, int style=0, function1< std::pair< std::string, std::string >, const std::string & > ext=ext_parser())
 Parses a command line, performing no syntax checks.

options_and_arguments parse_command_line (int argc, const char *argv[], const options_description &, int style=0, function1< std::pair< std::string, std::string >, const std::string & > ext=ext_parser())
options_and_arguments parse_command_line (int argc, const char *argv[], int style=0, function1< std::pair< std::string, std::string >, const std::string & > ext=ext_parser())
options_and_arguments parse_command_line (int argc, char *argv[], const options_description &, int style=0, function1< std::pair< std::string, std::string >, const std::string & > ext=ext_parser())
 It's common to declare "main" as taking non-const argv.

options_and_arguments parse_command_line (int argc, char *argv[], int style=0, function1< std::pair< std::string, std::string >, const std::string & > ext=ext_parser())
options_and_arguments parse_config_file (config_file &cf)
 Parses the passed config_file instance and returns the results.

options_and_arguments parse_config_file (std::istream &, const options_description &)
 Parse a config file.

void store (options_and_arguments &oa, variables_map &m, const options_description &desc)
 First, performs semantic actions for 'oa'.

std::ostream & operator<< (std::ostream &os, const options_description &desc)

Variables

options_and_arguments parse_config_file (std::istream &)


Detailed Description

Namespace for the library.

Function Documentation

template<class T>
option_description::initialize_function boost::program_options::parameter const char *    s
 

Creates initializer function.

For all types the function set validator to 'validator'. For 'bool' additionaly sets default value to "0" and default parameter to "1", and also makes parameter optional.

See also:
option_description constructor

template<class T>
option_description::initialize_function boost::program_options::parameter const char *    s,
T *    v
 

Creates initializer function, which sets up validation for the type T, and established notify function which store the value in *v.

const std::map< std::string, boost::any > boost::program_options::perform_semantic_actions options_and_arguments   oa,
const options_description   desc
 

Perform validation and executes all semantic actions, i.e.

applying default values and calling 'notify' functions. Returns the semantic values for all options.

Precondition:
'perform_semantic_actions' is called previously.
Todo:
return auto_ptr

options_and_arguments boost::program_options::parse_command_line cmdline   cmd
 

Parses the command line using the 'cmd' object.

Essentilally a convenience funciton, to store data in options_and_arguments instance.

options_and_arguments parse_command_line const std::vector< std::string >    args,
const options_description  ,
int    style = 0,
function1< std::pair< std::string, std::string >, const std::string & >    ext = ext_parser()
 

Parses a command line, gives as a sequences of tokens in args.

The program name is not included. Syntax of command line is determined by the 'style' argument, see the cmdline for details.

options_and_arguments parse_command_line const std::vector< std::string >    args,
int    style = 0,
function1< std::pair< std::string, std::string >, const std::string & >    ext = ext_parser()
 

Parses a command line, performing no syntax checks.

See the 'allow_unregistered' parameter to the cmdline class for details.

options_and_arguments parse_command_line int    argc,
const char *    argv[],
const options_description  ,
int    style = 0,
function1< std::pair< std::string, std::string >, const std::string & >    ext = ext_parser()
 

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

options_and_arguments parse_command_line int    argc,
const char *    argv[],
int    style = 0,
function1< std::pair< std::string, std::string >, const std::string & >    ext = ext_parser()
 

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

options_and_arguments boost::program_options::parse_command_line int    argc,
char *    argv[],
const options_description  ,
int    style = 0,
function1< std::pair< std::string, std::string >, const std::string & >    ext = ext_parser()
 

It's common to declare "main" as taking non-const argv.

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

This function is needed so that parse_command_line on non-const argv works.

options_and_arguments boost::program_options::parse_command_line int    argc,
char *    argv[],
int    style = 0,
function1< std::pair< std::string, std::string >, const std::string & >    ext = ext_parser()
 

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

options_and_arguments parse_config_file config_file   cf
 

Parses the passed config_file instance and returns the results.

options_and_arguments parse_config_file std::istream &   ,
const options_description  
 

Parse a config file.

void boost::program_options::store options_and_arguments   oa,
variables_map   m,
const options_description   desc
 

First, performs semantic actions for 'oa'.

Then, stores in 'm' all options that are defined in 'desc'.

std::ostream& operator<< std::ostream &    os,
const options_description   desc
 

Other options_description instances previously passed to add will be output separately.


Variable Documentation

options_and_arguments boost::program_options::parse_config_file
 

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.


Generated on 23 May 2003 with
doxygen