Diffstat (limited to 'noncore/unsupported/qpdf/xpdf/Dict.h') (more/less context) (show whitespace changes)
-rw-r--r-- | noncore/unsupported/qpdf/xpdf/Dict.h | 75 |
1 files changed, 75 insertions, 0 deletions
diff --git a/noncore/unsupported/qpdf/xpdf/Dict.h b/noncore/unsupported/qpdf/xpdf/Dict.h new file mode 100644 index 0000000..c4f1ea5 --- a/dev/null +++ b/noncore/unsupported/qpdf/xpdf/Dict.h | |||
@@ -0,0 +1,75 @@ | |||
1 | //======================================================================== | ||
2 | // | ||
3 | // Dict.h | ||
4 | // | ||
5 | // Copyright 1996 Derek B. Noonburg | ||
6 | // | ||
7 | //======================================================================== | ||
8 | |||
9 | #ifndef DICT_H | ||
10 | #define DICT_H | ||
11 | |||
12 | #ifdef __GNUC__ | ||
13 | #pragma interface | ||
14 | #endif | ||
15 | |||
16 | #include "Object.h" | ||
17 | |||
18 | //------------------------------------------------------------------------ | ||
19 | // Dict | ||
20 | //------------------------------------------------------------------------ | ||
21 | |||
22 | struct DictEntry { | ||
23 | char *key; | ||
24 | Object val; | ||
25 | }; | ||
26 | |||
27 | class Dict { | ||
28 | public: | ||
29 | |||
30 | // Constructor. | ||
31 | Dict(XRef *xrefA); | ||
32 | |||
33 | // Destructor. | ||
34 | ~Dict(); | ||
35 | |||
36 | // Reference counting. | ||
37 | int incRef() { return ++ref; } | ||
38 | int decRef() { return --ref; } | ||
39 | |||
40 | // Get number of entries. | ||
41 | int getLength() { return length; } | ||
42 | |||
43 | // Add an entry. NB: does not copy key. | ||
44 | void add(char *key, Object *val); | ||
45 | |||
46 | // Check if dictionary is of specified type. | ||
47 | GBool is(char *type); | ||
48 | |||
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); | ||
53 | |||
54 | // Iterative accessors. | ||
55 | char *getKey(int i); | ||
56 | Object *getVal(int i, Object *obj); | ||
57 | Object *getValNF(int i, Object *obj); | ||
58 | |||
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; } | ||
63 | |||
64 | private: | ||
65 | |||
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 | ||
71 | |||
72 | DictEntry *find(char *key); | ||
73 | }; | ||
74 | |||
75 | #endif | ||