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

Last change on this file since 2 was 2, checked in by Eugene Romanenko, 16 years ago

First import

File size: 1.8 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
18class UGooString;
19//------------------------------------------------------------------------
20// Dict
21//------------------------------------------------------------------------
22
23struct DictEntry {
24  UGooString *key;
25  Object val;
26};
27
28class Dict {
29public:
30
31  // Constructor.
32  Dict(XRef *xrefA);
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
45  void add(const UGooString &key, Object *val);
46
47  // Check if dictionary is of specified type.
48  GBool is(char *type);
49
50  // Look up an entry and return the value.  Returns a null object
51  // if <key> is not in the dictionary.
52  Object *lookup(const UGooString &key, Object *obj);
53  Object *lookupNF(const UGooString &key, Object *obj);
54  GBool lookupInt(const char *key, const char *alt_key, int *value);
55
56  // Iterative accessors.
57  UGooString *getKey(int i);
58  Object *getVal(int i, Object *obj);
59  Object *getValNF(int i, Object *obj);
60
61  // Set the xref pointer.  This is only used in one special case: the
62  // trailer dictionary, which is read before the xref table is
63  // parsed.
64  void setXRef(XRef *xrefA) { xref = xrefA; }
65
66private:
67
68  XRef *xref;                   // the xref table for this PDF file
69  DictEntry *entries;           // array of entries
70  int size;                     // size of <entries> array
71  int length;                   // number of entries in dictionary
72  int ref;                      // reference count
73
74  DictEntry *find(const UGooString &key);
75};
76
77#endif
Note: See TracBrowser for help on using the repository browser.