1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 08:17:35 +00:00

LibPDF: Parse linearized PDF files

This is a big step, as most PDFs which are downloaded online will be
linearized. Pretty much the only difference is that the xref structure
is slightly different.
This commit is contained in:
Matthew Olsson 2021-05-26 22:52:05 -07:00 committed by Ali Mohammad Pur
parent be1be47613
commit e23bfd7252
8 changed files with 270 additions and 45 deletions

View file

@ -109,6 +109,22 @@ public:
return m_as_int;
}
template<typename T>
[[nodiscard]] ALWAYS_INLINE bool is_int_type() const
{
if (!is_int())
return false;
auto as_int = static_cast<T>(m_as_int);
return as_int >= NumericLimits<T>::min() && as_int <= NumericLimits<T>::max();
}
template<typename T>
[[nodiscard]] ALWAYS_INLINE T as_int_type() const
{
VERIFY(is_int_type<T>());
return static_cast<T>(m_as_int);
}
[[nodiscard]] ALWAYS_INLINE int to_int() const
{
if (is_int())