#include <sortdict.h>
Classes | |
class | Iterator |
class | IteratorDict |
Public Member Functions | |
SIntDict (int size=17) | |
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 | compareValues (const T *item1, const T *item2) const |
void | clear () |
int | count () |
Private Attributes | |
SIntList< T > * | m_list |
QIntDict< T > * | m_dict |
int | m_sizeIndex |
Friends | |
class | Iterator |
class | IteratorDict |
Ordered dictionary of elements of type T. Internally uses a QList<T> and a QIntDict<T>.
Definition at line 74 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 457 of file sortdict.h.
|
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 481 of file sortdict.h.
|
inline |
Clears the dictionary. Will delete items if setAutoDelete() was set to TRUE
.
Definition at line 585 of file sortdict.h.
|
inlinevirtual |
Function that is used to compare two items when sorting. Overload this to properly sort items.
Reimplemented in UsedIndexLetters, MemberGroupSDict, LetterToIndexMap< T >, and LetterToIndexMap< SearchIndexList >.
Definition at line 576 of file sortdict.h.
|
inline |
|
inline |
Looks up a compound given its key.
key | The key to identify this element. |
Definition at line 555 of file sortdict.h.
|
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 532 of file sortdict.h.
|
inline |
|
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 499 of file sortdict.h.
Indicates whether or not the dictionary owns its elements
Definition at line 545 of file sortdict.h.
|
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 522 of file sortdict.h.
|
friend |
Definition at line 598 of file sortdict.h.
|
friend |
Definition at line 662 of file sortdict.h.
Definition at line 449 of file sortdict.h.
Definition at line 448 of file sortdict.h.
|
private |
Definition at line 450 of file sortdict.h.