966f3b8597
* sys: Initial effort to replace existing project files with a better system * sys: Added back marking provider as dirty * sys: Remove git commit information from project files * sys: Format data processor save file nicely * fix: Automatic pattern loading not working correctly * ui: Added warning popup when closing a provider with modifications Closes #604 * sys: Fixed build issues * tests: Removed useless debug logs * patterns: Updated pattern language * sys: Added log message when crashing with a signal * sys: Make sure abnormal termination handlers are being called more reliably
56 lines
1.4 KiB
C++
56 lines
1.4 KiB
C++
#pragma once
|
|
|
|
#include <map>
|
|
#include <hex/providers/provider.hpp>
|
|
|
|
#include <pl/pattern_language.hpp>
|
|
#include <hex/data_processor/attribute.hpp>
|
|
#include <hex/data_processor/node.hpp>
|
|
#include <hex/data_processor/link.hpp>
|
|
|
|
namespace hex::plugin::builtin {
|
|
|
|
class ProviderExtraData {
|
|
public:
|
|
struct Data {
|
|
bool dataDirty = false;
|
|
|
|
struct {
|
|
std::string sourceCode;
|
|
std::unique_ptr<pl::PatternLanguage> runtime;
|
|
} patternLanguage;
|
|
|
|
std::list<ImHexApi::Bookmarks::Entry> bookmarks;
|
|
|
|
struct {
|
|
std::list<dp::Node*> endNodes;
|
|
std::list<std::unique_ptr<dp::Node>> nodes;
|
|
std::list<dp::Link> links;
|
|
|
|
std::vector<hex::prv::Overlay *> dataOverlays;
|
|
std::optional<dp::Node::NodeError> currNodeError;
|
|
} dataProcessor;
|
|
};
|
|
|
|
static Data& getCurrent() {
|
|
return get(ImHexApi::Provider::get());
|
|
}
|
|
|
|
static Data& get(hex::prv::Provider *provider) {
|
|
return s_data[provider];
|
|
}
|
|
|
|
static void erase(hex::prv::Provider *provider) {
|
|
s_data.erase(provider);
|
|
}
|
|
|
|
static bool markDirty() {
|
|
return getCurrent().dataDirty = true;
|
|
}
|
|
|
|
private:
|
|
ProviderExtraData() = default;
|
|
static inline std::map<hex::prv::Provider*, Data> s_data = {};
|
|
};
|
|
|
|
} |