fixed windows access violation which occurs if one tries to retrieve
[swftools.git] / pdf2swf / xpdf / Dict.h
blobb9945144f18730315fdbc1e3a2c56d35ab595535
1 //========================================================================
2 //
3 // Dict.h
4 //
5 // Copyright 1996-2002 Glyph & Cog, LLC
6 //
7 //========================================================================
9 #ifndef DICT_H
10 #define DICT_H
12 #ifdef __GNUC__
13 #pragma interface
14 #endif
16 #include "Object.h"
18 //------------------------------------------------------------------------
19 // Dict
20 //------------------------------------------------------------------------
22 struct DictEntry {
23 char *key;
24 Object val;
27 class Dict {
28 public:
30 // Constructor.
31 Dict(XRef *xrefA);
33 // Destructor.
34 ~Dict();
36 // Reference counting.
37 int incRef() { return ++ref; }
38 int decRef() { return --ref; }
40 // Get number of entries.
41 int getLength() { return length; }
43 // Add an entry. NB: does not copy key.
44 void add(char *key, Object *val);
46 // Check if dictionary is of specified type.
47 GBool is(char *type);
49 // Look up an entry and return the value. Returns a null object
50 // if <key> is not in the dictionary.
51 Object *lookup(char *key, Object *obj);
52 Object *lookupNF(char *key, Object *obj);
54 // Iterative accessors.
55 char *getKey(int i);
56 Object *getVal(int i, Object *obj);
57 Object *getValNF(int i, Object *obj);
59 // Set the xref pointer. This is only used in one special case: the
60 // trailer dictionary, which is read before the xref table is
61 // parsed.
62 void setXRef(XRef *xrefA) { xref = xrefA; }
64 private:
66 XRef *xref; // the xref table for this PDF file
67 DictEntry *entries; // array of entries
68 int size; // size of <entries> array
69 int length; // number of entries in dictionary
70 int ref; // reference count
72 DictEntry *find(char *key);
75 #endif