impr: Optimize includes in often used header files

This commit is contained in:
WerWolv
2023-11-18 14:34:33 +01:00
parent 98e0a62e6e
commit 1249eb3261
29 changed files with 123 additions and 81 deletions

View File

@@ -4,8 +4,6 @@
#include <hex/helpers/concepts.hpp>
#include <pl/pattern_language.hpp>
#include <hex/api/imhex_api.hpp>
#include <hex/api/event.hpp>
#include <functional>
#include <map>
@@ -27,6 +25,7 @@ namespace hex {
class View;
class LanguageDefinition;
class Shortcut;
namespace dp {
class Node;
@@ -625,7 +624,8 @@ namespace hex {
struct MenuItem {
std::vector<std::string> unlocalizedNames;
Shortcut shortcut;
std::unique_ptr<Shortcut> shortcut;
View *view;
MenuCallback callback;
EnabledCallback enabledCallback;
};
@@ -734,6 +734,9 @@ namespace hex {
void addProviderName(const std::string &unlocalizedName);
using ProviderCreationFunction = prv::Provider*(*)();
void add(const std::string &typeName, ProviderCreationFunction creationFunction);
std::vector<std::string> &getEntries();
}
@@ -747,15 +750,8 @@ namespace hex {
void add(bool addToList = true) {
auto typeName = T().getTypeName();
(void)EventManager::subscribe<RequestCreateProvider>([expectedName = typeName](const std::string &name, bool skipLoadInterface, bool selectProvider, prv::Provider **provider) {
if (name != expectedName) return;
prv::Provider *newProvider = new T();
ImHexApi::Provider::add(newProvider, skipLoadInterface, selectProvider);
if (provider != nullptr)
*provider = newProvider;
impl::add(typeName, [] -> prv::Provider* {
return new T();
});
if (addToList)

View File

@@ -7,8 +7,6 @@
#include <vector>
#include <map>
#include <hex/api/keybinding.hpp>
#include <wolv/io/fs.hpp>
using ImGuiID = unsigned int;

View File

@@ -443,12 +443,12 @@ namespace hex {
static void resumeShortcuts();
static void pauseShortcuts();
static std::optional<Shortcut> getPreviousShortcut();
[[nodiscard]] static std::optional<Shortcut> getPreviousShortcut();
static std::vector<ShortcutEntry> getGlobalShortcuts();
static std::vector<ShortcutEntry> getViewShortcuts(View *view);
[[nodiscard]] static std::vector<ShortcutEntry> getGlobalShortcuts();
[[nodiscard]] static std::vector<ShortcutEntry> getViewShortcuts(View *view);
static void updateShortcut(const Shortcut &oldShortcut, const Shortcut &newShortcut, View *view = nullptr);
[[nodiscard]] static bool updateShortcut(const Shortcut &oldShortcut, const Shortcut &newShortcut, View *view = nullptr);
};
}

View File

@@ -1,10 +1,5 @@
#pragma once
#include <hex/api/imhex_api.hpp>
#include <hex/api/event.hpp>
#include <hex/helpers/fs.hpp>
#include <hex/helpers/utils.hpp>
#include <hex/helpers/tar.hpp>
/**
@@ -16,6 +11,10 @@
*/
namespace hex {
namespace prv {
class Provider;
}
class ProjectFile {
public:
struct Handler {