diff options
author | Dimitri van Heesch <dimitri@stack.nl> | 2006-09-10 20:49:41 (GMT) |
---|---|---|
committer | Dimitri van Heesch <dimitri@stack.nl> | 2006-09-10 20:49:41 (GMT) |
commit | b1dbef9886c3bf49050a5f49b9ae9d12021e4b50 (patch) | |
tree | fe67587a09765b41e54254d65f53b6c9352816e9 /src/sortdict.h | |
parent | 7b814d4aaf6321e05503a392c163537fd618066c (diff) | |
download | Doxygen-b1dbef9886c3bf49050a5f49b9ae9d12021e4b50.zip Doxygen-b1dbef9886c3bf49050a5f49b9ae9d12021e4b50.tar.gz Doxygen-b1dbef9886c3bf49050a5f49b9ae9d12021e4b50.tar.bz2 |
Release-1.4.7-20060910
Diffstat (limited to 'src/sortdict.h')
-rw-r--r-- | src/sortdict.h | 69 |
1 files changed, 69 insertions, 0 deletions
diff --git a/src/sortdict.h b/src/sortdict.h index e54da38..07c450a 100644 --- a/src/sortdict.h +++ b/src/sortdict.h @@ -319,6 +319,75 @@ class SDict QListIterator<T> *m_li; }; + class IteratorDict; // first forward declare + friend class IteratorDict; // then make it a friend + /*! Simple iterator for SDict. It iterates in over the dictionary elements + * in an unsorted way, but does provide information about the element's key. + */ + class IteratorDict + { + public: + /*! Create an iterator given the dictionary. */ + IteratorDict(const SDict<T> &dict) + { + m_di = new QDictIterator<T>(*dict.m_dict); + } + + /*! Destroys the dictionary */ + virtual ~IteratorDict() + { + delete m_di; + } + + /*! Set the iterator to the first element in the list. + * \return The first compound, or zero if the list was empty. + */ + T *toFirst() const + { + return m_di->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_di->toLast(); + } + + /*! Returns the current compound */ + T *current() const + { + return m_di->current(); + } + + /*! Returns the current key */ + QCString currentKey() const + { + return m_di->currentKey(); + } + + /*! Moves the iterator to the next element. + * \return the new "current" element, or zero if the iterator was + * already pointing at the last element. + */ + T *operator++() + { + return m_di->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_di->operator--(); + } + + private: + QDictIterator<T> *m_di; + }; }; /*! internal wrapper class that redirects compareItems() to the |