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::positional_options_description Class Reference

Describes positional options. More...

#include <positional_options.hpp>

Public Member Functions

 positional_options_description ()
 
positional_options_descriptionadd (const char *name, int max_count)
 Species that up to 'max_count' next positional options should be given the 'name'. More...
 
unsigned max_total_count () const
 Returns the maximum number of positional options that can be present. More...
 
const std::string & name_for_position (unsigned position) const
 Returns the name that should be associated with positional options at 'position'. More...
 

Detailed Description

Describes positional options.

The class allows to guess option names for positional options, which are specified on the command line and are identified by the position. The class uses the information provided by the user to associate a name with every positional option, or tell that no name is known.

The primary assumption is that only the relative order of the positional options themselves matters, and that any interleaving ordinary options don't affect interpretation of positional options.

The user initializes the class by specifying that first N positional options should be given the name X1, following M options should be given the name X2 and so on.

Constructor & Destructor Documentation

boost::program_options::positional_options_description::positional_options_description ( )

Member Function Documentation

positional_options_description& boost::program_options::positional_options_description::add ( const char *  name,
int  max_count 
)

Species that up to 'max_count' next positional options should be given the 'name'.

The value of '-1' means 'unlimited'. No calls to 'add' can be made after call with 'max_value' equal to '-1'.

unsigned boost::program_options::positional_options_description::max_total_count ( ) const

Returns the maximum number of positional options that can be present.

Can return (numeric_limits<unsigned>::max)() to indicate unlimited number.

const std::string& boost::program_options::positional_options_description::name_for_position ( unsigned  position) const

Returns the name that should be associated with positional options at 'position'.

Precondition: position < max_total_count()


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