mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 11:17:35 +00:00
LibPDF: Refine the distinction between the Document and Parser
The Parser should hold information relevant for parsing, whereas the Document should hold information relevant for displaying pages. With this in mind, there is no reason for the Document to hold the xref table and trailer. These objects have been moved to the Parser, which allows the Parser to expose less public methods (which will be even more evident once linearized PDFs are supported).
This commit is contained in:
parent
69410d7f4e
commit
78bc9d1539
4 changed files with 43 additions and 56 deletions
|
@ -75,8 +75,6 @@ class Document final : public RefCounted<Document> {
|
|||
public:
|
||||
static RefPtr<Document> create(const ReadonlyBytes& bytes);
|
||||
|
||||
ALWAYS_INLINE const XRefTable& xref_table() const { return m_xref_table; }
|
||||
ALWAYS_INLINE const DictObject& trailer() const { return *m_trailer; }
|
||||
ALWAYS_INLINE const RefPtr<OutlineDict>& outline() const { return m_outline; }
|
||||
|
||||
[[nodiscard]] Value get_or_load_value(u32 index);
|
||||
|
@ -92,12 +90,6 @@ public:
|
|||
return m_values.get(index).value_or({});
|
||||
}
|
||||
|
||||
ALWAYS_INLINE void set_value(u32 index, const Value& value)
|
||||
{
|
||||
m_values.ensure_capacity(index);
|
||||
m_values.set(index, value);
|
||||
}
|
||||
|
||||
// Strips away the layer of indirection by turning indirect value
|
||||
// refs into the value they reference, and indirect values into
|
||||
// the value being wrapped.
|
||||
|
@ -139,8 +131,6 @@ private:
|
|||
NonnullRefPtrVector<OutlineItem> build_outline_item_chain(const Value& first_ref, const Value& last_ref);
|
||||
|
||||
NonnullRefPtr<Parser> m_parser;
|
||||
XRefTable m_xref_table;
|
||||
RefPtr<DictObject> m_trailer;
|
||||
RefPtr<DictObject> m_catalog;
|
||||
Vector<u32> m_page_object_indices;
|
||||
HashMap<u32, Page> m_pages;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue