summaryrefslogtreecommitdiff
path: root/poppler/Hints.h
blob: f46c07f673bd83bf9e712be710818e22fe4fc77d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
//========================================================================
//
// Hints.h
//
// This file is licensed under the GPLv2 or later
//
// Copyright 2010 Hib Eris <hib@hiberis.nl>
// Copyright 2010, 2013 Albert Astals Cid <aacid@kde.org>
// Copyright 2013 Adrian Johnson <ajohnson@redneon.com>
//
//========================================================================

#ifndef HINTS_H
#define HINTS_H

#include <string.h>
#include "goo/gtypes.h"
#include <vector>
#include "PDFDoc.h"

class Stream;
class BaseStream;
class Linearization;
class XRef;

//------------------------------------------------------------------------
// Hints
//------------------------------------------------------------------------

class Hints {
public:

  Hints(BaseStream *str, Linearization *linearization, XRef *xref, SecurityHandler *secHdlr);
  ~Hints();

  int getPageObjectNum(int page);
  Goffset getPageOffset(int page);
  std::vector<ByteRange>* getPageRanges(int page);

private:

  void readTables(BaseStream *str, Linearization *linearization, XRef *xref, SecurityHandler *secHdlr);
  void readPageOffsetTable(Stream *str);
  void readSharedObjectsTable(Stream *str);

  Guint readBit(Stream *str);
  Guint readBits(int n, Stream *str);

  Guint hintsOffset;
  Guint hintsLength;
  Guint hintsOffset2;
  Guint hintsLength2;
  Guint mainXRefEntriesOffset;

  int nPages;
  int pageFirst;
  int pageObjectFirst;
  Goffset pageOffsetFirst;
  Guint pageEndFirst;

  Guint nObjectLeast;
  Guint objectOffsetFirst;
  Guint nBitsDiffObjects;
  Guint pageLengthLeast;
  Guint nBitsDiffPageLength;
  Guint OffsetStreamLeast;
  Guint nBitsOffsetStream;
  Guint lengthStreamLeast;
  Guint nBitsLengthStream;
  Guint nBitsNumShared;
  Guint nBitsShared;
  Guint nBitsNumerator;
  Guint denominator;

  Guint *nObjects;
  int *pageObjectNum;
  Guint *xRefOffset;
  Guint *pageLength;
  Goffset *pageOffset;
  Guint *numSharedObject;
  Guint **sharedObjectId;

  Guint nSharedGroups;
  Guint *groupLength;
  Guint *groupOffset;
  Guint *groupHasSignature;
  Guint *groupNumObjects;
  Guint *groupXRefOffset;

  int inputBits;
  char bitsBuffer;

};

#endif