1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 07:37:46 +00:00

AK: Add Formatter<unsigned char[Size]>

This commit is contained in:
Linus Groh 2021-05-31 16:06:35 +01:00
parent 77044dd383
commit 028a337a6d

View file

@ -314,6 +314,18 @@ struct Formatter<char*> : Formatter<const char*> {
template<size_t Size> template<size_t Size>
struct Formatter<char[Size]> : Formatter<const char*> { struct Formatter<char[Size]> : Formatter<const char*> {
}; };
template<size_t Size>
struct Formatter<unsigned char[Size]> : Formatter<StringView> {
void format(FormatBuilder& builder, const unsigned char* value)
{
if (m_mode == Mode::Pointer) {
Formatter<FlatPtr> formatter { *this };
formatter.format(builder, reinterpret_cast<FlatPtr>(value));
} else {
Formatter<StringView>::format(builder, { value, Size });
}
}
};
template<> template<>
struct Formatter<String> : Formatter<StringView> { struct Formatter<String> : Formatter<StringView> {
}; };