mirror of
https://github.com/WerWolv/ImHex.git
synced 2026-04-02 13:37:42 -05:00
impr: Remove hex::format, improve format and logging type safety
This commit is contained in:
@@ -19,7 +19,7 @@ namespace hex::plugin::builtin {
|
||||
void drawContent() override {
|
||||
ImGuiExt::TextFormattedWrapped("hex.builtin.popup.crash_recover.message"_lang);
|
||||
|
||||
ImGuiExt::TextFormattedWrapped(hex::format("Error: {}: {}", trace::demangle(this->m_errorType), this->m_errorMessage));
|
||||
ImGuiExt::TextFormattedWrapped(fmt::format("Error: {}: {}", trace::demangle(this->m_errorType), this->m_errorMessage));
|
||||
|
||||
if (ImGui::Button("hex.ui.common.okay"_lang)) {
|
||||
this->close();
|
||||
|
||||
@@ -90,7 +90,7 @@ namespace hex::plugin::builtin {
|
||||
for (auto space : { "xj7sbzGbHH260vbpZOu1", "WZzDdGjxmgMSIE3xly6o" }) {
|
||||
m_answer.clear();
|
||||
|
||||
auto request = HttpRequest("POST", hex::format("https://api.gitbook.com/v1/spaces/{}/search/ask", space));
|
||||
auto request = HttpRequest("POST", fmt::format("https://api.gitbook.com/v1/spaces/{}/search/ask", space));
|
||||
|
||||
// Documentation API often takes a long time to respond, so we set a timeout of 30 seconds
|
||||
request.setTimeout(30'000);
|
||||
|
||||
@@ -50,7 +50,7 @@ namespace hex::plugin::builtin {
|
||||
|
||||
void save() override {}
|
||||
|
||||
[[nodiscard]] std::string getName() const override { return hex::format("hex.builtin.provider.process_memory.name"_lang, m_selectedProcess != nullptr ? m_selectedProcess->name : ""); }
|
||||
[[nodiscard]] std::string getName() const override { return fmt::format("hex.builtin.provider.process_memory.name"_lang, m_selectedProcess != nullptr ? m_selectedProcess->name : ""); }
|
||||
[[nodiscard]] std::vector<Description> getDataDescription() const override {
|
||||
return {
|
||||
{ "hex.builtin.provider.process_memory.process_name"_lang, m_selectedProcess->name },
|
||||
|
||||
@@ -39,7 +39,7 @@ namespace hex::plugin::builtin {
|
||||
return "hex.builtin.provider.udp";
|
||||
}
|
||||
|
||||
std::string getName() const override { return hex::format("hex.builtin.provider.udp.name"_lang, m_port); }
|
||||
std::string getName() const override { return fmt::format("hex.builtin.provider.udp.name"_lang, m_port); }
|
||||
|
||||
protected:
|
||||
void receive(std::span<const u8> data);
|
||||
|
||||
@@ -26,7 +26,7 @@ namespace hex::plugin::builtin::undo {
|
||||
}
|
||||
|
||||
[[nodiscard]] std::string format() const override {
|
||||
return hex::format("Bookmark {} created", m_entry.name);
|
||||
return fmt::format("Bookmark {} created", m_entry.name);
|
||||
}
|
||||
|
||||
std::unique_ptr<Operation> clone() const override {
|
||||
|
||||
@@ -21,7 +21,7 @@ namespace hex::plugin::builtin::undo {
|
||||
}
|
||||
|
||||
[[nodiscard]] std::string format() const override {
|
||||
return hex::format("hex.builtin.undo_operation.insert"_lang, hex::toByteString(m_size), m_offset);
|
||||
return fmt::format("hex.builtin.undo_operation.insert"_lang, hex::toByteString(m_size), m_offset);
|
||||
}
|
||||
|
||||
std::unique_ptr<Operation> clone() const override {
|
||||
|
||||
@@ -26,7 +26,7 @@ namespace hex::plugin::builtin::undo {
|
||||
}
|
||||
|
||||
[[nodiscard]] std::string format() const override {
|
||||
return hex::format("hex.builtin.undo_operation.remove"_lang, hex::toByteString(m_size), m_offset);
|
||||
return fmt::format("hex.builtin.undo_operation.remove"_lang, hex::toByteString(m_size), m_offset);
|
||||
}
|
||||
|
||||
std::unique_ptr<Operation> clone() const override {
|
||||
|
||||
@@ -26,12 +26,12 @@ namespace hex::plugin::builtin::undo {
|
||||
}
|
||||
|
||||
[[nodiscard]] std::string format() const override {
|
||||
return hex::format("hex.builtin.undo_operation.write"_lang, hex::toByteString(m_newData.size()), m_offset);
|
||||
return fmt::format("hex.builtin.undo_operation.write"_lang, hex::toByteString(m_newData.size()), m_offset);
|
||||
}
|
||||
|
||||
std::vector<std::string> formatContent() const override {
|
||||
return {
|
||||
hex::format("{} {} {}", hex::crypt::encode16(m_oldData), ICON_VS_ARROW_RIGHT, hex::crypt::encode16(m_newData)),
|
||||
fmt::format("{} {} {}", hex::crypt::encode16(m_oldData), ICON_VS_ARROW_RIGHT, hex::crypt::encode16(m_newData)),
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@@ -419,7 +419,7 @@ namespace hex::plugin::builtin {
|
||||
literal = std::get<pl::core::Token::Literal>(it->value);
|
||||
string = std::get_if<std::string>(&literal);
|
||||
if (string != nullptr) {
|
||||
m_patternNames[path] = hex::format("{} ({})", *string, fileName);
|
||||
m_patternNames[path] = fmt::format("{} ({})", *string, fileName);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user