build: Restructured entire custom plugin system (#1469)

This commit is contained in:
Nik
2023-12-22 23:39:38 +01:00
committed by GitHub
parent 538e79183c
commit 84bfd10416
27 changed files with 258 additions and 153 deletions

View File

@@ -6,4 +6,4 @@ add_library(tests_common STATIC
source/main.cpp
)
target_include_directories(tests_common PUBLIC include)
target_link_libraries(tests_common PUBLIC libimhex ${FMT_LIBRARIES})
target_link_libraries(tests_common PUBLIC libimhex ${FMT_LIBRARIES} libwolv)

View File

@@ -1,14 +1,14 @@
#include <hex/providers/provider.hpp>
#pragma once
#include <hex/helpers/logger.hpp>
#include <stdexcept>
#include <hex/providers/provider.hpp>
#include <nlohmann/json.hpp>
namespace hex::test {
using namespace hex::prv;
class TestProvider : public prv::Provider {
public:
explicit TestProvider(std::vector<u8> *data) : Provider() {
explicit TestProvider(std::vector<u8> *data) {
this->setData(data);
}
~TestProvider() override = default;
@@ -47,11 +47,14 @@ namespace hex::test {
return m_data->size();
}
[[nodiscard]] virtual std::string getTypeName() const override { return "hex.test.provider.test"; }
[[nodiscard]] std::string getTypeName() const override { return "hex.test.provider.test"; }
bool open() override { return true; }
void close() override { }
nlohmann::json storeSettings(nlohmann::json) const override { return {}; }
void loadSettings(const nlohmann::json &) override {};
private:
std::vector<u8> *m_data = nullptr;
};