ROSE  0.9.9.109
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 1565 of file 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. More...
 

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 Typedef Documentation

Reference counting pointer for this class.

Definition at line 1568 of file CommandLine.h.

Member Function Documentation

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 1572 of file CommandLine.h.


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