uvw 3.4.0
Loading...
Searching...
No Matches
uvw::emitter< Elem, Event > Class Template Reference

Event emitter base class. More...

#include <emitter.h>

Public Member Functions

template<typename Type>
void on (listener_t< Type > f)
 Registers a long-lived listener with the event emitter.
 
template<typename Type>
void reset () noexcept
 Disconnects the listener for the given event type.
 
void reset () noexcept
 Disconnects all listeners.
 
template<typename Type>
bool has () const noexcept
 Checks if there is a listener registered for the specific event.
 

Detailed Description

template<typename Elem, typename... Event>
class uvw::emitter< Elem, Event >

Event emitter base class.

Almost everything in uvw is an event emitter.
This is the base class from which resources and loops inherit.

Definition at line 83 of file emitter.h.

Member Function Documentation

◆ has()

template<typename Elem, typename... Event>
template<typename Type>
bool uvw::emitter< Elem, Event >::has ( ) const
inlinenoexcept

Checks if there is a listener registered for the specific event.

Returns
True if there is a listener registered for the specific event, false otherwise.

Definition at line 145 of file emitter.h.

◆ on()

template<typename Elem, typename... Event>
template<typename Type>
void uvw::emitter< Elem, Event >::on ( listener_t< Type > f)
inline

Registers a long-lived listener with the event emitter.

This method is used to register a listener with the emitter.
A listener is usually defined as a callable object assignable to a std::function<void(const Event &, Elem &), where Event is the type of the event and Elem is the type of the resource.

Parameters
fA valid listener to be registered.

Definition at line 123 of file emitter.h.


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