diff options
author | Dimitri van Heesch <dimitri@stack.nl> | 2001-05-17 19:26:02 (GMT) |
---|---|---|
committer | Dimitri van Heesch <dimitri@stack.nl> | 2001-05-17 19:26:02 (GMT) |
commit | 0921be2562e370352af05de47c5d997321874012 (patch) | |
tree | cb90fc9b85934eb220249aae4ffd7e4979489b16 /src/sortdict.h | |
parent | 76e77e750cda807a7aa12d73d1fa0e5e6f24b043 (diff) | |
download | Doxygen-0921be2562e370352af05de47c5d997321874012.zip Doxygen-0921be2562e370352af05de47c5d997321874012.tar.gz Doxygen-0921be2562e370352af05de47c5d997321874012.tar.bz2 |
Release-20010517
Diffstat (limited to 'src/sortdict.h')
-rw-r--r-- | src/sortdict.h | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/src/sortdict.h b/src/sortdict.h index 199c34d..64afe8d 100644 --- a/src/sortdict.h +++ b/src/sortdict.h @@ -79,6 +79,14 @@ class SDict m_list->append(d); m_dict->insert(key,d); } + /*! 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)). + */ + void sort() + { + m_list->sort(); + } /*! Inserts a compound into the dictionary in a sorted way. * \param key The unique key to use to quicky find the item later on. * \param d The compound to add. @@ -103,6 +111,12 @@ class SDict { return m_dict->find(key); } + + /*! Returns the item at position \a i in the sorted dictionary */ + T *at(uint i) + { + return m_list->at(i); + } /*! Function that is used to compare two items when sorting. * Overload this to properly sort items. * \sa inSort() @@ -152,6 +166,13 @@ class SDict { return m_li->toFirst(); } + /*! Set the iterator to the last element in the list. + * \return The first compound, or zero if the list was empty. + */ + T *toLast() const + { + return m_li->toLast(); + } /*! Returns the current compound */ T *current() const { @@ -165,6 +186,14 @@ class SDict { return m_li->operator++(); } + /*! Moves the iterator to the previous element. + * \return the new "current" element, or zero if the iterator was + * already pointing at the first element. + */ + T *operator--() + { + return m_li->operator--(); + } private: QListIterator<T> *m_li; |