My Project
|
#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.
Destroys the dictionary
Definition at line 469 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 |
Returns the item at position i in the sorted dictionary
Definition at line 567 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.
Referenced by initClassMemberIndices(), initFileMemberIndices(), and initNamespaceMemberIndices().
|
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 |
Returns the number of items stored in the dictionary
Definition at line 593 of file sortdict.h.
|
inline |
Looks up a compound given its key.
key | The key to identify this element. |
Definition at line 555 of file sortdict.h.
Referenced by LetterToIndexMap< SearchIndexList >::append().
|
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.
Referenced by LetterToIndexMap< SearchIndexList >::append().
|
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.
|
inline |
Remove an item from the dictionary
Definition at line 512 of file sortdict.h.
|
inline |
Indicates whether or not the dictionary owns its elements
Definition at line 545 of file sortdict.h.
Referenced by addMembersToMemberGroup(), GroupDef::GroupDef(), LetterToIndexMap< SearchIndexList >::LetterToIndexMap(), and NamespaceDef::NamespaceDef().
|
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.
Referenced by writeAlphabeticalClassList(), NamespaceDef::writeMemberGroups(), GroupDef::writeMemberGroups(), FileDef::writeMemberGroups(), and ClassDef::writeMemberGroups().
|
friend |
Definition at line 598 of file sortdict.h.
|
friend |
Definition at line 662 of file sortdict.h.
|
private |
Definition at line 449 of file sortdict.h.
Referenced by SIntDict< SearchIndexList >::append(), SIntDict< SearchIndexList >::clear(), SIntDict< SearchIndexList >::find(), SIntDict< SearchIndexList >::inSort(), SIntDict< T >::IteratorDict::IteratorDict(), SIntDict< SearchIndexList >::operator[](), SIntDict< SearchIndexList >::prepend(), SIntDict< SearchIndexList >::remove(), SIntDict< SearchIndexList >::SIntDict(), and SIntDict< SearchIndexList >::~SIntDict().
Definition at line 448 of file sortdict.h.
Referenced by SIntDict< SearchIndexList >::append(), SIntDict< SearchIndexList >::at(), SIntDict< SearchIndexList >::clear(), SIntDict< SearchIndexList >::count(), SIntDict< SearchIndexList >::inSort(), SIntDict< T >::Iterator::Iterator(), SIntDict< SearchIndexList >::prepend(), SIntDict< SearchIndexList >::remove(), SIntDict< SearchIndexList >::setAutoDelete(), SIntDict< SearchIndexList >::SIntDict(), SIntDict< SearchIndexList >::sort(), and SIntDict< SearchIndexList >::~SIntDict().
|
private |
Definition at line 450 of file sortdict.h.
Referenced by SIntDict< SearchIndexList >::append(), SIntDict< SearchIndexList >::inSort(), SIntDict< SearchIndexList >::prepend(), and SIntDict< SearchIndexList >::SIntDict().