1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 15:17:36 +00:00

AK: Add Formatter<FormatString> as helper class.

This commit is contained in:
asynts 2021-01-09 01:00:22 +01:00 committed by Andreas Kling
parent 9a842ec419
commit 1160817a9e
13 changed files with 64 additions and 94 deletions

View file

@ -94,17 +94,13 @@ inline const LogStream& operator<<(const LogStream& stream, const TextRange& val
}
namespace AK {
template<>
struct Formatter<GUI::TextRange> : Formatter<StringView> {
struct AK::Formatter<GUI::TextRange> : AK::Formatter<FormatString> {
void format(FormatBuilder& builder, const GUI::TextRange& value)
{
if (value.is_valid())
Formatter<StringView>::format(builder, String::formatted("{}-{}", value.start(), value.end()));
return Formatter<FormatString>::format(builder, "{}-{}", value.start(), value.end());
else
Formatter<StringView>::format(builder, "GUI::TextRange(Invalid)");
return Formatter<FormatString>::format(builder, "GUI::TextRange(Invalid)");
}
};
}