mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-01-23 17:52:26 -05: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
Notes:
sideshowbarker
2024-07-16 22:54:10 +09:00
Author: https://github.com/LucasChollet Commit: https://github.com/SerenityOS/serenity/commit/1d345109c4 Pull-request: https://github.com/SerenityOS/serenity/pull/22139 Reviewed-by: https://github.com/nico ✅
2 changed files with 12 additions and 13 deletions
|
@ -511,11 +511,3 @@ ErrorOr<Optional<ReadonlyBytes>> TIFFImageDecoderPlugin::icc_data()
|
|||
}
|
||||
|
||||
}
|
||||
|
||||
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);
|
||||
}
|
||||
};
|
||||
|
|
|
@ -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
Reference in a new issue