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

LibPDF: Move document-specific parsing functionality into its own class

The Parser class is now a generic PDF object parser, of which the new
DocumentParser class derives. DocumentParser now takes over all
functions relating to linearization, pages, xref and trailer handling.

This allows the use of multiple parsers in the same document's
context, which will be needed in order to handle PDF object streams.
This commit is contained in:
Julian Offenhäuser 2022-08-15 11:45:24 +02:00 committed by Sam Atkins
parent 9f4659cc63
commit 4887aacec7
7 changed files with 746 additions and 706 deletions

View file

@ -11,10 +11,10 @@
#include <AK/RefCounted.h>
#include <AK/Weakable.h>
#include <LibGfx/Color.h>
#include <LibPDF/DocumentParser.h>
#include <LibPDF/Encryption.h>
#include <LibPDF/Error.h>
#include <LibPDF/ObjectDerivatives.h>
#include <LibPDF/Parser.h>
namespace PDF {
@ -133,7 +133,7 @@ public:
}
private:
explicit Document(NonnullRefPtr<Parser> const& parser);
explicit Document(NonnullRefPtr<DocumentParser> const& parser);
// FIXME: Currently, to improve performance, we don't load any pages at Document
// construction, rather we just load the page structure and populate
@ -150,7 +150,7 @@ private:
PDFErrorOr<Destination> create_destination_from_parameters(NonnullRefPtr<ArrayObject>);
NonnullRefPtr<Parser> m_parser;
NonnullRefPtr<DocumentParser> m_parser;
RefPtr<DictObject> m_catalog;
RefPtr<DictObject> m_trailer;
Vector<u32> m_page_object_indices;