mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 21:07:35 +00:00
LibGfx/TIFF: Move Formatter<Rational>
's definition to TIFFMetadata.h
This will soon be used in TIFFTagHandler.cpp, so the definition needs to be shared.
This commit is contained in:
parent
71fdf0860e
commit
1d345109c4
2 changed files with 12 additions and 13 deletions
|
@ -258,12 +258,19 @@ using Value = Variant<ByteBuffer, String, u32, Rational<u32>, i32, Rational<i32>
|
|||
|
||||
}}
|
||||
|
||||
{generate_metadata_class(tags)}
|
||||
|
||||
}}
|
||||
|
||||
template<typename T>
|
||||
struct AK::Formatter<Gfx::TIFF::Rational<T>> : Formatter<FormatString> {{
|
||||
ErrorOr<void> format(FormatBuilder& builder, Gfx::TIFF::Rational<T> value)
|
||||
{{
|
||||
return Formatter<FormatString>::format(builder, "{{}} ({{}}/{{}})"sv,
|
||||
static_cast<double>(value.numerator) / value.denominator, value.numerator, value.denominator);
|
||||
}}
|
||||
}};
|
||||
"""
|
||||
|
||||
output += generate_metadata_class(tags)
|
||||
|
||||
output += '\n}\n'
|
||||
|
||||
return output
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue