ROSE 0.11.145.147
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);
UserAction< Functor >::Ptr userAction(const Functor &functor)
Factory for switch action.

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

#include <Sawyer/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.
 
- Public Member Functions inherited from Sawyer::SharedObject
 SharedObject ()
 Default constructor.
 
 SharedObject (const SharedObject &)
 Copy constructor.
 
virtual ~SharedObject ()
 Virtual destructor.
 
SharedObjectoperator= (const SharedObject &)
 Assignment.
 

Protected Member Functions

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

Member Typedef Documentation

◆ Ptr

Reference counting pointer for this class.

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

Constructor & Destructor Documentation

◆ ~SwitchAction()

virtual Sawyer::CommandLine::SwitchAction::~SwitchAction ( )
inlinevirtual

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

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 Sawyer/CommandLine.h.


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