#include <sortdict.h>
Classes | |
class | Iterator |
class | IteratorDict |
Public Member Functions | |
SDict (int size=17, bool caseSensitive=TRUE) | |
virtual | ~SDict () |
void | append (const char *key, const T *d) |
void | prepend (const char *key, const T *d) |
bool | remove (const char *key) |
T * | take (const char *key) |
void | sort () |
void | inSort (const char *key, const T *d) |
void | insertAt (int i, const char *key, const T *d) |
void | setAutoDelete (bool val) |
T * | find (const char *key) |
T * | find (const QCString &key) |
T * | find (const QString &key) |
int | findAt (const QCString &key) |
T * | operator[] (const char *key) const |
T * | at (uint i) |
virtual int | compareValues (const T *item1, const T *item2) const |
void | clear () |
int | count () const |
Private Attributes | |
SList< T > * | m_list |
QDict< 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 QDict<T>.
Definition at line 73 of file sortdict.h.
Create an ordered dictionary.
size | The size of the dictionary. Should be a prime number for best distribution of elements. |
caseSensitive | indicated whether the keys should be sorted in a case sensitive way. |
Definition at line 111 of file sortdict.h.
|
inline |
Appends an element 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 135 of file sortdict.h.
Returns the item at position i in the sorted dictionary
Definition at line 258 of file sortdict.h.
|
inline |
Clears the dictionary. Will delete items if setAutoDelete() was set to TRUE
.
Definition at line 276 of file sortdict.h.
|
inlinevirtual |
Function that is used to compare two items when sorting. Overload this to properly sort items.
Reimplemented in NamespaceSDict, DirSDict, GroupSDict, SearchIndexList, FilePairDict, MemberSDict, MemberNameInfoSDict, PageSDict, ClassSDict, IndexFieldSDict, MemberNameSDict, SortedRefItems, and ExampleSDict.
Definition at line 267 of file sortdict.h.
|
inline |
Returns the number of items stored in the dictionary
Definition at line 284 of file sortdict.h.
|
inline |
Looks up a compound given its key.
key | The key to identify this element. |
Definition at line 232 of file sortdict.h.
Definition at line 236 of file sortdict.h.
Definition at line 240 of file sortdict.h.
Definition at line 244 of file sortdict.h.
|
inline |
Definition at line 209 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 197 of file sortdict.h.
|
inline |
|
inline |
Prepends an element 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 153 of file sortdict.h.
Indicates whether or not the dictionary owns its elements
Definition at line 222 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 188 of file sortdict.h.
|
inline |
|
friend |
Definition at line 289 of file sortdict.h.
|
friend |
Definition at line 353 of file sortdict.h.
|
private |
Definition at line 101 of file sortdict.h.
Definition at line 100 of file sortdict.h.
|
private |
Definition at line 102 of file sortdict.h.