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

Description

Wrapper around Sawyer's CommandLine class.

Definition at line 97 of file CommandLineBoost.h.

#include <CommandLineBoost.h>

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

Public Member Functions

 command_line_parser (int argc, char *argv[])
 Construct a parser. More...
 
command_line_parserallow_unregistered ()
 Add predefined switches. More...
 
Sawyer::CommandLine::ParserResult run ()
 Parse command-line. More...
 
command_line_parseroptions (const options_description &)
 Insert specified switch declarations.
 
command_line_parseroptions (const Sawyer::CommandLine::SwitchGroup &)
 Insert specified switch declarations.
 

Public Attributes

int argc
 Argument count saved by c'tor to be available during parsing. More...
 
char ** argv
 Arguments saved by c'tor to be available during parsing. More...
 
Sawyer::CommandLine::Parser parser
 Wrapped parser. More...
 

Constructor & Destructor Documentation

Sawyer::CommandLine::Boost::command_line_parser::command_line_parser ( int  argc,
char *  argv[] 
)
inline

Construct a parser.

The command-line is not actually parsed here – its only saved by reference until run is called.

Definition at line 105 of file CommandLineBoost.h.

References Sawyer::CommandLine::Parser::errorStream(), Sawyer::Message::FATAL, and Sawyer::Message::mlog.

Member Function Documentation

command_line_parser& Sawyer::CommandLine::Boost::command_line_parser::allow_unregistered ( )
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 122 of file CommandLineBoost.h.

Sawyer::CommandLine::ParserResult Sawyer::CommandLine::Boost::command_line_parser::run ( )
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 127 of file CommandLineBoost.h.

References Sawyer::CommandLine::ParserResult::apply(), and Sawyer::CommandLine::Parser::parse().

Member Data Documentation

int Sawyer::CommandLine::Boost::command_line_parser::argc

Argument count saved by c'tor to be available during parsing.

Definition at line 98 of file CommandLineBoost.h.

char** Sawyer::CommandLine::Boost::command_line_parser::argv

Arguments saved by c'tor to be available during parsing.

Definition at line 99 of file CommandLineBoost.h.

Sawyer::CommandLine::Parser Sawyer::CommandLine::Boost::command_line_parser::parser

Wrapped parser.

Definition at line 100 of file CommandLineBoost.h.


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