impr: Optimize api includes

This commit is contained in:
WerWolv 2023-11-30 11:23:12 +01:00
parent e370fdb0fc
commit 8ee234e5a6
29 changed files with 29 additions and 88 deletions

View file

@ -1,13 +1,12 @@
#pragma once
#include <string>
#include <unordered_map>
#include <utility>
#include <list>
#include <memory>
#include <vector>
#include <span>
#include <string>
#include <utility>
#include <vector>
#include <hex/api/event_manager.hpp>
#include <imgui.h>
#include <hex/ui/imgui_imhex_extensions.h>

View file

@ -4,7 +4,6 @@
#include <memory>
#include <string>
#include <vector>
#include <imgui.h>
#include <hex/ui/imgui_imhex_extensions.h>

View file

@ -1,4 +1,5 @@
#include <hex/api/achievement_manager.hpp>
#include <hex/api/event_manager.hpp>
#include <nlohmann/json.hpp>

View file

@ -1,5 +1,4 @@
#include <hex/api/imhex_api.hpp>
#include <hex/api/content_registry.hpp>
#include <hex/api/event_manager.hpp>
#include <hex/api/task_manager.hpp>
@ -15,12 +14,9 @@
#include <imgui.h>
#include <imgui_internal.h>
#include <nlohmann/json.hpp>
#if defined(OS_WINDOWS)
#define WIN32_LEAN_AND_MEAN
#include <windows.h>
#include <shellapi.h>
#else
#include <sys/utsname.h>
#endif

View file

@ -1,5 +1,4 @@
#include <hex/api/theme_manager.hpp>
#include <hex/api/imhex_api.hpp>
#include <hex/api/event_manager.hpp>
#include <hex/helpers/logger.hpp>

View file

@ -1,26 +1,22 @@
#include <hex/helpers/utils.hpp>
#include <cstdio>
#include <hex/api/imhex_api.hpp>
#include <hex/api/event_manager.hpp>
#include <hex/helpers/fmt.hpp>
#include <hex/helpers/crypto.hpp>
#include <hex/helpers/utils_linux.hpp>
#include <hex/providers/buffered_reader.hpp>
#include <imgui.h>
#include <imgui_internal.h>
#if defined(OS_WINDOWS)
#include <windows.h>
#elif defined(OS_LINUX)
#include <unistd.h>
#include <hex/helpers/utils_linux.hpp>
#elif defined(OS_MACOS)
#include <hex/helpers/utils_macos.hpp>
#include <unistd.h>
#include <hex/helpers/utils_macos.hpp>
#elif defined(OS_WEB)
#include "emscripten.h"
#endif

View file

@ -2,11 +2,9 @@
#include "init/splash_window.hpp"
#include <hex/api/imhex_api.hpp>
#include <hex/api/task_manager.hpp>
#include <hex/api/event_manager.hpp>
#include <hex/helpers/utils.hpp>
#include <hex/helpers/utils_macos.hpp>
#include <hex/helpers/fmt.hpp>
#include <hex/helpers/logger.hpp>
@ -23,9 +21,6 @@
#include <wolv/utils/guards.hpp>
#include <unistd.h>
#include <chrono>
#include <future>
#include <numeric>
#include <random>
@ -97,7 +92,7 @@ namespace hex::init {
// When the task finished, increment the progress bar
ON_SCOPE_EXIT {
this->m_completedTaskCount += 1;
this->m_progress = float(this->m_completedTaskCount) / this->m_totalTaskCount;
this->m_progress = float(this->m_completedTaskCount) / float(this->m_totalTaskCount);
};
// Execute the actual task and track the amount of time it took to run

View file

@ -1,7 +1,6 @@
#include "init/tasks.hpp"
#include <imgui.h>
#include <imgui_freetype.h>
#include <romfs/romfs.hpp>
@ -9,7 +8,6 @@
#include <hex/helpers/fs.hpp>
#include <hex/helpers/logger.hpp>
#include <hex/api_urls.hpp>
#include <hex/api/content_registry.hpp>
#include <hex/api/project_file_manager.hpp>
#include <hex/api/theme_manager.hpp>
@ -20,15 +18,10 @@
#include <hex/ui/view.hpp>
#include <hex/ui/popup.hpp>
#include <fonts/fontawesome_font.h>
#include <fonts/codicons_font.h>
#include <fonts/unifont_font.h>
#include <nlohmann/json.hpp>
#include <wolv/io/fs.hpp>
#include <wolv/io/file.hpp>
#include <wolv/hash/uuid.hpp>
namespace hex::init {
@ -247,6 +240,7 @@ namespace hex::init {
}
bool clearOldLogs() {
bool result = true;
for (const auto &path : fs::getDefaultPaths(fs::ImHexPath::Logs)) {
try {
std::vector<std::filesystem::directory_entry> files;
@ -265,10 +259,11 @@ namespace hex::init {
std::filesystem::remove(it->path());
} catch (std::filesystem::filesystem_error &e) {
log::error("Failed to clear old log! {}", e.what());
result = false;
}
}
return true;
return result;
}
bool unloadPlugins() {

View file

@ -2,7 +2,6 @@
#include "messaging.hpp"
#include <hex/api/imhex_api.hpp>
#include <hex/helpers/logger.hpp>
#include <windows.h>

View file

@ -2,8 +2,6 @@
#include "messaging.hpp"
#include <hex/api/content_registry.hpp>
#if defined(OS_WINDOWS)
#include <hex/helpers/utils.hpp>
@ -12,7 +10,6 @@
#include <imgui.h>
#include <imgui_internal.h>
#include <GLFW/glfw3.h>
#define GLFW_EXPOSE_NATIVE_WIN32
#include <GLFW/glfw3native.h>
#undef GLFW_EXPOSE_NATIVE_WIN32
@ -25,7 +22,6 @@
#include <wrl/client.h>
#include <fcntl.h>
#include <csignal>
#include <cstdio>
namespace hex {

View file

@ -1,7 +1,6 @@
#pragma once
#include <hex/providers/provider.hpp>
#include <hex/api/localization_manager.hpp>
namespace hex::plugin::builtin {

View file

@ -2,9 +2,6 @@
namespace hex::plugin::builtin {
namespace impl {
using namespace std::literals::string_literals;
using namespace std::literals::chrono_literals;
using namespace hex::literals;
void drawDemangler();
void drawASCIITable();
@ -26,5 +23,6 @@ namespace hex::plugin::builtin {
void drawFileToolShredder();
void drawFileToolSplitter();
void drawFileToolCombiner();
}
}

View file

@ -1,9 +1,6 @@
#pragma once
#include <hex/api/content_registry.hpp>
#include <hex/ui/view.hpp>
#include <hex/helpers/concepts.hpp>
#include <ui/hex_editor.hpp>

View file

@ -3,14 +3,11 @@
#include <hex/api/task_manager.hpp>
#include <hex/api/content_registry.hpp>
#include <pl/core/lexer.hpp>
#include <pl/patterns/pattern.hpp>
#include <pl/pattern_visitor.hpp>
#include <pl/formatters.hpp>
#include <hex/providers/provider.hpp>
#include <set>
struct ImGuiTableSortSpecs;

View file

@ -1,5 +1,6 @@
#include <hex/api/achievement_manager.hpp>
#include <hex/api/project_file_manager.hpp>
#include <hex/api/event_manager.hpp>
#include <hex/helpers/crypto.hpp>

View file

@ -1,16 +1,15 @@
#include <hex/api/imhex_api.hpp>
#include <hex/api/content_registry.hpp>
#include <hex/helpers/utils.hpp>
#include <hex/helpers/fmt.hpp>
#include <hex/helpers/crypto.hpp>
#include <hex/api/event_manager.hpp>
#include <hex/providers/provider.hpp>
#include <cstring>
#include <codecvt>
#include <string>
#include <vector>
#include <imgui_internal.h>
#include <hex/ui/imgui_imhex_extensions.h>

View file

@ -1,5 +1,4 @@
#include <hex/api/content_registry.hpp>
#include <hex/api/localization_manager.hpp>
#include <hex/data_processor/node.hpp>
#include <ranges>

View file

@ -1,6 +1,8 @@
#include <hex/api/content_registry.hpp>
#include <hex/api/imhex_api.hpp>
#include <hex/api/content_registry.hpp>
#include <hex/api/achievement_manager.hpp>
#include <hex/api/event_manager.hpp>
#include <hex/providers/provider.hpp>
#include <hex/data_processor/node.hpp>
#include <hex/helpers/utils.hpp>

View file

@ -1,5 +1,4 @@
#include <hex/api/content_registry.hpp>
#include <hex/api/localization_manager.hpp>
#include <hex/helpers/utils.hpp>
#include <hex/data_processor/node.hpp>
#include <hex/ui/imgui_imhex_extensions.h>

View file

@ -1,14 +1,18 @@
#include <filesystem>
#include <wolv/utils/guards.hpp>
#include <wolv/utils/string.hpp>
#include <hex/api/imhex_api.hpp>
#include <hex/api/project_file_manager.hpp>
#include <hex/api/localization_manager.hpp>
#include <hex/api/achievement_manager.hpp>
#include <hex/api/event_manager.hpp>
#include <hex/providers/provider.hpp>
#include <hex/helpers/fmt.hpp>
#include <hex/helpers/logger.hpp>
#include <content/helpers/notification.hpp>

View file

@ -3,9 +3,9 @@
#include <cstring>
#include <hex/api/imhex_api.hpp>
#include <hex/api/localization_manager.hpp>
#include <hex/api/project_file_manager.hpp>
#include <hex/api/achievement_manager.hpp>
#include <hex/api/task_manager.hpp>

View file

@ -2,7 +2,6 @@
#include <cstring>
#include <hex/api/imhex_api.hpp>
#include <hex/api/localization_manager.hpp>
#include <hex/helpers/utils.hpp>
#include <hex/helpers/fmt.hpp>

View file

@ -1,5 +1,4 @@
#include <hex/api/content_registry.hpp>
#include <hex/api/imhex_api.hpp>
#include <hex/helpers/fmt.hpp>
#include <hex/helpers/utils.hpp>

View file

@ -1,18 +1,8 @@
#include <hex/api/content_registry.hpp>
#include <hex/helpers/http_requests.hpp>
#include <hex/helpers/utils.hpp>
#include <hex/helpers/fmt.hpp>
#include <hex/api/localization_manager.hpp>
#include <algorithm>
#include <chrono>
#include <random>
#include <regex>
#include <llvm/Demangle/Demangle.h>
#include <content/helpers/math_evaluator.hpp>
#include <content/tools_entries.hpp>
@ -22,10 +12,6 @@
#include <nlohmann/json.hpp>
#include <romfs/romfs.hpp>
#include <wolv/io/file.hpp>
#include <wolv/net/socket_server.hpp>
namespace hex::plugin::builtin {
namespace impl {
void drawColorPicker() {

View file

@ -1,18 +1,12 @@
#include <hex/api/content_registry.hpp>
#include <hex/api/localization_manager.hpp>
#include <hex/helpers/http_requests.hpp>
#include <hex/ui/view.hpp>
#include <content/tools_entries.hpp>
#include <regex>
#include <imgui.h>
#include <hex/ui/imgui_imhex_extensions.h>
#include <fonts/codicons_font.h>
#include <nlohmann/json.hpp>
#include <numeric>
namespace hex::plugin::builtin {
namespace impl {

View file

@ -1,28 +1,18 @@
#include <hex/api/content_registry.hpp>
#include <hex/api/imhex_api.hpp>
#include <hex/helpers/http_requests.hpp>
#include <hex/helpers/utils.hpp>
#include <hex/helpers/fmt.hpp>
#include <hex/helpers/literals.hpp>
#include <hex/helpers/fs.hpp>
#include <hex/api/localization_manager.hpp>
#include <algorithm>
#include <random>
#include <regex>
#include <llvm/Demangle/Demangle.h>
#include <imgui.h>
#include <hex/ui/imgui_imhex_extensions.h>
#include <content/popups/popup_notification.hpp>
#include <nlohmann/json.hpp>
#include <wolv/io/file.hpp>
#include <wolv/utils/guards.hpp>
#include <wolv/net/socket_server.hpp>
namespace hex::plugin::builtin {
namespace impl {

View file

@ -14,6 +14,8 @@
namespace hex::plugin::builtin {
namespace impl {
using namespace std::literals::string_literals;
using namespace std::literals::chrono_literals;
std::string getWikipediaApiUrl() {
std::string setting = ContentRegistry::Settings::read("hex.builtin.setting.interface", "hex.builtin.setting.interface.wiki_explain_language", "en").get<std::string>();

View file

@ -5,11 +5,9 @@
#include <hex/providers/provider.hpp>
#include <hex/api/achievement_manager.hpp>
#include <hex/api/project_file_manager.hpp>
#include <hex/helpers/logger.hpp>
#include <pl/pattern_language.hpp>
#include <pl/core/evaluator.hpp>
#include <pl/patterns/pattern.hpp>
#include <wolv/io/file.hpp>

View file

@ -1,5 +1,7 @@
#include <ui/pattern_drawer.hpp>
#include <pl/core/lexer.hpp>
#include <pl/patterns/pattern_array_dynamic.hpp>
#include <pl/patterns/pattern_array_static.hpp>
#include <pl/patterns/pattern_bitfield.hpp>
@ -30,6 +32,7 @@
#include <hex/ui/imgui_imhex_extensions.h>
#include <fonts/codicons_font.h>
#include <wolv/io/file.hpp>
namespace hex::plugin::builtin::ui {