AK: Add Formatter<unsigned char[Size]>
This commit is contained in:
parent
77044dd383
commit
028a337a6d
Notes:
sideshowbarker
2024-07-18 17:07:08 +09:00
Author: https://github.com/linusg Commit: https://github.com/SerenityOS/serenity/commit/028a337a6db Pull-request: https://github.com/SerenityOS/serenity/pull/7630
1 changed files with 12 additions and 0 deletions
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…
Add table
Reference in a new issue