diff options
author | dimitri <dimitri@afe2bf4a-e733-0410-8a33-86f594647bc7> | 2001-05-17 19:26:02 (GMT) |
---|---|---|
committer | dimitri <dimitri@afe2bf4a-e733-0410-8a33-86f594647bc7> | 2001-05-17 19:26:02 (GMT) |
commit | 75fed7362598edf5a7210505cd38c92821863a39 (patch) | |
tree | cb90fc9b85934eb220249aae4ffd7e4979489b16 /src/sortdict.h | |
parent | f5f5db18c34651c19f63a972e70087ce2131e764 (diff) | |
download | Doxygen-75fed7362598edf5a7210505cd38c92821863a39.zip Doxygen-75fed7362598edf5a7210505cd38c92821863a39.tar.gz Doxygen-75fed7362598edf5a7210505cd38c92821863a39.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; |