mirror of
https://github.com/RGBCube/serenity
synced 2025-07-26 09:47:35 +00:00
LibGfx/TIFF: Add a C++ formatter for TIFF::Value
This commit is contained in:
parent
6e282538cc
commit
b82f5d7f3e
1 changed files with 18 additions and 0 deletions
|
@ -309,6 +309,24 @@ struct AK::Formatter<Gfx::TIFF::Rational<T>> : Formatter<FormatString> {{
|
||||||
static_cast<double>(value.numerator) / value.denominator, value.numerator, value.denominator);
|
static_cast<double>(value.numerator) / value.denominator, value.numerator, value.denominator);
|
||||||
}}
|
}}
|
||||||
}};
|
}};
|
||||||
|
|
||||||
|
template<>
|
||||||
|
struct AK::Formatter<Gfx::TIFF::Value> : Formatter<FormatString> {{
|
||||||
|
ErrorOr<void> format(FormatBuilder& builder, Gfx::TIFF::Value const& value)
|
||||||
|
{{
|
||||||
|
String content;
|
||||||
|
value.visit(
|
||||||
|
[&](ByteBuffer const& buffer) {{
|
||||||
|
content = MUST(String::formatted("Buffer of size: {{}}"sv, buffer.size()));
|
||||||
|
}},
|
||||||
|
[&](auto const& other) {{
|
||||||
|
content = MUST(String::formatted("{{}}", other));
|
||||||
|
}}
|
||||||
|
);
|
||||||
|
|
||||||
|
return Formatter<FormatString>::format(builder, "{{}}"sv, content);
|
||||||
|
}}
|
||||||
|
}};
|
||||||
"""
|
"""
|
||||||
return output
|
return output
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue