- Main Page
- Related Pages
- Modules
- Namespaces
- Classes
- Files
- Directories
- Examples

- File List
- File Members

Namespaces | Defines

# qiterator.h File Reference

`#include <QtCore/qglobal.h>`

Go to the source code of this file.

## Namespaces
namespace | std
## Defines
#define | Q_DECLARE_SEQUENTIAL_ITERATOR(C)
#define | Q_DECLARE_MUTABLE_SEQUENTIAL_ITERATOR(C)
#define | Q_DECLARE_ASSOCIATIVE_ITERATOR(C)
#define | Q_DECLARE_MUTABLE_ASSOCIATIVE_ITERATOR(C)

## Define Documentation

#define Q_DECLARE_SEQUENTIAL_ITERATOR | ( |  | C | ) |

Search for all occurrences
Value:

    \
    template <class T> \
    class Q##C##Iterator \
    { \
        typedef typename Q##C<T>::const_iterator const_iterator; \
        Q##C<T> c; \
        const_iterator i; \
    public: \
        inline Q##C##Iterator(const Q##C<T> &container) \
            : c(container), i(c.constBegin()) {} \
        inline Q##C##Iterator &operator=(const Q##C<T> &container) \
        { c = container; i = c.constBegin(); return *this; } \
        inline void toFront() { i = c.constBegin(); } \
        inline void toBack() { i = c.constEnd(); } \
        inline bool hasNext() const { return i != c.constEnd(); } \
        inline const T &next() { return *i++; } \
        inline const T &peekNext() const { return *i; } \
        inline bool hasPrevious() const { return i != c.constBegin(); } \
        inline const T &previous() { return *--i; } \
        inline const T &peekPrevious() const { const_iterator p = i; return *--p; } \
        inline bool findNext(const T &t) \
        { while (i != c.constEnd()) if (*i++ == t) return true; return false; } \
        inline bool findPrevious(const T &t) \
        { while (i != c.constBegin()) if (*(--i) == t) return true; \
          return false;  } \
    };

Definition at line 58 of file qiterator.h.

#define Q_DECLARE_MUTABLE_SEQUENTIAL_ITERATOR | ( |  | C | ) |

Search for all occurrences

Definition at line 86 of file qiterator.h.

#define Q_DECLARE_ASSOCIATIVE_ITERATOR | ( |  | C | ) |

Search for all occurrences
Value:

    \
    template <class Key, class T> \
    class Q##C##Iterator \
    { \
        typedef typename Q##C<Key,T>::const_iterator const_iterator; \
        typedef const_iterator Item; \
        Q##C<Key,T> c; \
        const_iterator i, n; \
        inline bool item_exists() const { return n != c.constEnd(); } \
    public: \
        inline Q##C##Iterator(const Q##C<Key,T> &container) \
            : c(container), i(c.constBegin()), n(c.constEnd()) {} \
        inline Q##C##Iterator &operator=(const Q##C<Key,T> &container) \
        { c = container; i = c.constBegin(); n = c.constEnd(); return *this; } \
        inline void toFront() { i = c.constBegin(); n = c.constEnd(); } \
        inline void toBack() { i = c.constEnd(); n = c.constEnd(); } \
        inline bool hasNext() const { return i != c.constEnd(); } \
        inline Item next() { n = i++; return n; } \
        inline Item peekNext() const { return i; } \
        inline bool hasPrevious() const { return i != c.constBegin(); } \
        inline Item previous() { n = --i; return n; } \
        inline Item peekPrevious() const { const_iterator p = i; return --p; } \
        inline const T &value() const { Q_ASSERT(item_exists()); return *n; } \
        inline const Key &key() const { Q_ASSERT(item_exists()); return n.key(); } \
        inline bool findNext(const T &t) \
        { while ((n = i) != c.constEnd()) if (*i++ == t) return true; return false; } \
        inline bool findPrevious(const T &t) \
        { while (i != c.constBegin()) if (*(n = --i) == t) return true; \
          n = c.constEnd(); return false; } \
    };

Definition at line 126 of file qiterator.h.

#define Q_DECLARE_MUTABLE_ASSOCIATIVE_ITERATOR | ( |  | C | ) |

Search for all occurrences

Definition at line 158 of file qiterator.h.