ROSE 0.11.145.147
Public Member Functions | Public Attributes | List of all members
Sawyer::CommandLine::Boost::options_description Struct Reference

Description

Replacement for basic use of boost::program_options::options_description.

The equivalent mechanism in Sawyer is a SwitchGroup that can hold declarations for zero or more switches.

Definition at line 43 of file CommandLineBoost.h.

#include <Sawyer/CommandLineBoost.h>

Collaboration diagram for Sawyer::CommandLine::Boost::options_description:
Collaboration graph
[legend]

Public Member Functions

 options_description ()
 Construct an empty switch group without documentation.
 
 options_description (const std::string &title)
 Construct an empty switch group having a title.
 
options_descriptionadd_options ()
 Boost intermediate type for adding more switches.
 
options_descriptionadd (const options_description &other)
 Insert other switches into this group.
 
void print () const
 Print switch documentation.
 
options_descriptionoperator() (const std::string &switchName, const value< std::string > &, const std::string &doc)
 Declare a switch of specified type.
 
options_descriptionoperator() (const std::string &switchName, const value< int > &, const std::string &doc)
 Declare a switch of specified type.
 
options_descriptionoperator() (const std::string &switchName, const value< long int > &, const std::string &doc)
 Declare a switch of specified type.
 
options_descriptionoperator() (const std::string &switchName, const value< std::vector< int > > &, const std::string &doc)
 Declare a switch of specified type.
 
options_descriptionoperator() (const std::string &switchName, const value< std::vector< std::string > > &, const std::string &doc)
 Declare a switch of specified type.
 
options_descriptionoperator() (const std::string &switchName, const std::string &doc)
 Declare a switch of specified type.
 

Public Attributes

Sawyer::CommandLine::SwitchGroup sg
 The underlying Sawyer mechanism.
 

Constructor & Destructor Documentation

◆ options_description() [1/2]

Sawyer::CommandLine::Boost::options_description::options_description ( )
inline

Construct an empty switch group without documentation.

Definition at line 48 of file CommandLineBoost.h.

◆ options_description() [2/2]

Sawyer::CommandLine::Boost::options_description::options_description ( const std::string &  title)
inlineexplicit

Construct an empty switch group having a title.

Definition at line 51 of file CommandLineBoost.h.

Member Function Documentation

◆ operator()() [1/6]

options_description & Sawyer::CommandLine::Boost::options_description::operator() ( const std::string &  switchName,
const value< std::string > &  ,
const std::string &  doc 
)

Declare a switch of specified type.

As with boost (but not Sawyer) the type of the switch value is wrapped up in a template class called value.

There are often slightly different semantics possible depending on the declaration details, but all that is glossed over in this simple wrapper.

◆ operator()() [2/6]

options_description & Sawyer::CommandLine::Boost::options_description::operator() ( const std::string &  switchName,
const value< int > &  ,
const std::string &  doc 
)

Declare a switch of specified type.

As with boost (but not Sawyer) the type of the switch value is wrapped up in a template class called value.

There are often slightly different semantics possible depending on the declaration details, but all that is glossed over in this simple wrapper.

◆ operator()() [3/6]

options_description & Sawyer::CommandLine::Boost::options_description::operator() ( const std::string &  switchName,
const value< long int > &  ,
const std::string &  doc 
)

Declare a switch of specified type.

As with boost (but not Sawyer) the type of the switch value is wrapped up in a template class called value.

There are often slightly different semantics possible depending on the declaration details, but all that is glossed over in this simple wrapper.

◆ operator()() [4/6]

options_description & Sawyer::CommandLine::Boost::options_description::operator() ( const std::string &  switchName,
const value< std::vector< int > > &  ,
const std::string &  doc 
)

Declare a switch of specified type.

As with boost (but not Sawyer) the type of the switch value is wrapped up in a template class called value.

There are often slightly different semantics possible depending on the declaration details, but all that is glossed over in this simple wrapper.

◆ operator()() [5/6]

options_description & Sawyer::CommandLine::Boost::options_description::operator() ( const std::string &  switchName,
const value< std::vector< std::string > > &  ,
const std::string &  doc 
)

Declare a switch of specified type.

As with boost (but not Sawyer) the type of the switch value is wrapped up in a template class called value.

There are often slightly different semantics possible depending on the declaration details, but all that is glossed over in this simple wrapper.

◆ operator()() [6/6]

options_description & Sawyer::CommandLine::Boost::options_description::operator() ( const std::string &  switchName,
const std::string &  doc 
)

Declare a switch of specified type.

As with boost (but not Sawyer) the type of the switch value is wrapped up in a template class called value.

There are often slightly different semantics possible depending on the declaration details, but all that is glossed over in this simple wrapper.

◆ add_options()

options_description & Sawyer::CommandLine::Boost::options_description::add_options ( )
inline

Boost intermediate type for adding more switches.

Sawyer does not need an intermediate type for adding switches since it uses an "insert" method and has a dedicated Switch type to hold all the switch properties.

Definition at line 74 of file CommandLineBoost.h.

◆ add()

options_description & Sawyer::CommandLine::Boost::options_description::add ( const options_description other)

Insert other switches into this group.

Copies the other switches into this switch group without making any attempt to resolve conflicts when the other group has switches with the same name as this group. If that happens, you might end up with one switch that parses a string and another that parses an integer, and depending on their order, the string declaration might hide the integer declarations since strings are a superset of integers.

◆ print()

void Sawyer::CommandLine::Boost::options_description::print ( ) const

Print switch documentation.

Sawyer normally produces manpage-style documentation for an entire program rather than line-oriented documentation for just a set of switch declarations. So in order to achieve the desired limited affect, this wrapper instantiates a temporary parser that contains these switches and nothing else.

Member Data Documentation

◆ sg

Sawyer::CommandLine::SwitchGroup Sawyer::CommandLine::Boost::options_description::sg

The underlying Sawyer mechanism.

Definition at line 45 of file CommandLineBoost.h.


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