From 9773903467337041452869116900155132108757 Mon Sep 17 00:00:00 2001 From: Glenn Smith Date: Wed, 21 May 2025 16:40:29 -0400 Subject: Fix Ref and Confidence formatters --- binaryninjaapi.h | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) (limited to 'binaryninjaapi.h') diff --git a/binaryninjaapi.h b/binaryninjaapi.h index 42364c2c..ff23cbd2 100644 --- a/binaryninjaapi.h +++ b/binaryninjaapi.h @@ -20973,20 +20973,25 @@ namespace std template struct fmt::formatter> { + fmt::formatter inner; format_context::iterator format(const BinaryNinja::Ref& obj, format_context& ctx) const { - return fmt::formatter().format(*obj.GetPtr(), ctx); + return inner.format(*obj.GetPtr(), ctx); } - constexpr auto parse(format_parse_context& ctx) -> format_parse_context::iterator { return ctx.begin(); } + constexpr auto parse(format_parse_context& ctx) -> format_parse_context::iterator { return inner.parse(ctx); } }; template struct fmt::formatter> { + fmt::formatter inner; format_context::iterator format(const BinaryNinja::Confidence& obj, format_context& ctx) const { - return fmt::format_to(ctx.out(), "{} ({} confidence)", obj.GetValue(), obj.GetConfidence()); + auto out = ctx.out(); + out = inner.format(obj.GetValue(), ctx); + ctx.advance_to(out); + return fmt::format_to(out, " ({} confidence)", obj.GetConfidence()); } - constexpr auto parse(format_parse_context& ctx) -> format_parse_context::iterator { return ctx.begin(); } + constexpr auto parse(format_parse_context& ctx) -> format_parse_context::iterator { return inner.parse(ctx); } }; template<> struct fmt::formatter -- cgit v1.3.1