QtCore/qiterator.h File Reference

qiterator.h File Reference
#include <QtCore/qglobal.h>

Macros

#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)
 

Macro Definition Documentation

#define Q_DECLARE_SEQUENTIAL_ITERATOR (   C)
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; } \
};
GLfloat GLfloat p
Definition: GLee.h:5416
const GLubyte * c
Definition: GLee.h:5419
GLdouble GLdouble t
Definition: GLee.h:1181

Definition at line 83 of file qiterator.h.

#define Q_DECLARE_MUTABLE_SEQUENTIAL_ITERATOR (   C)

Definition at line 111 of file qiterator.h.

#define Q_DECLARE_ASSOCIATIVE_ITERATOR (   C)
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; } \
};
GLenum GLsizei n
Definition: GLee.h:3432
GLsizei const GLfloat * value
Definition: GLee.h:1742
GLfloat GLfloat p
Definition: GLee.h:5416
const GLubyte * c
Definition: GLee.h:5419
GLdouble GLdouble t
Definition: GLee.h:1181

Definition at line 151 of file qiterator.h.

#define Q_DECLARE_MUTABLE_ASSOCIATIVE_ITERATOR (   C)

Definition at line 183 of file qiterator.h.

Go to the source code of this file.