Various Datatypes.
[AROS-Contrib.git] / arospdf / xpdf / Dict.h
blob9ef68704e643af18c0aa3cf9d56c1d75b6a1ca26
1 //========================================================================
2 //
3 // Dict.h
4 //
5 // Copyright 1996-2003 Glyph & Cog, LLC
6 //
7 //========================================================================
9 #ifndef DICT_H
10 #define DICT_H
12 #include <aconf.h>
14 #ifdef USE_GCC_PRAGMAS
15 #pragma interface
16 #endif
18 #include "Object.h"
20 //------------------------------------------------------------------------
21 // Dict
22 //------------------------------------------------------------------------
24 struct DictEntry {
25 char *key;
26 xObject val;
29 class Dict {
30 public:
32 // Constructor.
33 Dict(XRef *xrefA);
35 // Destructor.
36 ~Dict();
38 // Reference counting.
39 int incRef() { return ++ref; }
40 int decRef() { return --ref; }
42 // Get number of entries.
43 int getLength() { return length; }
45 // Add an entry. NB: does not copy key.
46 void add(char *key, xObject *val);
48 // Check if dictionary is of specified type.
49 GBool is(char *type);
51 // Look up an entry and return the value. Returns a null xObject
52 // if <key> is not in the dictionary.
53 xObject *lookup(char *key, xObject *obj);
54 xObject *lookupNF(char *key, xObject *obj);
56 // Iterative accessors.
57 char *getKey(int i);
58 xObject *getVal(int i, xObject *obj);
59 xObject *getValNF(int i, xObject *obj);
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; }
66 private:
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
74 DictEntry *find(char *key);
77 #endif