mirror of
https://github.com/RGBCube/serenity
synced 2025-07-28 16:17:47 +00:00
AK: Convert AK::Format formatting helpers to returning ErrorOr<void>
This isn't a complete conversion to ErrorOr<void>, but a good chunk. The end goal here is to propagate buffer allocation failures to the caller, and allow the use of TRY() with formatting functions.
This commit is contained in:
parent
008355c222
commit
216e21a1fa
87 changed files with 450 additions and 448 deletions
|
@ -70,7 +70,7 @@ private:
|
|||
|
||||
template<>
|
||||
struct AK::Formatter<Gfx::AffineTransform> : Formatter<FormatString> {
|
||||
void format(FormatBuilder& builder, Gfx::AffineTransform value)
|
||||
ErrorOr<void> format(FormatBuilder& builder, Gfx::AffineTransform const& value)
|
||||
{
|
||||
return Formatter<FormatString>::format(builder, "[{} {} {} {} {} {}]", value.a(), value.b(), value.c(), value.d(), value.e(), value.f());
|
||||
}
|
||||
|
|
|
@ -75,9 +75,9 @@ namespace AK {
|
|||
|
||||
template<typename T>
|
||||
struct Formatter<Gfx::Endpoint<T>> : Formatter<StringView> {
|
||||
void format(FormatBuilder& builder, const Gfx::Endpoint<T>& value)
|
||||
ErrorOr<void> format(FormatBuilder& builder, Gfx::Endpoint<T> const& value)
|
||||
{
|
||||
Formatter<StringView>::format(builder, String::formatted("({}, {}, {})", value.x, value.y, value.z));
|
||||
return Formatter<StringView>::format(builder, String::formatted("({}, {}, {})", value.x, value.y, value.z));
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
@ -352,7 +352,7 @@ bool IPC::decode(IPC::Decoder& decoder, Color& color)
|
|||
return true;
|
||||
}
|
||||
|
||||
void AK::Formatter<Gfx::Color>::format(FormatBuilder& builder, Gfx::Color const& value)
|
||||
ErrorOr<void> AK::Formatter<Gfx::Color>::format(FormatBuilder& builder, Gfx::Color const& value)
|
||||
{
|
||||
Formatter<StringView>::format(builder, value.to_string());
|
||||
return Formatter<StringView>::format(builder, value.to_string());
|
||||
}
|
||||
|
|
|
@ -478,7 +478,7 @@ namespace AK {
|
|||
|
||||
template<>
|
||||
struct Formatter<Gfx::Color> : public Formatter<StringView> {
|
||||
void format(FormatBuilder& builder, Gfx::Color const& value);
|
||||
ErrorOr<void> format(FormatBuilder&, Gfx::Color const&);
|
||||
};
|
||||
|
||||
}
|
||||
|
|
|
@ -280,9 +280,9 @@ namespace AK {
|
|||
|
||||
template<typename T>
|
||||
struct Formatter<Gfx::Point<T>> : Formatter<StringView> {
|
||||
void format(FormatBuilder& builder, Gfx::Point<T> const& value)
|
||||
ErrorOr<void> format(FormatBuilder& builder, Gfx::Point<T> const& value)
|
||||
{
|
||||
Formatter<StringView>::format(builder, value.to_string());
|
||||
return Formatter<StringView>::format(builder, value.to_string());
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
@ -726,9 +726,9 @@ namespace AK {
|
|||
|
||||
template<typename T>
|
||||
struct Formatter<Gfx::Rect<T>> : Formatter<StringView> {
|
||||
void format(FormatBuilder& builder, const Gfx::Rect<T>& value)
|
||||
ErrorOr<void> format(FormatBuilder& builder, Gfx::Rect<T> const& value)
|
||||
{
|
||||
Formatter<StringView>::format(builder, value.to_string());
|
||||
return Formatter<StringView>::format(builder, value.to_string());
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
@ -178,9 +178,9 @@ namespace AK {
|
|||
|
||||
template<typename T>
|
||||
struct Formatter<Gfx::Size<T>> : Formatter<StringView> {
|
||||
void format(FormatBuilder& builder, Gfx::Size<T> const& value)
|
||||
ErrorOr<void> format(FormatBuilder& builder, Gfx::Size<T> const& value)
|
||||
{
|
||||
Formatter<StringView>::format(builder, value.to_string());
|
||||
return Formatter<StringView>::format(builder, value.to_string());
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
@ -127,9 +127,9 @@ namespace AK {
|
|||
|
||||
template<typename T>
|
||||
struct Formatter<Gfx::Vector2<T>> : Formatter<StringView> {
|
||||
void format(FormatBuilder& builder, const Gfx::Vector2<T>& value)
|
||||
ErrorOr<void> format(FormatBuilder& builder, Gfx::Vector2<T> const& value)
|
||||
{
|
||||
Formatter<StringView>::format(builder, value.to_string());
|
||||
return Formatter<StringView>::format(builder, value.to_string());
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
@ -144,9 +144,9 @@ namespace AK {
|
|||
|
||||
template<typename T>
|
||||
struct Formatter<Gfx::Vector3<T>> : Formatter<StringView> {
|
||||
void format(FormatBuilder& builder, const Gfx::Vector3<T>& value)
|
||||
ErrorOr<void> format(FormatBuilder& builder, Gfx::Vector3<T> const& value)
|
||||
{
|
||||
Formatter<StringView>::format(builder, value.to_string());
|
||||
return Formatter<StringView>::format(builder, value.to_string());
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
@ -145,9 +145,9 @@ namespace AK {
|
|||
|
||||
template<typename T>
|
||||
struct Formatter<Gfx::Vector4<T>> : Formatter<StringView> {
|
||||
void format(FormatBuilder& builder, const Gfx::Vector4<T>& value)
|
||||
ErrorOr<void> format(FormatBuilder& builder, Gfx::Vector4<T> const& value)
|
||||
{
|
||||
Formatter<StringView>::format(builder, value.to_string());
|
||||
return Formatter<StringView>::format(builder, value.to_string());
|
||||
}
|
||||
};
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue