#include <sortdict.h>
Public Member Functions | |
SIntDict (int size) | |
virtual | ~SIntDict () |
void | append (int key, const T *d) |
void | prepend (int key, const T *d) |
bool | remove (int key) |
void | sort () |
void | inSort (int key, const T *d) |
void | setAutoDelete (bool val) |
T * | find (int key) |
T * | operator[] (int key) const |
T * | at (uint i) |
virtual int | compareItems (GCI item1, GCI item2) |
void | clear () |
int | count () |
Friends | |
class | Iterator |
Classes | |
class | Iterator |
Definition at line 426 of file sortdict.h.
Create an ordered dictionary.
size | The size of the dictionary. Should be a prime number for best distribution of elements. |
Definition at line 438 of file sortdict.h.
Destroys the dictionary
Definition at line 450 of file sortdict.h.
void SIntDict< T >::append | ( | int | key, | |
const T * | d | |||
) | [inline] |
Appends a compound to the dictionary. The element is owned by the dictionary.
key | The unique key to use to quicky find the item later on. | |
d | The compound to add. |
Definition at line 462 of file sortdict.h.
void SIntDict< T >::prepend | ( | int | key, | |
const T * | d | |||
) | [inline] |
Prepend a compound to the dictionary. The element is owned by the dictionary.
key | The unique key to use to quicky find the item later on. | |
d | The compound to add. |
Definition at line 480 of file sortdict.h.
bool SIntDict< T >::remove | ( | int | key | ) | [inline] |
Remove an item from the dictionary
Definition at line 493 of file sortdict.h.
void SIntDict< T >::sort | ( | ) | [inline] |
Sorts the members of the dictionary. First appending a number of members and then sorting them is faster (O(NlogN) than using inSort() for each member (O(N^2)).
Definition at line 503 of file sortdict.h.
void SIntDict< T >::inSort | ( | int | key, | |
const T * | d | |||
) | [inline] |
Inserts a compound into the dictionary in a sorted way.
key | The unique key to use to quicky find the item later on. | |
d | The compound to add. |
Definition at line 513 of file sortdict.h.
void SIntDict< T >::setAutoDelete | ( | bool | val | ) | [inline] |
Indicates whether or not the dictionary owns its elements
Definition at line 526 of file sortdict.h.
Referenced by addMembersToMemberGroup(), GroupDef::GroupDef(), and NamespaceDef::NamespaceDef().
T* SIntDict< T >::find | ( | int | key | ) | [inline] |
Looks up a compound given its key.
key | The key to identify this element. |
Definition at line 536 of file sortdict.h.
T* SIntDict< T >::operator[] | ( | int | key | ) | const [inline] |
Equavalent to find().
Definition at line 542 of file sortdict.h.
T* SIntDict< T >::at | ( | uint | i | ) | [inline] |
Returns the item at position i in the sorted dictionary
Definition at line 548 of file sortdict.h.
virtual int SIntDict< T >::compareItems | ( | GCI | item1, | |
GCI | item2 | |||
) | [inline, virtual] |
Function that is used to compare two items when sorting. Overload this to properly sort items.
Definition at line 557 of file sortdict.h.
void SIntDict< T >::clear | ( | ) | [inline] |
Clears the dictionary. Will delete items if setAutoDelete() was set to TRUE
.
Definition at line 566 of file sortdict.h.
int SIntDict< T >::count | ( | ) | [inline] |
Returns the number of items stored in the dictionary
Definition at line 574 of file sortdict.h.
friend class Iterator [friend] |
Definition at line 579 of file sortdict.h.