mirror of
https://github.com/WerWolv/ImHex.git
synced 2026-04-02 05:27:41 -05:00
impr: Code style improvements
This commit is contained in:
@@ -42,7 +42,7 @@ namespace hex {
|
||||
class Plugin {
|
||||
public:
|
||||
explicit Plugin(const std::fs::path &path);
|
||||
explicit Plugin(PluginFunctions functions);
|
||||
explicit Plugin(const PluginFunctions &functions);
|
||||
|
||||
Plugin(const Plugin &) = delete;
|
||||
Plugin(Plugin &&other) noexcept;
|
||||
|
||||
@@ -448,7 +448,7 @@ namespace hex {
|
||||
[[nodiscard]] static std::optional<Shortcut> getPreviousShortcut();
|
||||
|
||||
[[nodiscard]] static std::vector<ShortcutEntry> getGlobalShortcuts();
|
||||
[[nodiscard]] static std::vector<ShortcutEntry> getViewShortcuts(View *view);
|
||||
[[nodiscard]] static std::vector<ShortcutEntry> getViewShortcuts(const View *view);
|
||||
|
||||
[[nodiscard]] static bool updateShortcut(const Shortcut &oldShortcut, const Shortcut &newShortcut, View *view = nullptr);
|
||||
};
|
||||
|
||||
@@ -606,9 +606,9 @@ namespace hex {
|
||||
|
||||
std::string getImHexVersion(bool withBuildType) {
|
||||
#if defined IMHEX_VERSION
|
||||
if (withBuildType)
|
||||
if (withBuildType) {
|
||||
return IMHEX_VERSION;
|
||||
else {
|
||||
} else {
|
||||
auto version = std::string(IMHEX_VERSION);
|
||||
return version.substr(0, version.find('-'));
|
||||
}
|
||||
|
||||
@@ -46,7 +46,7 @@ namespace hex {
|
||||
m_functions.getSubCommandsFunction = getPluginFunction<PluginFunctions::GetSubCommandsFunc>("getSubCommands");
|
||||
}
|
||||
|
||||
Plugin::Plugin(hex::PluginFunctions functions) {
|
||||
Plugin::Plugin(const hex::PluginFunctions &functions) {
|
||||
m_handle = 0;
|
||||
m_functions = functions;
|
||||
}
|
||||
@@ -125,9 +125,9 @@ namespace hex {
|
||||
}
|
||||
|
||||
std::string Plugin::getPluginName() const {
|
||||
if (m_functions.getPluginNameFunction != nullptr)
|
||||
if (m_functions.getPluginNameFunction != nullptr) {
|
||||
return m_functions.getPluginNameFunction();
|
||||
else {
|
||||
} else {
|
||||
if (this->isLibraryPlugin())
|
||||
return "Library Plugin";
|
||||
else
|
||||
@@ -185,8 +185,9 @@ namespace hex {
|
||||
if (m_functions.getSubCommandsFunction != nullptr) {
|
||||
auto result = m_functions.getSubCommandsFunction();
|
||||
return *static_cast<std::vector<SubCommand>*>(result);
|
||||
} else
|
||||
} else {
|
||||
return { };
|
||||
}
|
||||
}
|
||||
|
||||
bool Plugin::isLibraryPlugin() const {
|
||||
|
||||
@@ -98,7 +98,7 @@ namespace hex {
|
||||
return result;
|
||||
}
|
||||
|
||||
std::vector<ShortcutManager::ShortcutEntry> ShortcutManager::getViewShortcuts(View *view) {
|
||||
std::vector<ShortcutManager::ShortcutEntry> ShortcutManager::getViewShortcuts(const View *view) {
|
||||
std::vector<ShortcutManager::ShortcutEntry> result;
|
||||
|
||||
for (auto &[shortcut, entry] : view->m_shortcuts)
|
||||
|
||||
@@ -90,9 +90,9 @@ namespace hex {
|
||||
theme["styles"][type] = {};
|
||||
|
||||
for (const auto &[key, style] : handler.styleMap) {
|
||||
if (std::holds_alternative<float*>(style.value))
|
||||
if (std::holds_alternative<float*>(style.value)) {
|
||||
theme["styles"][type][key] = *std::get<float*>(style.value);
|
||||
else if (std::holds_alternative<ImVec2*>(style.value)) {
|
||||
} else if (std::holds_alternative<ImVec2*>(style.value)) {
|
||||
theme["styles"][type][key] = {
|
||||
std::get<ImVec2*>(style.value)->x,
|
||||
std::get<ImVec2*>(style.value)->y
|
||||
|
||||
@@ -85,8 +85,8 @@ namespace hex {
|
||||
s_proxyUrl = std::move(proxy);
|
||||
}
|
||||
|
||||
void HttpRequest::setProxyState(bool state) {
|
||||
s_proxyState = state;
|
||||
void HttpRequest::setProxyState(bool enabled) {
|
||||
s_proxyState = enabled;
|
||||
}
|
||||
|
||||
void HttpRequest::checkProxyErrors() {
|
||||
|
||||
@@ -635,13 +635,13 @@ namespace hex::gl {
|
||||
}
|
||||
}
|
||||
|
||||
void LightSourceVectors::moveTo(const Vector<float, 3> &positionVector) {
|
||||
void LightSourceVectors::moveTo(const Vector<float, 3> &position) {
|
||||
auto vertexCount = m_vertices.size();
|
||||
|
||||
for (unsigned k = 0; k < vertexCount; k += 3) {
|
||||
m_vertices[k ] = m_radius * m_normals[k ] + positionVector[0];
|
||||
m_vertices[k + 1] = m_radius * m_normals[k + 1] + positionVector[1];
|
||||
m_vertices[k + 2] = m_radius * m_normals[k + 2] + positionVector[2];
|
||||
m_vertices[k ] = m_radius * m_normals[k ] + position[0];
|
||||
m_vertices[k + 1] = m_radius * m_normals[k + 1] + position[1];
|
||||
m_vertices[k + 2] = m_radius * m_normals[k + 2] + position[2];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -67,8 +67,9 @@ namespace hex {
|
||||
if (value < 0) {
|
||||
data[index] = '-';
|
||||
return { data + index };
|
||||
} else
|
||||
} else {
|
||||
return { data + index + 1 };
|
||||
}
|
||||
}
|
||||
|
||||
std::string toLower(std::string string) {
|
||||
@@ -376,9 +377,9 @@ namespace hex {
|
||||
std::string result;
|
||||
|
||||
for (u8 byte : bytes) {
|
||||
if (std::isprint(byte) && byte != '\\')
|
||||
if (std::isprint(byte) && byte != '\\') {
|
||||
result += char(byte);
|
||||
else {
|
||||
} else {
|
||||
switch (byte) {
|
||||
case '\\':
|
||||
result += "\\";
|
||||
@@ -538,9 +539,9 @@ namespace hex {
|
||||
std::wstring utf16;
|
||||
|
||||
for (auto unicode : unicodes) {
|
||||
if (unicode <= 0xFFFF)
|
||||
if (unicode <= 0xFFFF) {
|
||||
utf16 += static_cast<wchar_t>(unicode);
|
||||
else {
|
||||
} else {
|
||||
unicode -= 0x10000;
|
||||
utf16 += static_cast<wchar_t>(((unicode >> 10) + 0xD800));
|
||||
utf16 += static_cast<wchar_t>(((unicode & 0x3FF) + 0xDC00));
|
||||
|
||||
@@ -2,7 +2,6 @@
|
||||
|
||||
#include <imgui.h>
|
||||
|
||||
#include <functional>
|
||||
#include <string>
|
||||
|
||||
namespace hex {
|
||||
|
||||
Reference in New Issue
Block a user