Classes | Functions
Sawyer::CommandLine::Boost Namespace Reference


Drop-in replacement to help boost users.

Some users use boost::program_options, but due to the complexity of the interface, they use only the most basic features. Essentially, they use boost to map switches like "--foo=bar" into a map containing the pair ("foo", "bar") both represented as std::string. Their source code then makes decisions and obtains switch values by querying them from this map and converting them to a non-string type that's stored in a C++ variable for later reference.

Sawyer::CommandLine can also operate in this "pull" mode although it's most often used in "push" mode, where the command-line parsing package is responsible for converting the string argument to a non-string type and storing it in a C++ variable somewhere.


struct  command_line_parser
 Wrapper around Sawyer's CommandLine class. More...
struct  options_description
 Replacement for basic use of boost::program_options::options_description. More...
struct  parsed_values
 Wrapper around parsed values. More...
struct  value
 Replacement for basic use of boost::program_options::value. More...
struct  variables_map
 Wrapper around ParserResult. More...


std::ostream & operator<< (std::ostream &out, const options_description &x)
 Print documentation for a few switches. More...
void store (const Sawyer::CommandLine::ParserResult &results, variables_map &output)
 Transfer parser results to map. More...
void notify (variables_map &)
 Transfer map to C++ variables. More...

Function Documentation

std::ostream& Sawyer::CommandLine::Boost::operator<< ( std::ostream &  out,
const options_description x 

Print documentation for a few switches.

void Sawyer::CommandLine::Boost::store ( const Sawyer::CommandLine::ParserResult results,
variables_map output 

Transfer parser results to map.

void Sawyer::CommandLine::Boost::notify ( variables_map )

Transfer map to C++ variables.

This wrapper doesn't try to handle a "push" paradigm, but if you've gone around the wrapper to declare switches using Sawyer's interface and those switches were specified with storage locations, the data has already been moved before this function is called (it's part of command_line_parser::run).