mirror of
https://github.com/RGBCube/serenity
synced 2025-07-26 19:57:45 +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:
parent
9f4659cc63
commit
4887aacec7
7 changed files with 746 additions and 706 deletions
|
@ -36,7 +36,7 @@ String OutlineItem::to_string(int indent) const
|
|||
|
||||
PDFErrorOr<NonnullRefPtr<Document>> Document::create(ReadonlyBytes bytes)
|
||||
{
|
||||
auto parser = adopt_ref(*new Parser({}, bytes));
|
||||
auto parser = adopt_ref(*new DocumentParser({}, bytes));
|
||||
auto document = adopt_ref(*new Document(parser));
|
||||
|
||||
TRY(parser->initialize());
|
||||
|
@ -57,7 +57,7 @@ PDFErrorOr<NonnullRefPtr<Document>> Document::create(ReadonlyBytes bytes)
|
|||
return document;
|
||||
}
|
||||
|
||||
Document::Document(NonnullRefPtr<Parser> const& parser)
|
||||
Document::Document(NonnullRefPtr<DocumentParser> const& parser)
|
||||
: m_parser(parser)
|
||||
{
|
||||
m_parser->set_document(this);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue