Boost  v1.57.0
doxygen for www.boost.org
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
boost::program_options::options_description Class Reference

A set of option descriptions. More...

#include <options_description.hpp>

Public Member Functions

 options_description (unsigned line_length=m_default_line_length, unsigned min_description_length=m_default_line_length/2)
 Creates the instance. More...
 
 options_description (const std::string &caption, unsigned line_length=m_default_line_length, unsigned min_description_length=m_default_line_length/2)
 Creates the instance. More...
 
void add (shared_ptr< option_description > desc)
 Adds new variable description. More...
 
options_descriptionadd (const options_description &desc)
 Adds a group of option description. More...
 
unsigned get_option_column_width () const
 Find the maximum width of the option column, including options in groups. More...
 
options_description_easy_init add_options ()
 Returns an object of implementation-defined type suitable for adding options to options_description. More...
 
const option_descriptionfind (const std::string &name, bool approx, bool long_ignore_case=false, bool short_ignore_case=false) const
 
const option_descriptionfind_nothrow (const std::string &name, bool approx, bool long_ignore_case=false, bool short_ignore_case=false) const
 
const std::vector< shared_ptr
< option_description > > & 
options () const
 
void print (std::ostream &os, unsigned width=0) const
 Outputs 'desc' to the specified stream, calling 'f' to output each option_description element. More...
 

Static Public Attributes

static const unsigned m_default_line_length
 

Friends

BOOST_PROGRAM_OPTIONS_DECL
std::ostream & 
operator<< (std::ostream &os, const options_description &desc)
 Produces a human readable output of 'desc', listing options, their descriptions and allowed parameters. More...
 

Detailed Description

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.

See also
option_description

Constructor & Destructor Documentation

boost::program_options::options_description::options_description ( unsigned  line_length = m_default_line_length,
unsigned  min_description_length = m_default_line_length/2 
)

Creates the instance.

boost::program_options::options_description::options_description ( const std::string &  caption,
unsigned  line_length = m_default_line_length,
unsigned  min_description_length = m_default_line_length/2 
)

Creates the instance.

The 'caption' parameter gives the name of this 'options_description' instance. Primarily useful for output. The 'description_length' specifies the number of columns that should be reserved for the description text; if the option text encroaches into this, then the description will start on the next line.

Member Function Documentation

void boost::program_options::options_description::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& boost::program_options::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 boost::program_options::options_description::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.

const option_description& boost::program_options::options_description::find ( const std::string &  name,
bool  approx,
bool  long_ignore_case = false,
bool  short_ignore_case = false 
) const
const option_description* boost::program_options::options_description::find_nothrow ( const std::string &  name,
bool  approx,
bool  long_ignore_case = false,
bool  short_ignore_case = false 
) const
unsigned boost::program_options::options_description::get_option_column_width ( ) const

Find the maximum width of the option column, including options in groups.

const std::vector< shared_ptr<option_description> >& boost::program_options::options_description::options ( ) const
void boost::program_options::options_description::print ( std::ostream &  os,
unsigned  width = 0 
) const

Outputs 'desc' to the specified stream, calling 'f' to output each option_description element.

Friends And Related Function Documentation

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

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.

Member Data Documentation

const unsigned boost::program_options::options_description::m_default_line_length
static

The documentation for this class was generated from the following file: