ROSE  0.11.96.11
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..."));

Definition at line 1726 of file util/Sawyer/CommandLine.h.

#include <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. More...
 
void exitOnHelp (bool b)
 Property: program exit after help is displayed. More...
 
- Public Member Functions inherited from Sawyer::CommandLine::SwitchAction
void run (const ParserResult &parserResult)
 Runs the action. More...
 
- Public Member Functions inherited from Sawyer::SharedObject
 SharedObject ()
 Default constructor. More...
 
 SharedObject (const SharedObject &)
 Copy constructor. More...
 
virtual ~SharedObject ()
 Virtual destructor. More...
 
SharedObjectoperator= (const SharedObject &)
 Assignment. More...
 

Static Public Member Functions

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

Protected Member Functions

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

Constructor & Destructor Documentation

◆ ConfigureDiagnostics()

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

Constructor for derived classes.

Non-subclass users should use instance instead.

Definition at line 1734 of file util/Sawyer/CommandLine.h.

Member Function Documentation

◆ instance()

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

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.

Definition at line 1744 of file util/Sawyer/CommandLine.h.

◆ exitOnHelp() [1/2]

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

Property: program exit after help is displayed.

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

Definition at line 1753 of file util/Sawyer/CommandLine.h.

◆ exitOnHelp() [2/2]

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

Property: program exit after help is displayed.

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

Definition at line 1754 of file util/Sawyer/CommandLine.h.


The documentation for this class was generated from the following file:
Sawyer::CommandLine::configureDiagnostics
ConfigureDiagnostics::Ptr configureDiagnostics(const std::string &, Message::Facilities &, bool exitOnHelp=true)
Factory for switch action.
Sawyer::Message::mfacilities
Facilities mfacilities
Library-provided facility group.
Sawyer::CommandLine::SAVE_ALL
@ SAVE_ALL
Save all values as a vector.
Definition: util/Sawyer/CommandLine.h:2015