~ubuntu-branches/ubuntu/natty/luatex/natty

« back to all changes in this revision

Viewing changes to source/libs/poppler/poppler-0.12.4/poppler/Lexer.h

  • Committer: Package Import Robot
  • Author(s): Norbert Preining
  • Date: 2010-12-13 23:22:59 UTC
  • mfrom: (0.2.1) (1.5.4) (4.3.12 experimental)
  • Revision ID: package-import@ubuntu.com-20101213232259-nqq2mq5z5x6qldw3
Tags: 0.65.0-1
* new upstream release
* ship two source packages as they are distributed by upstream, only
  renamed to match source package requirements. Fix debian/rules
  to install the manual pdf from the right place

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
//========================================================================
 
2
//
 
3
// Lexer.h
 
4
//
 
5
// Copyright 1996-2003 Glyph & Cog, LLC
 
6
//
 
7
//========================================================================
 
8
 
 
9
//========================================================================
 
10
//
 
11
// Modified under the Poppler project - http://poppler.freedesktop.org
 
12
//
 
13
// All changes made under the Poppler project to this file are licensed
 
14
// under GPL version 2 or later
 
15
//
 
16
// Copyright (C) 2006, 2007 Albert Astals Cid <aacid@kde.org>
 
17
// Copyright (C) 2006 Krzysztof Kowalczyk <kkowalczyk@gmail.com>
 
18
//
 
19
// To see a description of the changes please see the Changelog file that
 
20
// came with your tarball or type make ChangeLog if you are building from git
 
21
//
 
22
//========================================================================
 
23
 
 
24
#ifndef LEXER_H
 
25
#define LEXER_H
 
26
 
 
27
#ifdef USE_GCC_PRAGMAS
 
28
#pragma interface
 
29
#endif
 
30
 
 
31
#include "Object.h"
 
32
#include "Stream.h"
 
33
 
 
34
class XRef;
 
35
 
 
36
#define tokBufSize 128          // size of token buffer
 
37
 
 
38
//------------------------------------------------------------------------
 
39
// Lexer
 
40
//------------------------------------------------------------------------
 
41
 
 
42
class Lexer {
 
43
public:
 
44
 
 
45
  // Construct a lexer for a single stream.  Deletes the stream when
 
46
  // lexer is deleted.
 
47
  Lexer(XRef *xrefA, Stream *str);
 
48
 
 
49
  // Construct a lexer for a stream or array of streams (assumes obj
 
50
  // is either a stream or array of streams).
 
51
  Lexer(XRef *xrefA, Object *obj);
 
52
 
 
53
  // Destructor.
 
54
  ~Lexer();
 
55
 
 
56
  // Get the next object from the input stream.
 
57
  Object *getObj(Object *obj, int objNum = -1);
 
58
 
 
59
  // Skip to the beginning of the next line in the input stream.
 
60
  void skipToNextLine();
 
61
 
 
62
  // Skip over one character.
 
63
  void skipChar() { getChar(); }
 
64
 
 
65
  // Get stream.
 
66
  Stream *getStream()
 
67
    { return curStr.isNone() ? (Stream *)NULL : curStr.getStream(); }
 
68
 
 
69
  // Get current position in file.  This is only used for error
 
70
  // messages, so it returns an int instead of a Guint.
 
71
  int getPos()
 
72
    { return curStr.isNone() ? -1 : (int)curStr.streamGetPos(); }
 
73
 
 
74
  // Set position in file.
 
75
  void setPos(Guint pos, int dir = 0)
 
76
    { if (!curStr.isNone()) curStr.streamSetPos(pos, dir); }
 
77
 
 
78
  // Returns true if <c> is a whitespace character.
 
79
  static GBool isSpace(int c);
 
80
 
 
81
 
 
82
  // often (e.g. ~30% on PDF Refernce 1.6 pdf file from Adobe site) getChar
 
83
  // is called right after lookChar. In order to avoid expensive re-doing
 
84
  // getChar() of underlying stream, we cache the last value found by
 
85
  // lookChar() in lookCharLastValueCached. A special value 
 
86
  // LOOK_VALUE_NOT_CACHED that should never be part of stream indicates
 
87
  // that no value was cached
 
88
  static const int LOOK_VALUE_NOT_CACHED = -3;
 
89
  int lookCharLastValueCached;
 
90
 
 
91
private:
 
92
 
 
93
  int getChar(GBool comesFromLook = gFalse);
 
94
  int lookChar();
 
95
 
 
96
  Array *streams;               // array of input streams
 
97
  int strPtr;                   // index of current stream
 
98
  Object curStr;                // current stream
 
99
  GBool freeArray;              // should lexer free the streams array?
 
100
  char tokBuf[tokBufSize];      // temporary token buffer
 
101
 
 
102
  XRef *xref;
 
103
};
 
104
 
 
105
#endif