2021-01-03 23:19:56 +00:00
|
|
|
#pragma once
|
|
|
|
|
2021-01-11 19:31:40 +00:00
|
|
|
#include <any>
|
2021-01-03 23:19:56 +00:00
|
|
|
#include <functional>
|
2021-01-20 19:16:24 +00:00
|
|
|
#include <list>
|
2021-01-11 20:11:03 +00:00
|
|
|
#include <map>
|
2021-02-02 23:56:33 +00:00
|
|
|
#include <memory>
|
2021-01-20 19:16:24 +00:00
|
|
|
#include <vector>
|
2021-01-03 23:19:56 +00:00
|
|
|
|
2021-01-13 16:28:27 +00:00
|
|
|
#include <hex/api/content_registry.hpp>
|
2021-01-20 19:16:24 +00:00
|
|
|
#include <hex/api/imhex_api.hpp>
|
2021-02-02 23:56:33 +00:00
|
|
|
#include <hex/views/view.hpp>
|
2021-01-11 19:31:40 +00:00
|
|
|
|
2021-01-03 23:19:56 +00:00
|
|
|
#include <imgui.h>
|
2021-01-26 23:44:10 +00:00
|
|
|
|
2021-01-11 19:31:40 +00:00
|
|
|
#include <nlohmann/json.hpp>
|
2021-01-03 23:19:56 +00:00
|
|
|
|
|
|
|
namespace hex { class SharedData; }
|
|
|
|
|
|
|
|
namespace hex::plugin::internal {
|
|
|
|
void initializePlugin(SharedData &sharedData);
|
|
|
|
}
|
|
|
|
|
|
|
|
namespace hex {
|
|
|
|
|
|
|
|
namespace prv { class Provider; }
|
2021-01-30 21:39:06 +00:00
|
|
|
namespace dp { class Node; }
|
2021-04-20 19:46:48 +00:00
|
|
|
namespace lang { class PatternData; }
|
|
|
|
|
2021-01-27 13:26:24 +00:00
|
|
|
class View;
|
2021-01-03 23:19:56 +00:00
|
|
|
|
|
|
|
class SharedData {
|
|
|
|
SharedData() = default;
|
|
|
|
public:
|
|
|
|
SharedData(const SharedData&) = delete;
|
|
|
|
SharedData(SharedData&&) = delete;
|
|
|
|
|
|
|
|
friend class Window;
|
|
|
|
|
2021-01-11 19:31:40 +00:00
|
|
|
template<typename T>
|
2021-01-12 22:28:41 +00:00
|
|
|
static T& getVariable(std::string variableName) {
|
|
|
|
return std::any_cast<T&>(SharedData::sharedVariables[variableName]);
|
2021-01-11 19:31:40 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
template<typename T>
|
2021-01-12 22:28:41 +00:00
|
|
|
static void setVariable(std::string variableName, T value) {
|
|
|
|
SharedData::sharedVariables[variableName] = value;
|
2021-01-03 23:19:56 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
public:
|
2021-01-12 22:28:41 +00:00
|
|
|
static std::vector<std::function<void()>> deferredCalls;
|
|
|
|
static prv::Provider *currentProvider;
|
|
|
|
static std::map<std::string, std::vector<ContentRegistry::Settings::Entry>> settingsEntries;
|
|
|
|
static nlohmann::json settingsJson;
|
|
|
|
static std::vector<ContentRegistry::CommandPaletteCommands::Entry> commandPaletteCommands;
|
|
|
|
static std::map<std::string, ContentRegistry::PatternLanguageFunctions::Function> patternLanguageFunctions;
|
2021-03-16 21:44:37 +00:00
|
|
|
static std::vector<View*> views;
|
2021-01-13 12:18:03 +00:00
|
|
|
static std::vector<ContentRegistry::Tools::Entry> toolsEntries;
|
2021-01-13 00:24:27 +00:00
|
|
|
static std::vector<ContentRegistry::DataInspector::Entry> dataInspectorEntries;
|
2021-01-13 22:08:41 +00:00
|
|
|
static u32 patternPaletteOffset;
|
|
|
|
static std::string errorPopupMessage;
|
2021-01-20 19:16:24 +00:00
|
|
|
static std::list<ImHexApi::Bookmarks::Entry> bookmarkEntries;
|
2021-04-20 19:46:48 +00:00
|
|
|
static std::vector<lang::PatternData*> patternData;
|
2021-02-10 23:35:30 +00:00
|
|
|
|
|
|
|
static std::map<std::string, std::string> languageNames;
|
|
|
|
static std::map<std::string, std::vector<LanguageDefinition>> languageDefinitions;
|
|
|
|
static std::map<std::string, std::string> loadedLanguageStrings;
|
2021-01-12 22:28:41 +00:00
|
|
|
|
2021-02-18 11:09:19 +00:00
|
|
|
static std::vector<ContentRegistry::Interface::DrawCallback> welcomeScreenEntries;
|
|
|
|
static std::vector<ContentRegistry::Interface::DrawCallback> footerItems;
|
|
|
|
|
2021-01-30 21:39:06 +00:00
|
|
|
static std::vector<ContentRegistry::DataProcessorNode::Entry> dataProcessorNodes;
|
|
|
|
static u32 dataProcessorNodeIdCounter;
|
|
|
|
|
2021-04-13 06:41:59 +00:00
|
|
|
static std::list<std::string> recentFilePaths;
|
|
|
|
|
2021-01-12 22:28:41 +00:00
|
|
|
static int mainArgc;
|
|
|
|
static char **mainArgv;
|
|
|
|
|
|
|
|
static ImVec2 windowPos;
|
|
|
|
static ImVec2 windowSize;
|
2021-01-11 19:31:40 +00:00
|
|
|
|
|
|
|
private:
|
2021-01-12 22:28:41 +00:00
|
|
|
static std::map<std::string, std::any> sharedVariables;
|
2021-01-03 23:19:56 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
}
|