impr: Remove hex::format, improve format and logging type safety

This commit is contained in:
WerWolv
2025-08-06 20:01:58 +02:00
parent d429424f67
commit 9cff9043ee
109 changed files with 473 additions and 455 deletions

View File

@@ -15,7 +15,7 @@ namespace hex::subcommands {
std::optional<SubCommand> findSubCommand(const std::string &arg) {
for (auto &plugin : PluginManager::getPlugins()) {
for (auto &subCommand : plugin.getSubCommands()) {
if (hex::format("--{}", subCommand.commandLong) == arg || hex::format("-{}", subCommand.commandShort) == arg) {
if (fmt::format("--{}", subCommand.commandLong) == arg || fmt::format("-{}", subCommand.commandShort) == arg) {
return subCommand;
}
}
@@ -106,13 +106,13 @@ namespace hex::subcommands {
data.pop_back();
}
SendMessageToMainInstance::post(hex::format("command/{}", cmdName), data);
SendMessageToMainInstance::post(fmt::format("command/{}", cmdName), data);
}
void registerSubCommand(const std::string &cmdName, const ForwardCommandHandler &handler) {
log::debug("Registered new forward command handler: {}", cmdName);
ImHexApi::Messaging::registerHandler(hex::format("command/{}", cmdName), [handler](const std::vector<u8> &eventData){
ImHexApi::Messaging::registerHandler(fmt::format("command/{}", cmdName), [handler](const std::vector<u8> &eventData){
std::string string(reinterpret_cast<const char *>(eventData.data()), eventData.size());
std::vector<std::string> args;