17 init( ( int ) KMail::nextPrime( size ) ); 30 void KMDict::init( int size) 34 memset(mVecs, 0, mSize * sizeof( KMDictItem *)); 43 for ( int i = 0; i < mSize; i++) { 60 removeFollowing( item, key ); 69 int idx = ( unsigned long)key % mSize; 70 item->next = mVecs[idx]; 78 int idx = ( unsigned long)key % mSize; 82 if (item->key == key) { 83 mVecs[idx] = item->next; 86 removeFollowing(item, key); 92 void KMDict::removeFollowing( KMDictItem *item, long key) 96 if (itemNext && itemNext->key == key) { 99 item->next = itemNextNext; 109 int idx = ( unsigned long)key % mSize; 112 if (item->key == key) void replace(long key, KMDictItem *item) Inserts an item, replacing old ones with the same key.
Class representing items in a KMDict.
~KMDict() Destroys the hash table object.
KMDict(int size=17) Creates a hash table with size columns.
void clear() Clears the hash table, removing all items.
int size() Returns the size of the hash table.
KMDictItem * find(long key) Find an item by key.
void remove(long key) Removes an item.
void insert(long key, KMDictItem *item) Inserts an item without replacing ones with the same key.
|