ROSE
0.11.96.11
|
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 util/Sawyer/CommandLine.h.
#include <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. More... | |
Protected Member Functions | |
UserAction (Functor &f) | |
Constructor for derived classes. More... | |
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. More... | |
Public Member Functions inherited from Sawyer::SharedObject | |
SharedObject () | |
Default constructor. More... | |
SharedObject (const SharedObject &) | |
Copy constructor. More... | |
virtual | ~SharedObject () |
Virtual destructor. More... | |
SharedObject & | operator= (const SharedObject &) |
Assignment. More... | |
|
inlineprotected |
Constructor for derived classes.
Non-subclass users should use instance instead.
Definition at line 1816 of file util/Sawyer/CommandLine.h.
Referenced by Sawyer::CommandLine::UserAction< Functor >::instance().
|
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 util/Sawyer/CommandLine.h.
References Sawyer::CommandLine::UserAction< Functor >::UserAction().
Referenced by Sawyer::CommandLine::userAction().