manages the lifetime, subscription, and unsubscription of callbacks
More...
#include <listener.hpp>
|
|
| Listener (bool state) |
| template<typename TEvent> |
| void | unsubscribe (std::string_view name) noexcept |
| | unsubscribes every event in type TEvent with that name
|
| template<typename TEvent, EventCallback< TEvent & > F> |
| void | subscribe (std::string name, F &&callback, char priority=0) noexcept |
| | subscribes a callback to an TEvent
|
| template<typename TEvent, EventCallback< TEvent & > F> |
| void | subscribe (F &&callback, char priority=0) noexcept |
| | subscribes a callback to an TEvent (name will be set to "unnamed")
|
|
void | enabled (bool state) |
| | enables/disables the callbacks in the listener
|
| auto | enabled () const -> bool |
manages the lifetime, subscription, and unsubscription of callbacks
◆ enabled()
| auto event::Listener::enabled |
( |
| ) |
const -> bool |
|
nodiscard |
◆ subscribe() [1/2]
template<typename TEvent, EventCallback< TEvent & > F>
| void event::Listener::subscribe |
( |
F && | callback, |
|
|
char | priority = 0 ) |
|
noexcept |
subscribes a callback to an TEvent (name will be set to "unnamed")
- Parameters
-
| callback | |
| priority | (higher priority happens first) |
◆ subscribe() [2/2]
template<typename TEvent, EventCallback< TEvent & > F>
| void event::Listener::subscribe |
( |
std::string | name, |
|
|
F && | callback, |
|
|
char | priority = 0 ) |
|
noexcept |
subscribes a callback to an TEvent
- Parameters
-
| name | of the callback |
| callback | |
| priority | (higher priority happens first) |
◆ unsubscribe()
template<typename TEvent>
| void event::Listener::unsubscribe |
( |
std::string_view | name | ) |
|
|
noexcept |
unsubscribes every event in type TEvent with that name
- Parameters
-
| name | event callback name/s to remove |
The documentation for this class was generated from the following files: