mirror of
https://github.com/RGBCube/serenity
synced 2025-05-14 09:24:57 +00:00
AK: Add a basic formatter for wchar_t
This commit is contained in:
parent
4ef3ed4ba3
commit
67a579aab0
3 changed files with 31 additions and 0 deletions
|
@ -688,6 +688,19 @@ void Formatter<char>::format(FormatBuilder& builder, char value)
|
|||
return formatter.format(builder, { &value, 1 });
|
||||
}
|
||||
}
|
||||
void Formatter<wchar_t>::format(FormatBuilder& builder, wchar_t value)
|
||||
{
|
||||
if (m_mode == Mode::Binary || m_mode == Mode::BinaryUppercase || m_mode == Mode::Decimal || m_mode == Mode::Octal || m_mode == Mode::Hexadecimal || m_mode == Mode::HexadecimalUppercase) {
|
||||
Formatter<u32> formatter { *this };
|
||||
return formatter.format(builder, static_cast<u32>(value));
|
||||
} else {
|
||||
StringBuilder codepoint;
|
||||
codepoint.append_code_point(value);
|
||||
|
||||
Formatter<StringView> formatter { *this };
|
||||
return formatter.format(builder, codepoint.to_string());
|
||||
}
|
||||
}
|
||||
void Formatter<bool>::format(FormatBuilder& builder, bool value)
|
||||
{
|
||||
if (m_mode == Mode::Binary || m_mode == Mode::BinaryUppercase || m_mode == Mode::Decimal || m_mode == Mode::Octal || m_mode == Mode::Hexadecimal || m_mode == Mode::HexadecimalUppercase) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue