#include <hps.h>

Public Types | |
enum | HandleResult : uint32_t { HandleResult::Handled, HandleResult::NotHandled } |
Public Member Functions | |
EventHandler () | |
EventHandler (EventHandler const &in_that) | |
EventHandler (EventHandler &&in_that) | |
virtual HandleResult | Handle (Event const *in_event) |
HPS::Type | ObjectType () const |
EventHandler & | operator= (EventHandler &&in_that) |
EventHandler & | operator= (EventHandler const &in_that) |
virtual void | Reset () |
void | Shutdown () |
bool | Subscribe (EventDispatcher const &in_dispatcher, intptr_t in_type) const |
bool | UnSubscribe (EventDispatcher const &in_dispatcher, intptr_t in_type) const |
bool | UnSubscribe (EventDispatcher const &in_dispatcher) const |
void | UnSubscribeEverything () const |
![]() | |
virtual bool | Empty () const |
intptr_t | GetClassID () const |
intptr_t | GetInstanceID () const |
bool | HasType (HPS::Type in_mask) const |
Object (Object const &that) | |
Object (Object &&in_that) | |
Object & | operator= (Object const &other_object) |
Object & | operator= (Object &&in_that) |
virtual HPS::Type | Type () const |
Static Public Attributes | |
static const HPS::Type | staticType = HPS::Type::EventHandler |
![]() | |
static const HPS::Type | staticType = HPS::Type::None |
Additional Inherited Members | |
![]() | |
template<typename T > | |
static intptr_t | ClassID () |
Detailed Description
The EventHandler class is the base class for any event handler that can be created. All custom event handlers should inherit from this.
Member Enumeration Documentation
|
strong |
Enumeration of the values the EventHandler uses to indicate if it handled an event.
Enumerator | |
---|---|
Handled |
The event was handled by this EventHandler. Consume the event if possible. |
NotHandled |
The event was not handled by this EventHandler. Pass to the next handler if any or if possible. |
Constructor & Destructor Documentation
HPS::EventHandler::EventHandler | ( | ) |
The default constructor creates an EventHandler object not subscribed to any event.
HPS::EventHandler::EventHandler | ( | EventHandler const & | in_that | ) |
The copy constructor creates a new EventHandler object that points to the same underlying impl as the source EventHandler.
- Parameters
-
in_that The source EventHandler to point to.
HPS::EventHandler::EventHandler | ( | EventHandler && | in_that | ) |
The move constructor creates an EventHandler by transferring the underlying impl of the rvalue reference to this EventHandler thereby avoiding a copy and allocation.
- Parameters
-
in_that An rvalue reference to an EventHandler to take the impl from.
Member Function Documentation
|
inlinevirtual |
Function that gets triggered if this EventHandler receives an event it is subscribed to. This should be overridden by subclasses of EventHandler to perform any custom behavior.
- Parameters
-
in_event Event which was triggered.
- Returns
- Handled if the event was handled, NotHandled otherwise.
|
inlinevirtual |
This function returns the type the object, as declared (if the object is derived, this does not give the true type of the derived object).
- Returns
- The declared type of the object in question, which may differ from the true, underlying type.
Reimplemented from HPS::Object.
EventHandler& HPS::EventHandler::operator= | ( | EventHandler && | in_that | ) |
The move assignment operator transfers the underlying impl of the rvalue reference to this EventHandler thereby avoiding a copy.
- Parameters
-
in_that An rvalue reference to an EventHandler to take the impl from.
- Returns
- A reference to this EventHandler.
EventHandler& HPS::EventHandler::operator= | ( | EventHandler const & | in_that | ) |
Share the underlying smart-pointer of the EventHandler source.
- Parameters
-
in_that The EventHandler source of the assignment.
- Returns
- A reference to this EventHandler.
|
inlinevirtual |
Resets this object to its initial, uninitialized state.
Reimplemented from HPS::Object.
void HPS::EventHandler::Shutdown | ( | ) |
Notifies the EventDispatcher that this handler is being invalidated and no further events should be dispatched to it. This method must be called in any derived class destructors.
bool HPS::EventHandler::Subscribe | ( | EventDispatcher const & | in_dispatcher, |
intptr_t | in_type | ||
) | const |
Add this EventHandler object to the list of subscribers for events of the specified type on the specified EventDispatcher.
- Parameters
-
in_dispatcher Dispatcher from which to receive events of the given type. in_type Type of event to receive from the dispatcher.
- Returns
- true if the subscription was successful, false otherwise.
bool HPS::EventHandler::UnSubscribe | ( | EventDispatcher const & | in_dispatcher, |
intptr_t | in_type | ||
) | const |
Remove this EventHandler object from the list of subscribers for events of the specified type on the specified EventDispatcher.
- Parameters
-
in_dispatcher Dispatcher from which to no longer receive events of the given type. in_type Type of event to no longer receive from the dispatcher.
- Returns
- true if the unsubscription was successful, false otherwise.
bool HPS::EventHandler::UnSubscribe | ( | EventDispatcher const & | in_dispatcher | ) | const |
Remove this EventHandler object from the list of subscribers for all events on the specified EventDispatcher.
- Parameters
-
in_dispatcher Dispatcher from which to no longer receive events.
- Returns
- true if the unsubscription was successful, false otherwise.
void HPS::EventHandler::UnSubscribeEverything | ( | ) | const |
Remove this EventHandler object from all events on all EventDispatchers.
The documentation for this class was generated from the following file:
- include/hps.h