ROSE  0.11.96.11
Public Types | Public Member Functions | Protected Member Functions | List of all members
Sawyer::CommandLine::SwitchAction Class Referenceabstract

Description

Base class for switch actions.

These objects represent some action that occurs after all switches are parsed and the ParserResult::apply method is called.

Actions are always allocated on the heap and reference counted. Each action defines a class factory method, instance, to allocate a new object and return a pointer to it. The pointer types are named Ptr and are defined within the class. For convenience, the actions built into the library also have global factory functions which have the same name as the class but start with an initial lower-case letter (see Command line action factories for details). For instance:

SwitchAction::Ptr action1 = UserAction::instance<MyFunctor>(myFunctor);
SwitchAction::Ptr action2 = userAction(myFunctor);

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

#include <CommandLine.h>

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

Public Types

typedef SharedPointer< SwitchActionPtr
 Reference counting pointer for this class.
 

Public Member Functions

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...
 

Protected Member Functions

virtual void operator() (const ParserResult &)=0
 

Member Function Documentation

◆ run()

void Sawyer::CommandLine::SwitchAction::run ( const ParserResult parserResult)
inline

Runs the action.

Calling this method will cause the function operator to be invoked with the parser results.

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


The documentation for this class was generated from the following file:
Sawyer::CommandLine::SwitchAction::Ptr
SharedPointer< SwitchAction > Ptr
Reference counting pointer for this class.
Definition: util/Sawyer/CommandLine.h:1615
Sawyer::CommandLine::userAction
UserAction< Functor >::Ptr userAction(const Functor &functor)
Factory for switch action.
Definition: util/Sawyer/CommandLine.h:1871