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

Go to the source code of this file.

Macros

#define Q_DECLARE_ASSOCIATIVE_ITERATOR(C)
 
#define Q_DECLARE_MUTABLE_ASSOCIATIVE_ITERATOR(C)
 
#define Q_DECLARE_MUTABLE_SEQUENTIAL_ITERATOR(C)
 
#define Q_DECLARE_SEQUENTIAL_ITERATOR(C)
 

Macro Definition Documentation

◆ Q_DECLARE_ASSOCIATIVE_ITERATOR

#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; } \
};
unsigned char c[8]
Definition: qnumeric_p.h:62
#define Q_ASSERT(cond)
Definition: qglobal.h:1823
Iterator
Synonym for QAbstractFileEngineIterator.
The Item is the most basic of all visual items in QML.
int key

Definition at line 151 of file qiterator.h.

Referenced by QMultiHash< const QGLContext *, GLProgram >::count(), and QMultiMap< QString, Method >::count().

◆ Q_DECLARE_MUTABLE_ASSOCIATIVE_ITERATOR

#define Q_DECLARE_MUTABLE_ASSOCIATIVE_ITERATOR (   C)

◆ Q_DECLARE_MUTABLE_SEQUENTIAL_ITERATOR

#define Q_DECLARE_MUTABLE_SEQUENTIAL_ITERATOR (   C)

◆ Q_DECLARE_SEQUENTIAL_ITERATOR

#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; } \
};
unsigned char c[8]
Definition: qnumeric_p.h:62
Iterator
Synonym for QAbstractFileEngineIterator.

Definition at line 83 of file qiterator.h.

Referenced by QList< QPostEvent >::count(), QList< QPostEvent >::fromSet(), QList< QPostEvent >::fromVector(), QFutureInterface< T >::future(), and QLinkedList< JSC::Identifier >::operator+().