ROSE
0.11.96.11
|
Wrapper around Sawyer's CommandLine class.
Definition at line 98 of file CommandLineBoost.h.
#include <CommandLineBoost.h>
Public Member Functions | |
command_line_parser (int argc, char *argv[]) | |
Construct a parser. More... | |
command_line_parser & | allow_unregistered () |
Add predefined switches. More... | |
Sawyer::CommandLine::ParserResult | run () |
Parse command-line. More... | |
command_line_parser & | options (const options_description &) |
Insert specified switch declarations. | |
command_line_parser & | options (const Sawyer::CommandLine::SwitchGroup &) |
Insert specified switch declarations. | |
Public Attributes | |
int | argc |
Argument count saved by c'tor to be available during parsing. | |
char ** | argv |
Arguments saved by c'tor to be available during parsing. | |
Sawyer::CommandLine::Parser | parser |
Wrapped parser. | |
|
inline |
Construct a parser.
The command-line is not actually parsed here – its only saved by reference until run is called.
Definition at line 106 of file CommandLineBoost.h.
References Sawyer::CommandLine::Parser::errorStream(), Sawyer::Message::FATAL, Sawyer::Message::mlog, and parser.
|
inline |
Add predefined switches.
The boost version of this method causes boost to capture values of switches that have not been declared. Although Sawyer is also capable of skipping over and accumulating arguments that look like switches but which have not been declared, doing so is fraught with danger. Imagine the synchronization and missing code problems that would result if a source code compiler took this same approach!
Definition at line 123 of file CommandLineBoost.h.
|
inline |
Parse command-line.
Parses the command line and return results. If the syntax is good, this also runs the "--help" switch if present.
Definition at line 128 of file CommandLineBoost.h.
References Sawyer::CommandLine::ParserResult::apply(), argc, argv, Sawyer::CommandLine::Parser::parse(), and parser.