mirror of
https://github.com/WerWolv/ImHex.git
synced 2026-04-03 05:57:40 -05:00
build: Refactor ImHexAPI into multiple separate files
This commit is contained in:
33
lib/libimhex/include/hex/api/imhex_api/messaging.hpp
Normal file
33
lib/libimhex/include/hex/api/imhex_api/messaging.hpp
Normal file
@@ -0,0 +1,33 @@
|
||||
#pragma once
|
||||
|
||||
#include <hex.hpp>
|
||||
|
||||
#include <functional>
|
||||
#include <string>
|
||||
#include <map>
|
||||
#include <vector>
|
||||
|
||||
EXPORT_MODULE namespace hex {
|
||||
|
||||
/**
|
||||
* Cross-instance messaging system
|
||||
* This allows you to send messages to the "main" instance of ImHex running, from any other instance
|
||||
*/
|
||||
namespace ImHexApi::Messaging {
|
||||
|
||||
namespace impl {
|
||||
|
||||
using MessagingHandler = std::function<void(const std::vector<u8> &)>;
|
||||
|
||||
const std::map<std::string, MessagingHandler>& getHandlers();
|
||||
void runHandler(const std::string &eventName, const std::vector<u8> &args);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Register the handler for this specific event name
|
||||
*/
|
||||
void registerHandler(const std::string &eventName, const impl::MessagingHandler &handler);
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user