mirror of
https://github.com/SerenityOS/serenity
synced 2024-07-21 10:05:32 +00:00
AK: Add Formatter<unsigned char[Size]>
This commit is contained in:
parent
77044dd383
commit
028a337a6d
12
AK/Format.h
12
AK/Format.h
|
@ -314,6 +314,18 @@ struct Formatter<char*> : Formatter<const char*> {
|
|||
template<size_t Size>
|
||||
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<>
|
||||
struct Formatter<String> : Formatter<StringView> {
|
||||
};
|
||||
|
|
Loading…
Reference in a new issue