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

LibPDF: Parse graphics commands

This commit is contained in:
Matthew Olsson 2021-05-10 10:39:19 -07:00 committed by Andreas Kling
parent 03649f85e2
commit 101639e526
3 changed files with 190 additions and 0 deletions

View file

@ -7,6 +7,7 @@
#pragma once
#include <AK/NonnullRefPtrVector.h>
#include <LibPDF/Command.h>
#include <LibPDF/Object.h>
#include <LibPDF/Reader.h>
#include <LibPDF/XRefTable.h>
@ -17,6 +18,8 @@ class Document;
class Parser {
public:
static Vector<Command> parse_graphics_commands(const ReadonlyBytes&);
Parser(Badge<Document>, const ReadonlyBytes&);
void set_document(RefPtr<Document> document) { m_document = document; }
@ -34,6 +37,8 @@ public:
RefPtr<DictObject> conditionally_parse_page_tree_node_at_offset(size_t offset);
private:
explicit Parser(const ReadonlyBytes&);
bool parse_header();
XRefTable parse_xref_table();
NonnullRefPtr<DictObject> parse_file_trailer();
@ -64,6 +69,8 @@ private:
NonnullRefPtr<DictObject> parse_dict();
NonnullRefPtr<StreamObject> parse_stream(NonnullRefPtr<DictObject> dict);
Vector<Command> parse_graphics_commands();
bool matches_eol() const;
bool matches_whitespace() const;
bool matches_number() const;