2022-08-10 09:26:48 +02:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include <hex/providers/provider.hpp>
|
2023-12-07 11:20:37 +01:00
|
|
|
#include <hex/api/event_manager.hpp>
|
2022-08-10 09:26:48 +02:00
|
|
|
|
2022-11-07 00:04:47 +01:00
|
|
|
namespace hex::plugin::builtin {
|
2022-08-10 09:26:48 +02:00
|
|
|
|
|
|
|
class NullProvider : public hex::prv::Provider {
|
|
|
|
public:
|
2023-12-07 11:20:37 +01:00
|
|
|
NullProvider() {
|
|
|
|
EventManager::subscribe<EventProviderOpened>([this](auto *newProvider) {
|
|
|
|
if (newProvider == this)
|
|
|
|
return;
|
2023-12-07 11:53:16 +01:00
|
|
|
|
2023-12-07 11:20:37 +01:00
|
|
|
ImHexApi::Provider::remove(this, true);
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
~NullProvider() override {
|
|
|
|
EventManager::unsubscribe<EventProviderOpened>(this);
|
|
|
|
}
|
2022-08-10 09:26:48 +02:00
|
|
|
|
|
|
|
[[nodiscard]] bool isAvailable() const override { return true; }
|
|
|
|
[[nodiscard]] bool isReadable() const override { return true; }
|
|
|
|
[[nodiscard]] bool isWritable() const override { return false; }
|
|
|
|
[[nodiscard]] bool isResizable() const override { return false; }
|
|
|
|
[[nodiscard]] bool isSavable() const override { return false; }
|
|
|
|
|
2022-09-04 11:16:20 +02:00
|
|
|
[[nodiscard]] bool open() override { return true; }
|
|
|
|
void close() override { }
|
|
|
|
|
2022-08-10 09:26:48 +02:00
|
|
|
void readRaw(u64 offset, void *buffer, size_t size) override { hex::unused(offset, buffer, size); }
|
|
|
|
void writeRaw(u64 offset, const void *buffer, size_t size) override { hex::unused(offset, buffer, size); }
|
|
|
|
[[nodiscard]] size_t getActualSize() const override { return 0x00; }
|
|
|
|
|
|
|
|
[[nodiscard]] std::string getName() const override { return "None"; }
|
2023-06-04 10:42:11 +02:00
|
|
|
[[nodiscard]] std::vector<Description> getDataDescription() const override { return { }; }
|
2022-08-10 09:26:48 +02:00
|
|
|
|
|
|
|
void loadSettings(const nlohmann::json &settings) override { hex::unused(settings); }
|
|
|
|
[[nodiscard]] nlohmann::json storeSettings(nlohmann::json settings) const override { return settings; }
|
|
|
|
|
|
|
|
[[nodiscard]] std::string getTypeName() const override {
|
|
|
|
return "hex.builtin.provider.null";
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
}
|