2020-12-22 18:10:01 +01:00
|
|
|
#pragma once
|
|
|
|
|
2020-12-27 15:39:06 +01:00
|
|
|
#include <hex.hpp>
|
|
|
|
|
2021-01-13 17:28:27 +01:00
|
|
|
#include <hex/views/view.hpp>
|
|
|
|
#include <hex/providers/provider.hpp>
|
2020-12-22 18:10:01 +01:00
|
|
|
|
|
|
|
#include <string_view>
|
|
|
|
|
|
|
|
namespace hex {
|
|
|
|
|
|
|
|
class Plugin {
|
|
|
|
public:
|
|
|
|
Plugin(std::string_view path);
|
|
|
|
~Plugin();
|
|
|
|
|
2021-01-12 23:28:41 +01:00
|
|
|
void initializePlugin() const;
|
2020-12-22 18:10:01 +01:00
|
|
|
|
|
|
|
private:
|
2021-01-12 23:28:41 +01:00
|
|
|
using InitializePluginFunc = void(*)();
|
2020-12-22 18:10:01 +01:00
|
|
|
|
|
|
|
void *m_handle = nullptr;
|
|
|
|
|
2020-12-27 15:39:06 +01:00
|
|
|
InitializePluginFunc m_initializePluginFunction = nullptr;
|
2020-12-22 18:10:01 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
class PluginHandler {
|
|
|
|
public:
|
|
|
|
PluginHandler() = delete;
|
|
|
|
|
|
|
|
static void load(std::string_view pluginFolder);
|
|
|
|
static void unload();
|
|
|
|
static void reload();
|
|
|
|
|
|
|
|
static const auto& getPlugins() {
|
|
|
|
return PluginHandler::s_plugins;
|
|
|
|
}
|
|
|
|
|
|
|
|
private:
|
|
|
|
static inline std::string s_pluginFolder;
|
2021-02-07 13:40:47 +01:00
|
|
|
static inline std::vector<Plugin*> s_plugins;
|
2020-12-22 18:10:01 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
}
|