1
0
mirror of synced 2024-12-21 03:55:56 +01:00
ImHex/plugins/builtin/include/content/providers/view_provider.hpp
2024-06-09 10:51:59 +02:00

58 lines
1.9 KiB
C++

#pragma once
#include <hex/providers/provider.hpp>
namespace hex::plugin::builtin {
class ViewProvider : public hex::prv::Provider {
public:
ViewProvider() = default;
~ViewProvider() override = default;
[[nodiscard]] bool isAvailable() const override;
[[nodiscard]] bool isReadable() const override;
[[nodiscard]] bool isWritable() const override;
[[nodiscard]] bool isResizable() const override;
[[nodiscard]] bool isSavable() const override;
[[nodiscard]] bool isSavableAsRecent() const override;
void save() override;
[[nodiscard]] bool open() override;
void close() override;
void resizeRaw(u64 newSize) override;
void insertRaw(u64 offset, u64 size) override;
void removeRaw(u64 offset, u64 size) override;
void readRaw(u64 offset, void *buffer, size_t size) override;
void writeRaw(u64 offset, const void *buffer, size_t size) override;
[[nodiscard]] u64 getActualSize() const override;
[[nodiscard]] std::string getName() const override;
[[nodiscard]] std::vector<Description> getDataDescription() const override;
[[nodiscard]] std::string getTypeName() const override;
void loadSettings(const nlohmann::json &settings) override;
[[nodiscard]] nlohmann::json storeSettings(nlohmann::json settings) const override;
void setProvider(u64 startAddress, size_t size, hex::prv::Provider *provider);
void setName(const std::string &name);
[[nodiscard]] std::pair<Region, bool> getRegionValidity(u64 address) const override;
std::vector<MenuEntry> getMenuEntries() override;
private:
void renameFile();
private:
std::string m_name;
u64 m_startAddress = 0x00;
size_t m_size = 0x00;
prv::Provider *m_provider = nullptr;
};
}