source: trunk/poppler/mypoppler/poppler/Dict.h @ 250

Last change on this file since 250 was 250, checked in by Eugene Romanenko, 13 years ago

PDF plugin: poppler library updated to version 0.8.3

File size: 1.9 KB
Line 
1//========================================================================
2//
3// Dict.h
4//
5// Copyright 1996-2003 Glyph & Cog, LLC
6//
7//========================================================================
8
9#ifndef DICT_H
10#define DICT_H
11
12#ifdef USE_GCC_PRAGMAS
13#pragma interface
14#endif
15
16#include "Object.h"
17
18//------------------------------------------------------------------------
19// Dict
20//------------------------------------------------------------------------
21
22struct DictEntry {
23  char *key;
24  Object val;
25};
26
27class Dict {
28public:
29
30  // Constructor.
31  Dict(XRef *xrefA);
32  Dict(Dict* dictA);
33
34  // Destructor.
35  ~Dict();
36
37  // Reference counting.
38  int incRef() { return ++ref; }
39  int decRef() { return --ref; }
40
41  // Get number of entries.
42  int getLength() { return length; }
43
44  // Add an entry.  NB: does not copy key.
45  void add(char *key, Object *val);
46
47  // Update the value of an existing entry, otherwise create it
48  void set(char *key, Object *val);
49  // Remove an entry. This invalidate indexes
50  void remove(char *key);
51
52  // Check if dictionary is of specified type.
53  GBool is(char *type);
54
55  // Look up an entry and return the value.  Returns a null object
56  // if <key> is not in the dictionary.
57  Object *lookup(char *key, Object *obj);
58  Object *lookupNF(char *key, Object *obj);
59  GBool lookupInt(const char *key, const char *alt_key, int *value);
60
61  // Iterative accessors.
62  char *getKey(int i);
63  Object *getVal(int i, Object *obj);
64  Object *getValNF(int i, Object *obj);
65
66  // Set the xref pointer.  This is only used in one special case: the
67  // trailer dictionary, which is read before the xref table is
68  // parsed.
69  void setXRef(XRef *xrefA) { xref = xrefA; }
70
71private:
72
73  XRef *xref;                   // the xref table for this PDF file
74  DictEntry *entries;           // array of entries
75  int size;                     // size of <entries> array
76  int length;                   // number of entries in dictionary
77  int ref;                      // reference count
78
79  DictEntry *find(char *key);
80};
81
82#endif
Note: See TracBrowser for help on using the repository browser.