ROSE 0.11.145.317
Public Types | Static Public Member Functions | Protected Member Functions | List of all members
Sawyer::CommandLine::ConfigureDiagnostics Class Reference

Description

Functor to configure diagnostics.

This functor uses the string(s) from the specified switch key to configure the specified message facilities object. If a string is the word "list" then the message facility configuration is shown on standard output. If the string is the word "help" then some documentation is emitted on std::cout and the program optionally exits with success (depending on exitOnHelp).

Here's an example usage. In particular, be sure to specify SAVE_ALL so that more than one –log switch can appear on the command line, like: a.out –log ">=info" –log list

generic.insert(Switch("log")
.argument("config")
.whichValue(SAVE_ALL)
.doc("Configures diagnostics..."));
Describes one command-line switch.
ConfigureDiagnostics::Ptr configureDiagnostics(const std::string &, Message::Facilities &, bool exitOnHelp=true)
Factory for switch action.
@ SAVE_ALL
Save all values as a vector.
Facilities mfacilities
Library-provided facility group.

Definition at line 1721 of file Sawyer/CommandLine.h.

#include <Sawyer/CommandLine.h>

Inheritance diagram for Sawyer::CommandLine::ConfigureDiagnostics:
Inheritance graph
[legend]
Collaboration diagram for Sawyer::CommandLine::ConfigureDiagnostics:
Collaboration graph
[legend]

Public Types

typedef SharedPointer< ConfigureDiagnosticsPtr
 Reference counting pointer for this class.
 
- Public Types inherited from Sawyer::CommandLine::SwitchAction
typedef SharedPointer< SwitchActionPtr
 Reference counting pointer for this class.
 

Public Member Functions

bool exitOnHelp () const
 Property: program exit after help is displayed.
 
void exitOnHelp (bool)
 Property: program exit after help is displayed.
 
- Public Member Functions inherited from Sawyer::CommandLine::SwitchAction
void run (const ParserResult &parserResult)
 Runs the action.
 
- Public Member Functions inherited from Sawyer::SharedObject
 SharedObject ()
 Default constructor.
 
 SharedObject (const SharedObject &)
 Copy constructor.
 
virtual ~SharedObject ()
 Virtual destructor.
 
SharedObjectoperator= (const SharedObject &)
 Assignment.
 

Static Public Member Functions

static Ptr instance (const std::string &switchKey, Message::Facilities &facilities, bool exitOnHelp=true)
 Allocating constructor.
 

Protected Member Functions

 ConfigureDiagnostics (const std::string &switchKey, Message::Facilities &facilities, bool exitOnHelp)
 Constructor for derived classes.
 
virtual void operator() (const ParserResult &)
 

Member Typedef Documentation

◆ Ptr

Reference counting pointer for this class.

Definition at line 1735 of file Sawyer/CommandLine.h.

Constructor & Destructor Documentation

◆ ConfigureDiagnostics()

Sawyer::CommandLine::ConfigureDiagnostics::ConfigureDiagnostics ( const std::string &  switchKey,
Message::Facilities facilities,
bool  exitOnHelp 
)
protected

Constructor for derived classes.

Non-subclass users should use instance instead.

Member Function Documentation

◆ instance()

static Ptr Sawyer::CommandLine::ConfigureDiagnostics::instance ( const std::string &  switchKey,
Message::Facilities facilities,
bool  exitOnHelp = true 
)
static

Allocating constructor.

Returns a pointer to a new ConfigureDiagnostics object. Users will most likely want to use the configureDiagnostics factory instead, which requires less typing.

See also
Command line action factories, and the SwitchAction class.

◆ exitOnHelp() [1/2]

bool Sawyer::CommandLine::ConfigureDiagnostics::exitOnHelp ( ) const

Property: program exit after help is displayed.

If true, then the program exits with success immediately after a "help" command is processed.

◆ exitOnHelp() [2/2]

void Sawyer::CommandLine::ConfigureDiagnostics::exitOnHelp ( bool  )

Property: program exit after help is displayed.

If true, then the program exits with success immediately after a "help" command is processed.

◆ operator()()

virtual void Sawyer::CommandLine::ConfigureDiagnostics::operator() ( const ParserResult )
protectedvirtual

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