2021-01-20 20:16:24 +01:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include <hex.hpp>
|
|
|
|
|
|
|
|
#include <list>
|
2021-08-29 22:15:18 +02:00
|
|
|
#include <vector>
|
2021-09-08 15:18:24 +02:00
|
|
|
#include <string>
|
2021-01-20 20:16:24 +01:00
|
|
|
|
2021-09-21 02:29:54 +02:00
|
|
|
#include <hex/helpers/concepts.hpp>
|
|
|
|
|
2021-01-20 20:16:24 +01:00
|
|
|
namespace hex {
|
|
|
|
|
2021-09-21 02:29:54 +02:00
|
|
|
namespace prv { class Provider; }
|
|
|
|
|
2021-01-20 20:16:24 +01:00
|
|
|
struct ImHexApi {
|
|
|
|
ImHexApi() = delete;
|
|
|
|
|
2021-08-21 13:55:21 +02:00
|
|
|
struct Common {
|
|
|
|
|
|
|
|
static void closeImHex(bool noQuestions = false);
|
|
|
|
static void restartImHex();
|
|
|
|
|
|
|
|
};
|
|
|
|
|
2021-01-20 20:16:24 +01:00
|
|
|
struct Bookmarks {
|
|
|
|
Bookmarks() = delete;
|
|
|
|
|
|
|
|
struct Entry {
|
|
|
|
Region region;
|
|
|
|
|
|
|
|
std::vector<char> name;
|
|
|
|
std::vector<char> comment;
|
|
|
|
u32 color;
|
2021-02-24 21:42:18 +01:00
|
|
|
bool locked;
|
2021-01-20 20:16:24 +01:00
|
|
|
};
|
|
|
|
|
2021-09-08 15:18:24 +02:00
|
|
|
static void add(Region region, const std::string &name, const std::string &comment, u32 color = 0x00000000);
|
|
|
|
static void add(u64 addr, size_t size, const std::string &name, const std::string &comment, u32 color = 0x00000000);
|
2021-01-20 20:16:24 +01:00
|
|
|
|
|
|
|
static std::list<Entry>& getEntries();
|
|
|
|
};
|
2021-08-21 13:55:21 +02:00
|
|
|
|
2021-09-21 02:29:54 +02:00
|
|
|
struct Provider {
|
|
|
|
|
|
|
|
static prv::Provider* get();
|
|
|
|
static const std::vector<prv::Provider*>& getProviders();
|
|
|
|
|
|
|
|
static bool isValid();
|
|
|
|
|
|
|
|
template<hex::derived_from<prv::Provider> T>
|
|
|
|
static void add(auto&& ... args) {
|
|
|
|
add(new T(std::forward<decltype(args)>(args)...));
|
|
|
|
}
|
|
|
|
|
|
|
|
static void remove(prv::Provider *provider);
|
|
|
|
|
|
|
|
private:
|
|
|
|
static void add(prv::Provider *provider);
|
|
|
|
};
|
|
|
|
|
2021-01-20 20:16:24 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
}
|