Coverage Report

Created: 2026-02-04 06:13

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/xpdf-4.06/xpdf/Parser.h
Line
Count
Source
1
//========================================================================
2
//
3
// Parser.h
4
//
5
// Copyright 1996-2003 Glyph & Cog, LLC
6
//
7
//========================================================================
8
9
#ifndef PARSER_H
10
#define PARSER_H
11
12
#include <aconf.h>
13
14
#include "Lexer.h"
15
16
//------------------------------------------------------------------------
17
18
// Max number of nested objects.  This is used to catch infinite loops
19
// in the object structure.
20
478M
#define objectRecursionLimit 500
21
22
//------------------------------------------------------------------------
23
// Parser
24
//------------------------------------------------------------------------
25
26
class Parser {
27
public:
28
29
  // Constructor.
30
  Parser(XRef *xrefA, Lexer *lexerA, GBool allowStreamsA);
31
32
  // Destructor.
33
  ~Parser();
34
35
  // Get the next object from the input stream.  If <simpleOnly> is
36
  // true, do not parse compound objects (arrays, dictionaries, or
37
  // streams).
38
  Object *getObj(Object *obj, GBool simpleOnly = gFalse,
39
     Guchar *fileKey = NULL,
40
     CryptAlgorithm encAlgorithm = cryptRC4, int keyLength = 0,
41
     int objNum = 0, int objGen = 0, int recursion = 0);
42
43
  // Get stream index (for arrays of streams).
44
0
  int getStreamIndex() { return lexer->getStreamIndex(); }
45
46
  // Get stream.
47
0
  Stream *getStream() { return lexer->getStream(); }
48
49
  // Get current position in file.
50
13.7M
  GFileOffset getPos() { return lexer->getPos(); }
51
52
private:
53
54
  XRef *xref;     // the xref table for this PDF file
55
  Lexer *lexer;     // input stream
56
  GBool allowStreams;   // parse stream objects?
57
  Object buf1, buf2;    // next two tokens
58
  int inlineImg;    // set when inline image data is encountered
59
60
  Stream *makeStream(Object *dict, Guchar *fileKey,
61
         CryptAlgorithm encAlgorithm, int keyLength,
62
         int objNum, int objGen, int recursion);
63
  void shift();
64
};
65
66
#endif
67