Krotos Modules 3
Loading...
Searching...
No Matches
krotos::PresetEventMiddleware Class Reference

Middleware class for managing preset events and hooks. More...

#include <PresetEventMiddleware.h>

Public Member Functions

void addHook (std::unique_ptr< PresetEventHook > hook)
 Adds a new hook to the middleware.
 
bool removeHook (PresetEventHook *hook)
 Removes a hook from the middleware.
 
PresetLoadResponse processPresetLoad (PresetLoadRequest &request)
 Processes a preset load request through all registered hooks.
 
KwidgetLoadResponse processKwidgetLoad (KwidgetLoadRequest &request)
 Processes a Kwidget load request through all registered hooks.
 

Private Attributes

std::vector< std::unique_ptr< PresetEventHook > > m_hooks
 

Detailed Description

Middleware class for managing preset events and hooks.

The middleware can be used to add hooks that intercept and modify preset and Kwidget loading events. The middleware will process the hooks in the order they were added, and stop processing if a hook returns an unsuccessful response.

You can create your own hooks by deriving from the PresetEventHook class and implementing the onPresetLoad and onKwidgetLoad methods. Then add your hook to the middleware using the addHook method and call processPresetLoad or processKwidgetLoad at the point where the event takes place, using the response and request objects to pass the specific event data between the middleware and the caller.

Member Function Documentation

◆ addHook()

void krotos::PresetEventMiddleware::addHook ( std::unique_ptr< PresetEventHook > hook)

Adds a new hook to the middleware.

Parameters
hookUnique pointer to the hook to be added.

◆ processKwidgetLoad()

KwidgetLoadResponse krotos::PresetEventMiddleware::processKwidgetLoad ( KwidgetLoadRequest & request)

Processes a Kwidget load request through all registered hooks.

Parameters
requestThe Kwidget load request to be processed.
Returns
The response containing the result of the Kwidget load operation.

◆ processPresetLoad()

PresetLoadResponse krotos::PresetEventMiddleware::processPresetLoad ( PresetLoadRequest & request)

Processes a preset load request through all registered hooks.

Parameters
requestThe preset load request to be processed.
Returns
The response containing the result of the preset load operation.

◆ removeHook()

bool krotos::PresetEventMiddleware::removeHook ( PresetEventHook * hook)

Removes a hook from the middleware.

Parameters
hookPointer to the hook to be removed.
Returns
True if the hook was successfully removed, false otherwise.

Member Data Documentation

◆ m_hooks

std::vector<std::unique_ptr<PresetEventHook> > krotos::PresetEventMiddleware::m_hooks
private

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