Event function definitions. More...
Go to the source code of this file.
Data Structures | |
| struct | qsc_event_handler |
| The event handler structure. More... | |
| struct | event_state |
| The event state context. More... | |
Macros | |
| #define | QSC_EVENT_NAME_SIZE 32UL |
| The character length of the event name. | |
| #define | QSC_EVENT_MAX_LISTENERS 16384 |
| The maximum number of event listeners. | |
Typedefs | |
| typedef void(* | qsc_event_callback) (size_t,...) |
| The event callback variadic prototype. | |
| typedef QSC_EXPORT_API struct qsc_event_handler | qsc_event_handler |
| typedef QSC_EXPORT_API struct event_state | event_state |
Functions | |
| QSC_EXPORT_API void | qsc_event_clear_listener (event_state *ctx, const char name[QSC_EVENT_NAME_SIZE]) |
| Clear a listener for a specified event. | |
| QSC_EXPORT_API qsc_event_callback | qsc_event_get_callback (event_state *ctx, const char name[QSC_EVENT_NAME_SIZE]) |
| Retrieve a callback function by event name. | |
| QSC_EXPORT_API void | qsc_event_dispose (event_state *ctx) |
| Destroy all event listeners. | |
| QSC_EXPORT_API bool | qsc_event_listener_name_exists (const event_state *ctx, const char name[QSC_EVENT_NAME_SIZE]) |
| Initialize the event state. | |
| QSC_EXPORT_API void | qsc_event_initialize (event_state *ctx) |
| Initialize the event state. | |
| QSC_EXPORT_API int32_t | qsc_event_register (event_state *ctx, const char name[QSC_EVENT_NAME_SIZE], qsc_event_callback callback) |
| Register an event and its callback. | |
Event function definitions.
This file defines the API for registering, retrieving, and clearing event callbacks. It supports grouping events by name and provides search hints for advanced documentation navigation. Functions in this module allow for dynamic management of event listeners, making it easier to integrate event-driven programming features into applications.
| typedef void(* qsc_event_callback) (size_t,...) |
The event callback variadic prototype.
This callback function takes a size_t indicating the number of arguments, followed by a variable list of arguments.
| QSC_EXPORT_API void qsc_event_clear_listener | ( | event_state * | ctx, |
| const char | name[QSC_EVENT_NAME_SIZE] ) |
Clear a listener for a specified event.
Clears the listener associated with the specified event name.
| ctx | The event handler context. |
| name | [const char[QSC_EVENT_NAME_SIZE]] The name of the event. |
| QSC_EXPORT_API void qsc_event_dispose | ( | event_state * | ctx | ) |
Destroy all event listeners.
Destroys the event handler state and frees all associated resources.
| QSC_EXPORT_API qsc_event_callback qsc_event_get_callback | ( | event_state * | ctx, |
| const char | name[QSC_EVENT_NAME_SIZE] ) |
Retrieve a callback function by event name.
Retrieves the callback function registered with the specified event name.
| ctx | The event handler context. |
| name | [const char[QSC_EVENT_NAME_SIZE]] The name of the event. |
| QSC_EXPORT_API void qsc_event_initialize | ( | event_state * | ctx | ) |
Initialize the event state.
Destroys the event handler state and frees all associated resources.
| ctx | The event handler context. |
| QSC_EXPORT_API bool qsc_event_listener_name_exists | ( | const event_state * | ctx, |
| const char | name[QSC_EVENT_NAME_SIZE] ) |
Initialize the event state.
Destroys the event handler state and frees all associated resources.
| ctx | [const] The event handler context. |
| name | The event handler string name. |
| QSC_EXPORT_API int32_t qsc_event_register | ( | event_state * | ctx, |
| const char | name[QSC_EVENT_NAME_SIZE], | ||
| qsc_event_callback | callback ) |
Register an event and its callback.
Registers an event with the specified name and callback function.
| ctx | The event handler context. |
| name | [const char[QSC_EVENT_NAME_SIZE]] The name of the event. |
| callback | [qsc_event_callback] The callback function. |