Parser.h
1//========================================================================
2//
3// Parser.h
4//
5// Copyright 1996-2002 Glyph & Cog, LLC
6//
7//========================================================================
8
9#ifndef PARSER_H
10#define PARSER_H
11
12#include <aconf.h>
13
14#ifdef USE_GCC_PRAGMAS
15#pragma interface
16#endif
17
18#include "Lexer.h"
19
20//------------------------------------------------------------------------
21// Parser
22//------------------------------------------------------------------------
23
24class Parser {
25public:
26
27 // Constructor.
28 Parser(XRef *xrefA, Lexer *lexerA);
29
30 // Destructor.
31 ~Parser();
32
33 // Get the next object from the input stream.
34#ifndef NO_DECRYPTION
35 Object *getObj(Object *obj,
36 Guchar *fileKey = NULL, int keyLength = 0,
37 int objNum = 0, int objGen = 0);
38#else
39 Object *getObj(Object *obj);
40#endif
41
42 // Get stream.
43 Stream *getStream() { return lexer->getStream(); }
44
45 // Get current position in file.
46 int getPos() { return lexer->getPos(); }
47
48private:
49
50 XRef *xref; // the xref table for this PDF file
51 Lexer *lexer; // input stream
52 Object buf1, buf2; // next two tokens
53 int inlineImg; // set when inline image data is encountered
54
55 Stream *makeStream(Object *dict);
56 void shift();
57};
58
59#endif
60