From 028a337a6db79c00493a7870367911b3f319eb3d Mon Sep 17 00:00:00 2001 From: Linus Groh Date: Mon, 31 May 2021 16:06:35 +0100 Subject: [PATCH] AK: Add Formatter --- AK/Format.h | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/AK/Format.h b/AK/Format.h index f1ef2e8fb8..96106f5fbd 100644 --- a/AK/Format.h +++ b/AK/Format.h @@ -314,6 +314,18 @@ struct Formatter : Formatter { template struct Formatter : Formatter { }; +template +struct Formatter : Formatter { + void format(FormatBuilder& builder, const unsigned char* value) + { + if (m_mode == Mode::Pointer) { + Formatter formatter { *this }; + formatter.format(builder, reinterpret_cast(value)); + } else { + Formatter::format(builder, { value, Size }); + } + } +}; template<> struct Formatter : Formatter { };