ROSE 0.11.145.147
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 <Sawyer/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.
 
command_line_parserallow_unregistered ()
 Add predefined switches.
 
Sawyer::CommandLine::ParserResult run ()
 Parse command-line.
 
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.

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.

Member Data Documentation

◆ argc

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

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

Definition at line 99 of file CommandLineBoost.h.

Referenced by run().

◆ argv

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

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

Definition at line 100 of file CommandLineBoost.h.

Referenced by run().

◆ parser

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

Wrapped parser.

Definition at line 101 of file CommandLineBoost.h.

Referenced by command_line_parser(), and run().


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