HephAudio v3.0.6
A cross-platform C++ library for recording, playing, and processing audio on Windows, Android, Linux, iOS, and macOS.
Loading...
Searching...
No Matches
Event.h
Go to the documentation of this file.
1#pragma once
2#include "HephShared.h"
3#include "EventArgs.h"
4#include "EventResult.h"
5#include "EventParams.h"
6#include "UserEventArgs.h"
7#include <vector>
8#include <cinttypes>
9
12namespace Heph
13{
18 typedef void (*EventHandler)(const EventParams& eventParams);
19
24 class HEPH_API Event final
25 {
26 private:
27 std::vector<EventHandler> eventHandlers;
28
29 public:
32
33 public:
39
40 operator bool() const;
41
48 void operator()(EventArgs* pArgs, EventResult* pResult) const;
49
50 Event& operator=(EventHandler handler);
51 Event& operator+=(EventHandler handler);
52 Event& operator-=(EventHandler handler);
53
58 size_t EventHandlerCount() const;
59
65 bool EventHandlerExists(EventHandler handler) const;
66
72 EventHandler GetEventHandler(size_t index) const;
73
78 void SetEventHandler(EventHandler handler);
79
84 void AddEventHandler(EventHandler handler);
85
91 void InsertEventHandler(EventHandler handler, size_t index);
92
97 void RemoveEventHandler(EventHandler handler);
98
104 void RemoveEventHandler(size_t index);
105
111
116 void ClearAll();
117
124 void Invoke(EventArgs* pArgs, EventResult* pResult) const;
125 };
126}
void(* EventHandler)(const EventParams &eventParams)
Definition Event.h:18
#define HEPH_API
Definition HephShared.h:132
class for managing callback functions.
Definition Event.h:25
void AddEventHandler(EventHandler handler)
UserEventArgs userEventArgs
class for passing custom data to the event handlers as key/value pairs.
Definition Event.h:31
void ClearEventHandlers()
void RemoveEventHandler(EventHandler handler)
EventHandler GetEventHandler(size_t index) const
void Invoke(EventArgs *pArgs, EventResult *pResult) const
bool EventHandlerExists(EventHandler handler) const
void operator()(EventArgs *pArgs, EventResult *pResult) const
size_t EventHandlerCount() const
void RemoveEventHandler(size_t index)
void SetEventHandler(EventHandler handler)
void ClearAll()
void InsertEventHandler(EventHandler handler, size_t index)
class for passing custom data to the event handlers as key/value pairs.
Definition UserEventArgs.h:17
base class for storing arguments for an event .
Definition EventArgs.h:13
stores the information required to handle an event.
Definition EventParams.h:16
base class for storing the results of an event .
Definition EventResult.h:13