Class for containing multiple levels of boost program options.
More...
#include <MultiDetailOptions.hpp>
|
| MultiDetailOptions (const MultiDetailOptions &)=delete |
| Not copy-constructable.
|
|
MultiDetailOptions & | operator= (const MultiDetailOptions &)=delete |
| Not assignable.
|
|
| MultiDetailOptions ()=delete |
| Not default-constructable.
|
|
| MultiDetailOptions (const std::string &name, uint32_t w=80, uint32_t hw=40) |
| Construction with group nam.
|
|
const po::options_description & | getOptionsLevelUpTo (level_t level) const |
| Gets the description object for a particular level if that level exists. If that level does not exist, returns the highest level less than level where options exist. Will never throw because VERBOSE is guaranteed to exist. Only VERBOSE and BRIEF levels are guaranteed to exist.
|
|
const po::options_description & | getOptionsLevel (level_t level) const |
| Gets the description object for a particular level. Only VERBOSE and BRIEF levels are guaranteed to exist.
|
|
const po::options_description & | getVerboseOptions () const noexcept |
| Gets the description object for the VERBOSE level.
|
|
size_t | getNumLevels () const |
| Returns the number of levels that have an options description which can be retrieved through getLevel.
|
|
template<typename ... Args> |
OptAdder & | add_options (const char *name, const char *verbose_desc, const Args &...args) |
| Add an option with NO value semantic and any number of descriptions. See the other add_options signature for details.
|
|
template<typename ... Args> |
OptAdder & | add_options (const char *name, const boost::program_options::value_semantic *s, const char *verbose_desc, const Args &...args) |
| Add an option with a value semantic and any number of descriptions.
|
|
OptAdder & | add_options () |
| Empty add_options shell allowing the start of chained calls (exists solely to mimic boost's syntax)
|
|
|
static const level_t | VERBOSE = 0 |
|
static const level_t | BRIEF = 1 |
|
|
class | OptAdded |
| Allow access to private adding methods.
|
|
Class for containing multiple levels of boost program options.
Definition at line 293 of file MultiDetailOptions.hpp.
◆ level_t
typedef uint32_t sparta::app::MultiDetailOptions::level_t |
◆ MultiDetailOptions()
sparta::app::MultiDetailOptions::MultiDetailOptions |
( |
const std::string & |
name, |
|
|
uint32_t |
w = 80 , |
|
|
uint32_t |
hw = 40 |
|
) |
| |
|
inline |
Construction with group nam.
- Postcondition
- Ensures that the VERBOSE options entry and BRIEF entries exist
Definition at line 367 of file MultiDetailOptions.hpp.
◆ add_options() [1/3]
OptAdder & sparta::app::MultiDetailOptions::add_options |
( |
| ) |
|
|
inline |
Empty add_options shell allowing the start of chained calls (exists solely to mimic boost's syntax)
Example:
opts.add_option()("bar",
"verbose description of bar",
"brief bar desc")
Definition at line 483 of file MultiDetailOptions.hpp.
◆ add_options() [2/3]
template<typename ... Args>
OptAdder & sparta::app::MultiDetailOptions::add_options |
( |
const char * |
name, |
|
|
const boost::program_options::value_semantic * |
s, |
|
|
const char * |
verbose_desc, |
|
|
const Args &... |
args |
|
) |
| |
|
inline |
Add an option with a value semantic and any number of descriptions.
- Template Parameters
-
...Args | variadic argument container type. Automatically deduced by call signature |
- Parameters
-
name | Name of the option to be interpreted by boost::program_options::options_description (e.g. "help,h"). |
s | Value semantic. Typically something generated by the helper sparta::app::named_value or boost::program_options::value<T>(). |
verbose_desc | Verbose description. All options have a required verbose description so they show up in verbose help (which is practically a man page) and can be appropriately parsed by boost |
...args | Additional const char* description arguments (like verbose_desc). Each additional argument is assigned to the next higher options level for this option (name). If no additional descriptions are given, this option will not have an entry when the options are printed for that level. Generally, each additional level becomes more brief. |
Example:
opts.add_option("bar",
"verbose description of bar",
"brief bar desc")
Definition at line 461 of file MultiDetailOptions.hpp.
◆ add_options() [3/3]
template<typename ... Args>
OptAdder & sparta::app::MultiDetailOptions::add_options |
( |
const char * |
name, |
|
|
const char * |
verbose_desc, |
|
|
const Args &... |
args |
|
) |
| |
|
inline |
Add an option with NO value semantic and any number of descriptions. See the other add_options signature for details.
Definition at line 425 of file MultiDetailOptions.hpp.
◆ getNumLevels()
size_t sparta::app::MultiDetailOptions::getNumLevels |
( |
| ) |
const |
|
inline |
Returns the number of levels that have an options description which can be retrieved through getLevel.
Definition at line 416 of file MultiDetailOptions.hpp.
◆ getOptionsLevel()
const po::options_description & sparta::app::MultiDetailOptions::getOptionsLevel |
( |
level_t |
level | ) |
const |
|
inline |
Gets the description object for a particular level. Only VERBOSE and BRIEF levels are guaranteed to exist.
- Note
- When actually parsing using these options, use the VERBOSE level
- Exceptions
-
Exception | if there is no options set at level |
Definition at line 401 of file MultiDetailOptions.hpp.
◆ getOptionsLevelUpTo()
const po::options_description & sparta::app::MultiDetailOptions::getOptionsLevelUpTo |
( |
level_t |
level | ) |
const |
|
inline |
Gets the description object for a particular level if that level exists. If that level does not exist, returns the highest level less than level where options exist. Will never throw because VERBOSE is guaranteed to exist. Only VERBOSE and BRIEF levels are guaranteed to exist.
- Note
- When actually parsing using these options, use the VERBOSE level
Definition at line 386 of file MultiDetailOptions.hpp.
◆ getVerboseOptions()
const po::options_description & sparta::app::MultiDetailOptions::getVerboseOptions |
( |
| ) |
const |
|
inlinenoexcept |
◆ OptAdded
◆ BRIEF
const level_t sparta::app::MultiDetailOptions::BRIEF = 1 |
|
static |
◆ VERBOSE
const level_t sparta::app::MultiDetailOptions::VERBOSE = 0 |
|
static |
The documentation for this class was generated from the following file: