mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 19:58:11 +00:00
LibPDF: Initial work on parsing xref streams
Since PDF version 1.5, a document may omit the xref table in favor of a new kind of xref stream object. This is used to reference so-called "compressed" objects that are part of an object stream. With this patch we are able to parse this new kind of xref object, but we'll have to implement object streams to use them correctly.
This commit is contained in:
parent
4887aacec7
commit
f9beff7b5e
4 changed files with 108 additions and 4 deletions
|
@ -19,6 +19,7 @@ struct XRefEntry {
|
|||
long byte_offset { invalid_byte_offset };
|
||||
u16 generation_number { 0 };
|
||||
bool in_use { false };
|
||||
bool compressed { false };
|
||||
};
|
||||
|
||||
struct XRefSection {
|
||||
|
@ -77,18 +78,34 @@ public:
|
|||
return m_entries[index].byte_offset;
|
||||
}
|
||||
|
||||
[[nodiscard]] ALWAYS_INLINE long object_stream_for_object(size_t index) const
|
||||
{
|
||||
return byte_offset_for_object(index);
|
||||
}
|
||||
|
||||
[[nodiscard]] ALWAYS_INLINE u16 generation_number_for_object(size_t index) const
|
||||
{
|
||||
VERIFY(has_object(index));
|
||||
return m_entries[index].generation_number;
|
||||
}
|
||||
|
||||
[[nodiscard]] ALWAYS_INLINE u16 object_stream_index_for_object(size_t index) const
|
||||
{
|
||||
return generation_number_for_object(index);
|
||||
}
|
||||
|
||||
[[nodiscard]] ALWAYS_INLINE bool is_object_in_use(size_t index) const
|
||||
{
|
||||
VERIFY(has_object(index));
|
||||
return m_entries[index].in_use;
|
||||
}
|
||||
|
||||
[[nodiscard]] ALWAYS_INLINE bool is_object_compressed(size_t index) const
|
||||
{
|
||||
VERIFY(has_object(index));
|
||||
return m_entries[index].compressed;
|
||||
}
|
||||
|
||||
private:
|
||||
friend struct AK::Formatter<PDF::XRefTable>;
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue