ROSE  0.11.96.11
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 98 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.
 
char ** argv
 Arguments saved by c'tor to be available during parsing.
 
Sawyer::CommandLine::Parser parser
 Wrapped parser.
 

Constructor & Destructor Documentation

◆ command_line_parser()

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 106 of file CommandLineBoost.h.

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

Here is the call graph for this function:

Member Function Documentation

◆ allow_unregistered()

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 123 of file CommandLineBoost.h.

◆ run()

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 128 of file CommandLineBoost.h.

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

Here is the call graph for this function:

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