uvw 3.1.0
Loading...
Searching...
No Matches
Public Member Functions | List of all members
uvw::emitter< T, E > Class Template Reference

Event emitter base class. More...

#include <emitter.h>

Inheritance diagram for uvw::emitter< T, E >:
Inheritance graph
[legend]

Public Member Functions

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

Detailed Description

template<typename T, typename... E>
class uvw::emitter< T, E >

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 T , typename... E>
template<typename U >
bool uvw::emitter< T, E >::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 T , typename... E>
template<typename U >
void uvw::emitter< T, E >::on ( listener_t< U >  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 E &, T &), where E is the type of the event and T 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: