From 6458016449500151053964411398145244374352 Mon Sep 17 00:00:00 2001 From: Glenn Smith Date: Tue, 20 May 2025 18:36:42 -0400 Subject: Add fmt printer for Ref --- binaryninjaapi.h | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) (limited to 'binaryninjaapi.h') diff --git a/binaryninjaapi.h b/binaryninjaapi.h index 520c038d..42364c2c 100644 --- a/binaryninjaapi.h +++ b/binaryninjaapi.h @@ -9403,7 +9403,7 @@ namespace BinaryNinja { bool EnumerateTypesForAccess(BinaryView* data, uint64_t offset, size_t size, uint8_t baseConfidence, const std::function>& type, FieldResolutionInfo* path)>& terminal); std::vector GetLines(const TypeContainer& types, const std::string& name, - int paddingCols = 64, bool collapsed = false, BNTokenEscapingType escaping = NoTokenEscapingType); + int paddingCols = 64, bool collapsed = false, BNTokenEscapingType escaping = NoTokenEscapingType) const; static std::string GetSizeSuffix(size_t size); }; @@ -21001,7 +21001,6 @@ template<> struct fmt::formatter constexpr auto parse(format_parse_context& ctx) -> format_parse_context::iterator { return ctx.begin(); } }; - template<> struct fmt::formatter : fmt::formatter { format_context::iterator format(const BinaryNinja::StringRef& obj, format_context& ctx) const @@ -21051,3 +21050,18 @@ struct fmt::formatter, void>> return it; } }; + +template<> struct fmt::formatter +{ + // s -> short, ? -> full + char presentation = 's'; + format_context::iterator format(const BinaryNinja::Type& obj, format_context& ctx) const; + constexpr auto parse(format_parse_context& ctx) -> format_parse_context::iterator + { + auto it = ctx.begin(), end = ctx.end(); + if (it != end && *it == '?') presentation = *it++; + if (it != end && *it != '}') report_error("invalid format"); + return it; + } +}; + -- cgit v1.3.1