1 //========================================================================
5 // Copyright 2001-2003 Glyph & Cog, LLC
7 //========================================================================
9 //========================================================================
11 // Modified under the Poppler project - http://poppler.freedesktop.org
13 // All changes made under the Poppler project to this file are licensed
14 // under GPL version 2 or later
16 // Copyright (C) 2012 Albert Astals Cid <aacid@kde.org>
18 // To see a description of the changes please see the Changelog file that
19 // came with your tarball or type make ChangeLog if you are building from git
21 //========================================================================
26 #ifdef USE_GCC_PRAGMAS
36 //------------------------------------------------------------------------
41 GooHash(GBool deleteKeysA
= gFalse
);
43 void add(GooString
*key
, void *val
);
44 void add(GooString
*key
, int val
);
45 void replace(GooString
*key
, void *val
);
46 void replace(GooString
*key
, int val
);
47 void *lookup(GooString
*key
);
48 int lookupInt(GooString
*key
);
49 void *lookup(const char *key
);
50 int lookupInt(const char *key
);
51 void *remove(GooString
*key
);
52 int removeInt(GooString
*key
);
53 void *remove(const char *key
);
54 int removeInt(const char *key
);
55 int getLength() { return len
; }
56 void startIter(GooHashIter
**iter
);
57 GBool
getNext(GooHashIter
**iter
, GooString
**key
, void **val
);
58 GBool
getNext(GooHashIter
**iter
, GooString
**key
, int *val
);
59 void killIter(GooHashIter
**iter
);
62 GooHash(const GooHash
&other
);
63 GooHash
& operator=(const GooHash
&other
);
66 GooHashBucket
*find(GooString
*key
, int *h
);
67 GooHashBucket
*find(const char *key
, int *h
);
68 int hash(GooString
*key
);
69 int hash(const char *key
);
71 GBool deleteKeys
; // set if key strings should be deleted
72 int size
; // number of buckets
73 int len
; // number of entries
77 #define deleteGooHash(hash, T) \
79 GooHash *_hash = (hash); \
84 _hash->startIter(&_iter); \
85 while (_hash->getNext(&_iter, &_key, &_p)) { \