kmail

kmdict.h
1/*
2 * simple hash table for kmail. inspired by TQDict
3 */
4
5#ifndef __KMDICT
6#define __KMDICT
7
12{
13public:
14 long key;
15 KMDictItem *next;
16};
17
26class KMDict
27{
28 friend class MessageDictTester;
29public:
31 KMDict(int size = 17);
32
34 ~KMDict();
35
37 void clear();
38
40 int size() { return mSize; }
41
43 void replace(long key, KMDictItem *item);
44
46 void insert(long key, KMDictItem *item);
47
49 void remove(long key);
50
52 KMDictItem *find(long key);
53
54private:
56 void removeFollowing(KMDictItem *item, long key);
57
59 void init(int size);
60
62 int mSize;
63
65 KMDictItem **mVecs;
66};
67
68#endif /* __KMDICT */
Class representing items in a KMDict.
Definition: kmdict.h:12
KMDict implements a lightweight dictionary with serial numbers as keys.
Definition: kmdict.h:27
void remove(long key)
Removes an item.
Definition: kmdict.cpp:76
void clear()
Clears the hash table, removing all items.
Definition: kmdict.cpp:39
KMDict(int size=17)
Creates a hash table with size columns.
Definition: kmdict.cpp:15
~KMDict()
Destroys the hash table object.
Definition: kmdict.cpp:23
KMDictItem * find(long key)
Find an item by key.
Definition: kmdict.cpp:107
int size()
Returns the size of the hash table.
Definition: kmdict.h:40
void insert(long key, KMDictItem *item)
Inserts an item without replacing ones with the same key.
Definition: kmdict.cpp:66
void replace(long key, KMDictItem *item)
Inserts an item, replacing old ones with the same key.
Definition: kmdict.cpp:57