AK: Add special formatter for char.

When we format a character we want to put the ascii value and not the
decimal value. The old behaviour can be obtained with '{:d}'.
This commit is contained in:
asynts 2020-10-04 13:49:19 +02:00 committed by Andreas Kling
parent 6eb6752c4c
commit aa283d235a

View file

@ -280,6 +280,14 @@ struct Formatter<T*> : StandardFormatter {
}
};
template<>
struct Formatter<char> : Formatter<StringView> {
void format(TypeErasedFormatParams& params, FormatBuilder& builder, char value)
{
Formatter<StringView>::format(params, builder, { &value, 1 });
}
};
template<>
struct Formatter<bool> : StandardFormatter {
void format(TypeErasedFormatParams&, FormatBuilder&, bool value);