diff options
author | Dimitri van Heesch <dimitri@stack.nl> | 2013-09-14 15:11:20 (GMT) |
---|---|---|
committer | Dimitri van Heesch <dimitri@stack.nl> | 2013-09-15 18:12:34 (GMT) |
commit | bca6baee6685b489c36abec5a3b550921294e228 (patch) | |
tree | a9f2f6d2622e8aba8beed7477e87d7c9c7a468e1 /src/sortdict.h | |
parent | f6bc941e73bd562b15705f7bc3c958267f75f842 (diff) | |
download | Doxygen-bca6baee6685b489c36abec5a3b550921294e228.zip Doxygen-bca6baee6685b489c36abec5a3b550921294e228.tar.gz Doxygen-bca6baee6685b489c36abec5a3b550921294e228.tar.bz2 |
Bug 705910 - Indexing and searching cannot treat non ASCII identifiers
Diffstat (limited to 'src/sortdict.h')
-rw-r--r-- | src/sortdict.h | 76 |
1 files changed, 73 insertions, 3 deletions
diff --git a/src/sortdict.h b/src/sortdict.h index 14a221b..e111075 100644 --- a/src/sortdict.h +++ b/src/sortdict.h @@ -108,7 +108,7 @@ class SDict * \param caseSensitive indicated whether the keys should be sorted * in a case sensitive way. */ - SDict(int size,bool caseSensitive=TRUE) : m_sizeIndex(0) + SDict(int size=17,bool caseSensitive=TRUE) : m_sizeIndex(0) { m_list = new SList<T>(this); #if AUTORESIZE @@ -454,7 +454,7 @@ class SIntDict * \param size The size of the dictionary. Should be a prime number for * best distribution of elements. */ - SIntDict(int size) : m_sizeIndex(0) + SIntDict(int size=17) : m_sizeIndex(0) { m_list = new SIntList<T>(this); #if AUTORESIZE @@ -636,7 +636,7 @@ class SIntDict { return m_li->current(); } - + /*! Moves the iterator to the next element. * \return the new "current" element, or zero if the iterator was * already pointing at the last element. @@ -659,6 +659,76 @@ class SIntDict QListIterator<T> *m_li; }; + class IteratorDict; // first forward declare + friend class IteratorDict; // then make it a friend + /*! Simple iterator for SDict. It iterates 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 SIntDict<T> &dict) + { + m_di = new QIntDictIterator<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 */ + int 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; + }; + }; #endif |