A list of options logically grouped under a caption. More...
#include <program_options.h>
Public Types | |
typedef OptionList::const_iterator | option_iterator |
typedef std::vector< SharedOptPtr > | OptionList |
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 |
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.
typedef OptionList::const_iterator ProgramOptions::OptionGroup::option_iterator |
Definition at line 91 of file program_options.h.
typedef std::vector<SharedOptPtr> ProgramOptions::OptionGroup::OptionList |
Definition at line 90 of file program_options.h.
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.
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.
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.
option_iterator ProgramOptions::OptionGroup::begin | ( | ) | const [inline] |
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.
DescriptionLevel ProgramOptions::OptionGroup::descLevel | ( | ) | const [inline] |
Definition at line 106 of file program_options.h.
bool ProgramOptions::OptionGroup::empty | ( | ) | const [inline] |
Definition at line 103 of file program_options.h.
option_iterator ProgramOptions::OptionGroup::end | ( | ) | const [inline] |
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.
std::size_t ProgramOptions::OptionGroup::maxColumn | ( | DescriptionLevel | level | ) | const |
Definition at line 240 of file program_options.cpp.
void ProgramOptions::OptionGroup::setDescriptionLevel | ( | DescriptionLevel | level | ) | [inline] |
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.
friend class OptionContext [friend] |
Definition at line 133 of file program_options.h.
std::string ProgramOptions::OptionGroup::caption_ [private] |
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.