8 #ifndef Sawyer_CommandLine_Boost_H
9 #define Sawyer_CommandLine_Boost_H
11 #include <Sawyer/CommandLine.h>
12 #include <Sawyer/Sawyer.h>
15 namespace CommandLine {
66 const std::string &doc);
95 std::ostream&
operator<<(std::ostream &out,
const options_description &x);
151 return as_helper(T());
156 T as_helper(
const T&) {
157 ASSERT_forbid(
pv.empty());
158 return pv.back().as<T>();
162 std::vector<T> as_helper(
const std::vector<T>&) {
163 std::vector<T> retval;
167 retval.push_back(elmt.as<T>());
180 size_t count(
const std::string &swName)
const;
char ** argv
Arguments saved by c'tor to be available during parsing.
Information about a parsed switch value.
command_line_parser & allow_unregistered()
Add predefined switches.
Facility mlog
Facility used by Sawyer components.
size_t count(const std::string &swName) const
Number of times a switch appeared.
command_line_parser & options(const options_description &)
Insert specified switch declarations.
The parser for a program command line.
const ParserResult & apply() const
Saves parsed values in switch-specified locations.
void notify(variables_map &)
Transfer map to C++ variables.
Sawyer::CommandLine::ParsedValues pv
Wrapped ParsedValues.
std::vector< ParsedValue > ParsedValues
A vector of parsed values.
Sawyer::CommandLine::ParserResult run()
Parse command-line.
parsed_values operator[](const std::string &swName) const
Saved values for a switch.
The result from parsing a command line.
command_line_parser(int argc, char *argv[])
Construct a parser.
int argc
Argument count saved by c'tor to be available during parsing.
@ FATAL
Messages that indicate an abnormal situation from which the program was unable to recover.
void store(const Sawyer::CommandLine::ParserResult &results, variables_map &output)
Transfer parser results to map.
Sawyer::CommandLine::SwitchGroup sg
The underlying Sawyer mechanism.
std::list< ParsedValue > ValueList
Value type for list ParsedValue.
T as()
Convert parsed value to another type.
ParserResult parse(int argc, char *argv[])
Parse program arguments.
parsed_values()
Wrap nothing.
std::ostream & operator<<(std::ostream &out, const options_description &x)
Print documentation for a few switches.
options_description(const std::string &title)
Construct an empty switch group having a title.
options_description & operator()(const std::string &switchName, const value< std::string > &, const std::string &doc)
Declare a switch of specified type.
Sawyer::CommandLine::Parser parser
Wrapped parser.
Name space for the entire library.
options_description & add(const options_description &other)
Insert other switches into this group.
Replacement for basic use of boost::program_options::value.
Wrapper around ParserResult.
options_description()
Construct an empty switch group without documentation.
This namespace contains template functions that operate on the ROSE AST.
Replacement for basic use of boost::program_options::options_description.
Wrapper around parsed values.
Wrapper around Sawyer's CommandLine class.
A collection of related switch declarations.
Sawyer::CommandLine::ParserResult pr
Wrapped ParserResult.
void print() const
Print switch documentation.
Parser & errorStream(const Message::SProxy &stream)
Specifies a message stream to which errors are sent.
T as() const
Convenient any_cast.
options_description & add_options()
Boost intermediate type for adding more switches.
parsed_values(const Sawyer::CommandLine::ParsedValues &pv)
Wrap ParsedValues.