libcommonc++  0.7
EventHandlerDelegate< T, E > Class Template Reference

An implementation of EventHandler that delegates to a method in an object. More...

#include <EventHandler.h++>

Inheritance diagram for EventHandlerDelegate< T, E >:
Collaboration diagram for EventHandlerDelegate< T, E >:

Public Member Functions

 EventHandlerDelegate (T *object, void(T::*func)(E))
 Construct a new EventHandlerDelegate for an object. More...
 
void operator() (E event)
 Function-call operator. More...
 

Protected Member Functions

void invoke (E event)
 Invoke the handler with an event. More...
 

Detailed Description

template<class T, class E>
class ccxx::EventHandlerDelegate< T, E >

An implementation of EventHandler that delegates to a method in an object.

The object can be thought of as a pointer to an event handler method that can be invoked as if it were a function; it allows an object to declare one or more event-handling methods to be used as callbacks.

Author
Mark Lindner

Constructor & Destructor Documentation

◆ EventHandlerDelegate()

EventHandlerDelegate ( T *  object,
void(T::*)(E)  func 
)
inline

Construct a new EventHandlerDelegate for an object.

Parameters
objectThe object.
funcA member function (method) in the object which will serve as the event handler.

Member Function Documentation

◆ invoke()

void invoke ( event)
inlineprotectedvirtual

Invoke the handler with an event.

Parameters
eventThe event.

Implements EventHandler< E >.

◆ operator()()

void operator() ( event)
inlineinherited

Function-call operator.

The method simply delegates to invoke().

Parameters
eventThe event.

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