#pragma once #include #include #include #include #include #include namespace hex::plugin::builtin { class ProviderExtraData { public: struct Data { bool dataDirty = false; struct { std::string sourceCode; std::unique_ptr runtime; bool executionDone = true; } patternLanguage; std::list bookmarks; struct { std::list endNodes; std::list> nodes; std::list links; std::vector dataOverlays; std::optional currNodeError; } dataProcessor; struct { std::optional selectionStart, selectionEnd; float scrollPosition = 0.0F; } editor; }; 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 s_data = {}; }; }