1
0
mirror of synced 2024-12-02 03:07:18 +01:00
ImHex/plugins/builtin/source/content/tools/demangler.cpp

31 lines
929 B
C++

#include <hex/helpers/utils.hpp>
#include <hex/api/localization.hpp>
#include <llvm/Demangle/Demangle.h>
#include <imgui.h>
#include <hex/ui/imgui_imhex_extensions.h>
namespace hex::plugin::builtin {
namespace impl {
void drawDemangler() {
static std::string mangledName, demangledName;
if (ImGui::InputTextWithHint("hex.builtin.tools.demangler.mangled"_lang, "Itanium, MSVC, Dlang & Rust", mangledName)) {
demangledName = llvm::demangle(mangledName);
if (demangledName == mangledName) {
demangledName = "???";
}
}
ImGui::Header("hex.builtin.tools.demangler.demangled"_lang);
if (ImGui::BeginChild("demangled", ImVec2(0, 200_scaled), true)) {
ImGui::TextFormattedWrappedSelectable("{}", demangledName);
}
ImGui::EndChild();
}
}
}