ROSE 0.11.145.147
|
Wrapper around a user functor.
User code doesn't often use reference counting smart pointers for functors, but more often creates functors in global data or on the stack. The purpose of UserAction is to be a wrapper around these functors, to be a bridge between the world of reference counting pointers and objects or object references. For example, say the user has a function like this:
Then the functor/function can be used like this:
Definition at line 1812 of file Sawyer/CommandLine.h.
#include <Sawyer/CommandLine.h>
Public Types | |
typedef SharedPointer< class UserAction > | Ptr |
Reference counting pointer for this class. | |
Public Types inherited from Sawyer::CommandLine::SwitchAction | |
typedef SharedPointer< SwitchAction > | Ptr |
Reference counting pointer for this class. | |
Static Public Member Functions | |
static Ptr | instance (Functor &f) |
Allocating constructor. | |
Protected Member Functions | |
UserAction (Functor &f) | |
Constructor for derived classes. | |
virtual void | operator() (const ParserResult &parserResult) |
Additional Inherited Members | |
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. | |
SharedObject & | operator= (const SharedObject &) |
Assignment. | |
typedef SharedPointer<class UserAction> Sawyer::CommandLine::UserAction< Functor >::Ptr |
Reference counting pointer for this class.
Definition at line 1819 of file Sawyer/CommandLine.h.
|
inlineprotected |
Constructor for derived classes.
Non-subclass users should use instance instead.
Definition at line 1816 of file Sawyer/CommandLine.h.
|
inlinestatic |
Allocating constructor.
Returns a pointer to a new UserAction object. Uses will most likely want to use the userAction factory instead, which requires less typing.
Definition at line 1825 of file Sawyer/CommandLine.h.
Referenced by Sawyer::CommandLine::userAction().
|
inlineprotectedvirtual |
Implements Sawyer::CommandLine::SwitchAction.
Definition at line 1827 of file Sawyer/CommandLine.h.