aboutsummaryrefslogtreecommitdiff
path: root/tool_src/QvLib/QvDict.h
blob: 3a3aebe0adb8dd249728cc963c9bae503345e54e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
#ifndef _QV_DICT_
#define _QV_DICT_

#include <QvBasic.h>
#include <QvString.h>
#include <QvPList.h>

class QvDictEntry {
  private:
    u_long		key;
    void *		value;
    QvDictEntry *	next;
    QvDictEntry(u_long k, void *v)	{ key = k; value = v; };

friend class QvDict;
};

class QvDict {
  public:
    QvDict( int entries = 251 );
    ~QvDict();
    void	clear();
    QvBool	enter(u_long key, void *value);
    QvBool	find(u_long key, void *&value) const;
    QvBool	remove(u_long key);

  private:
    int			tableSize;
    QvDictEntry *	*buckets;
    QvDictEntry *&	findEntry(u_long key) const;
};

#endif /* _QV_DICT_ */