Public Types | Public Member Functions | Private Attributes | Friends
ProgramOptions::OptionGroup Class Reference

A list of options logically grouped under a caption. More...

#include <program_options.h>

List of all members.

Public Types

typedef OptionList::const_iterator option_iterator
typedef std::vector< SharedOptPtrOptionList

Public Member Functions

void addOption (std::auto_ptr< Option > option)
 Adds option to this group.
OptionInitHelper addOptions ()
 Returns an object that can be used to add options.
option_iterator begin () const
const std::string & caption () const
 Returns the caption of this group.
DescriptionLevel descLevel () const
bool empty () const
option_iterator end () const
void format (OptionOutput &out, size_t maxW, DescriptionLevel level=desc_level_default) const
 Creates a formated description of all options with level() <= level in this group.
std::size_t maxColumn (DescriptionLevel level) const
 OptionGroup (const std::string &caption="", DescriptionLevel descLevel=desc_level_default)
void setDescriptionLevel (DescriptionLevel level)
std::size_t size () const
 ~OptionGroup ()

Private Attributes

std::string caption_
DescriptionLevel level_
OptionList options_

Friends

class OptionContext

Detailed Description

A list of options logically grouped under a caption.

The class provides a logical grouping of options that is mainly useful for printing help.

Definition at line 88 of file program_options.h.


Member Typedef Documentation

typedef OptionList::const_iterator ProgramOptions::OptionGroup::option_iterator

Definition at line 91 of file program_options.h.

Definition at line 90 of file program_options.h.


Constructor & Destructor Documentation

ProgramOptions::OptionGroup::OptionGroup ( const std::string &  caption = "",
DescriptionLevel  descLevel = desc_level_default 
)

Creates a new group of options under the given caption.

Definition at line 228 of file program_options.cpp.

Definition at line 229 of file program_options.cpp.


Member Function Documentation

void ProgramOptions::OptionGroup::addOption ( std::auto_ptr< Option option)

Adds option to this group.

Definition at line 235 of file program_options.cpp.

Returns an object that can be used to add options.

usage
 OptionGroup g("Some Options");
 ValueMap m;
 g.addOptions()
   ("opt1", store<int>(m), "some int value")   // <- no semicolon
   ("opt2", store<double>(m))                  // <- no semicolon
   ("opt3", store<char>(m))                    // <- no semicolon
 ;                                            // <- note the semicolon!

Definition at line 231 of file program_options.cpp.

Definition at line 104 of file program_options.h.

const std::string& ProgramOptions::OptionGroup::caption ( ) const [inline]

Returns the caption of this group.

Definition at line 100 of file program_options.h.

Definition at line 106 of file program_options.h.

bool ProgramOptions::OptionGroup::empty ( ) const [inline]

Definition at line 103 of file program_options.h.

Definition at line 105 of file program_options.h.

void ProgramOptions::OptionGroup::format ( OptionOutput out,
size_t  maxW,
DescriptionLevel  level = desc_level_default 
) const

Creates a formated description of all options with level() <= level in this group.

Definition at line 250 of file program_options.cpp.

Definition at line 240 of file program_options.cpp.

Definition at line 126 of file program_options.h.

std::size_t ProgramOptions::OptionGroup::size ( ) const [inline]

Definition at line 102 of file program_options.h.


Friends And Related Function Documentation

friend class OptionContext [friend]

Definition at line 133 of file program_options.h.


Member Data Documentation

Definition at line 134 of file program_options.h.

Definition at line 136 of file program_options.h.

Definition at line 135 of file program_options.h.


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


clasp
Author(s): Benjamin Kaufmann
autogenerated on Thu Aug 27 2015 12:41:41