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

Last change on this file since 470 was 470, checked in by Silvan Scherrer, 11 years ago

poppler, jpeg, freetype lib updates

File size: 2.8 KB
Line 
1//========================================================================
2//
3// Dict.h
4//
5// Copyright 1996-2003 Glyph & Cog, LLC
6//
7//========================================================================
8
9//========================================================================
10//
11// Modified under the Poppler project - http://poppler.freedesktop.org
12//
13// All changes made under the Poppler project to this file are licensed
14// under GPL version 2 or later
15//
16// Copyright (C) 2005 Kristian HÞgsberg <krh@redhat.com>
17// Copyright (C) 2006 Krzysztof Kowalczyk <kkowalczyk@gmail.com>
18// Copyright (C) 2007-2008 Julien Rebetez <julienr@svn.gnome.org>
19// Copyright (C) 2010 Albert Astals Cid <aacid@kde.org>
20// Copyright (C) 2010 Paweł Wiejacha <pawel.wiejacha@gmail.com>
21//
22// To see a description of the changes please see the Changelog file that
23// came with your tarball or type make ChangeLog if you are building from git
24//
25//========================================================================
26
27#ifndef DICT_H
28#define DICT_H
29
30#ifdef USE_GCC_PRAGMAS
31#pragma interface
32#endif
33
34#include "Object.h"
35
36//------------------------------------------------------------------------
37// Dict
38//------------------------------------------------------------------------
39
40struct DictEntry {
41  char *key;
42  Object val;
43};
44
45class Dict {
46public:
47
48  // Constructor.
49  Dict(XRef *xrefA);
50  Dict(Dict* dictA);
51
52  // Destructor.
53  ~Dict();
54
55  // Reference counting.
56  int incRef() { return ++ref; }
57  int decRef() { return --ref; }
58
59  // Get number of entries.
60  int getLength() { return length; }
61
62  // Add an entry.  NB: does not copy key.
63  void add(char *key, Object *val);
64
65  // Update the value of an existing entry, otherwise create it
66  void set(char *key, Object *val);
67  // Remove an entry. This invalidate indexes
68  void remove(char *key);
69
70  // Check if dictionary is of specified type.
71  GBool is(char *type);
72
73  // Look up an entry and return the value.  Returns a null object
74  // if <key> is not in the dictionary.
75  Object *lookup(char *key, Object *obj, std::set<int> *fetchOriginatorNums = NULL);
76  Object *lookupNF(char *key, Object *obj);
77  GBool lookupInt(const char *key, const char *alt_key, int *value);
78
79  // Iterative accessors.
80  char *getKey(int i);
81  Object *getVal(int i, Object *obj);
82  Object *getValNF(int i, Object *obj);
83
84  // Set the xref pointer.  This is only used in one special case: the
85  // trailer dictionary, which is read before the xref table is
86  // parsed.
87  void setXRef(XRef *xrefA) { xref = xrefA; }
88 
89  XRef *getXRef() { return xref; }
90 
91  GBool hasKey(char *key);
92
93private:
94
95  GBool sorted;
96  XRef *xref;                   // the xref table for this PDF file
97  DictEntry *entries;           // array of entries
98  int size;                     // size of <entries> array
99  int length;                   // number of entries in dictionary
100  int ref;                      // reference count
101
102  DictEntry *find(char *key);
103};
104
105#endif
Note: See TracBrowser for help on using the repository browser.