~ubuntu-branches/ubuntu/precise/ipe/precise

« back to all changes in this revision

Viewing changes to src/xpdflib/dict.h

  • Committer: Bazaar Package Importer
  • Author(s): Steve M. Robbins
  • Date: 2005-02-24 22:09:16 UTC
  • mfrom: (2.1.1 hoary)
  • Revision ID: james.westby@ubuntu.com-20050224220916-9vxiiqjz066r5489
Tags: 6.0pre23-2
debian/control: Ipe should depend on exact version of libipe.
Closes: #296771.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
// -*- C++ -*-
2
 
//========================================================================
3
 
//
4
 
// Dict.h
5
 
//
6
 
// Copyright 1996-2002 Glyph & Cog, LLC
7
 
//
8
 
//========================================================================
9
 
 
10
 
#ifndef DICT_H
11
 
#define DICT_H
12
 
 
13
 
#include "aconf.h"
14
 
 
15
 
#ifdef USE_GCC_PRAGMAS
16
 
#pragma interface
17
 
#endif
18
 
 
19
 
#include "object.h"
20
 
 
21
 
//------------------------------------------------------------------------
22
 
// Dict
23
 
//------------------------------------------------------------------------
24
 
 
25
 
struct DictEntry {
26
 
  char *key;
27
 
  Object val;
28
 
};
29
 
 
30
 
class Dict {
31
 
public:
32
 
 
33
 
  // Constructor.
34
 
  Dict(XRef *xrefA);
35
 
 
36
 
  // Destructor.
37
 
  ~Dict();
38
 
 
39
 
  // Reference counting.
40
 
  int incRef() { return ++ref; }
41
 
  int decRef() { return --ref; }
42
 
 
43
 
  // Get number of entries.
44
 
  int getLength() { return length; }
45
 
 
46
 
  // Add an entry.  NB: does not copy key.
47
 
  void add(char *key, Object *val);
48
 
 
49
 
  // Check if dictionary is of specified type.
50
 
  GBool is(char *type);
51
 
 
52
 
  // Look up an entry and return the value.  Returns a null object
53
 
  // if <key> is not in the dictionary.
54
 
  Object *lookup(char *key, Object *obj);
55
 
  Object *lookupNF(char *key, Object *obj);
56
 
 
57
 
  // Iterative accessors.
58
 
  char *getKey(int i);
59
 
  Object *getVal(int i, Object *obj);
60
 
  Object *getValNF(int i, Object *obj);
61
 
 
62
 
  // Set the xref pointer.  This is only used in one special case: the
63
 
  // trailer dictionary, which is read before the xref table is
64
 
  // parsed.
65
 
  void setXRef(XRef *xrefA) { xref = xrefA; }
66
 
 
67
 
private:
68
 
 
69
 
  XRef *xref;                   // the xref table for this PDF file
70
 
  DictEntry *entries;           // array of entries
71
 
  int size;                     // size of <entries> array
72
 
  int length;                   // number of entries in dictionary
73
 
  int ref;                      // reference count
74
 
 
75
 
  DictEntry *find(char *key);
76
 
};
77
 
 
78
 
#endif