Loading...
Searching...
No Matches
QDjangoQuerySet< T >::const_iterator Class Reference

`#include <QDjangoQuerySet.h>`

## Public Types

typedef std::bidirectional_iterator_tag | iterator_category

## Public Member Functions

| const_iterator ()
| const_iterator (const const_iterator &other)
const T & | operator* () const
const T * | operator-> () const
bool | operator== (const const_iterator &other) const
bool | operator!= (const const_iterator &other) const
bool | operator< (const const_iterator &other) const
bool | operator<= (const const_iterator &other) const
bool | operator> (const const_iterator &other) const
bool | operator>= (const const_iterator &other) const
const_iterator & | operator++ ()
const_iterator | operator++ (int)
const_iterator & | operator+= (int i)
const_iterator | operator+ (int i) const
const_iterator & | operator-= (int i)
const_iterator | operator- (int i) const
const_iterator & | operator-- ()
const_iterator | operator-- (int)
difference_type | operator- (const const_iterator &other) const

## Friends

class | QDjangoQuerySet

## Detailed Description

template<class T>
class QDjangoQuerySet< T >::const_iterator

The QDjangoQuerySet::const_iterator class provides an STL-style const iterator for QDjangoQuerySet.

QDjangoQuerySet::const_iterator allows you to iterate over a QDjangoQuerySet. As a const iterator it doesn't permit you to modify the QDjangoQuerySet.

The default QDjangoQuerySet::const_iterator constructor creates an uninitialized iterator. You must initialize it using a QDjangoQuerySet function like QDjangoQuerySet::constBegin(), or QDjangoQuerySet::constEnd() before you can start iterating. Here's a typical loop that prints all the objects stored in a set:

QDjangoQuerySet<Weblog::Post> posts;
foreach(const Weblog::Post &p, posts) {
cout << p << endl;
}

## Member Typedef Documentation

## iterator_category

template<class T>

typedef std::bidirectional_iterator_tag QDjangoQuerySet< T >::const_iterator::iterator_category

A synonym for std::bidirectional_iterator_tag indicating this iterator permits bidirectional access.

## Constructor & Destructor Documentation

## const_iterator() [1/2]

template<class T>

QDjangoQuerySet< T >::const_iterator::const_iterator | ( |  | ) |

inline

Constructs an uninitialized iterator.

Functions like operator*() and operator++() should not be called on an uninitialized iterator. Use const_iterator::operator=() to assign a value to it before using it.

See also
  See also QDjangoQuerySet::constBegin() and QDjangoQuerySet::constEnd().

## const_iterator() [2/2]

template<class T>

QDjangoQuerySet< T >::const_iterator::const_iterator | ( | const const_iterator & | other | ) |

inline

Constructs a copy of `other`.

## Member Function Documentation

## operator!=()

template<class T>

bool QDjangoQuerySet< T >::const_iterator::operator!= | ( | const const_iterator & | other | ) | const

inline

Returns `true` if `other` points to a different item than this iterator; otherwise returns `false`.

See also
  operator==()

## operator*()

template<class T>

const T & QDjangoQuerySet< T >::const_iterator::operator* | ( |  | ) | const

inline

Returns the current item.

See also
  operator->()

## operator+()

template<class T>

const_iterator QDjangoQuerySet< T >::const_iterator::operator+ | ( | int | i | ) | const

inline

Returns an iterator to the item at `i` positions forward from this iterator. (If `i` is negative, the iterator goes backward.)

See also
  operator-() and operator+=()

## operator++() [1/2]

template<class T>

const_iterator & QDjangoQuerySet< T >::const_iterator::operator++ | ( |  | ) |

inline

The prefix ++ operator (`++it`) advances the iterator to the next item in the set and returns an iterator to the new current item.

Calling this function on QDjangoQuerySet::end() leads to undefined results.

See also
  operator--()

## operator++() [2/2]

template<class T>

const_iterator QDjangoQuerySet< T >::const_iterator::operator++ | ( | int |  | ) |

inline

The postfix ++ operator (`it++`) advances the iterator to the next item in the set and returns an iterator to the previously current item.

Calling this function on QDjangoQuerySet::end() leads to undefined results.

See also
  operator--(int)

## operator+=()

template<class T>

const_iterator & QDjangoQuerySet< T >::const_iterator::operator+= | ( | int | i | ) |

inline

Advances the iterator by `i` items. (If `i` is negative, the iterator goes backward.)

See also
  operator-=() and operator+().

## operator-() [1/2]

template<class T>

difference_type QDjangoQuerySet< T >::const_iterator::operator- | ( | const const_iterator & | other | ) | const

inline

Returns the number of items between the item pointed to by `other` and the item pointed to by this iterator.

## operator-() [2/2]

template<class T>

const_iterator QDjangoQuerySet< T >::const_iterator::operator- | ( | int | i | ) | const

inline

Returns an iterator to the item at `i` positions backward from this iterator. (If `i` is negative, the iterator goes forward.)

See also
  operator+() and operator-=()

## operator--() [1/2]

template<class T>

const_iterator & QDjangoQuerySet< T >::const_iterator::operator-- | ( |  | ) |

inline

The prefix – operator (`--it`) makes the preceding item current and returns an iterator to the new current item.

Calling this function on QDjangoQuerySet::begin() leads to undefined results.

See also
  operator++().

## operator--() [2/2]

template<class T>

const_iterator QDjangoQuerySet< T >::const_iterator::operator-- | ( | int |  | ) |

inline

The postfix – operator (`it--`) makes the preceding item current and returns an iterator to the previously current item.

Calling this function on QDjangoQuerySet::begin() leads to undefined results.

See also
  operator++(int).

## operator-=()

template<class T>

const_iterator & QDjangoQuerySet< T >::const_iterator::operator-= | ( | int | i | ) |

inline

Makes the iterator go back by `i` items. (If `i` is negative, the iterator goes forward.)

See also
  operator+=() and operator-()

## operator->()

template<class T>

const T * QDjangoQuerySet< T >::const_iterator::operator-> | ( |  | ) | const

inline

Returns a pointer to the current item.

See also
  operator*()

## operator<()

template<class T>

bool QDjangoQuerySet< T >::const_iterator::operator< | ( | const const_iterator & | other | ) | const

inline

Returns `true` if other `points` to a position behind this iterator; otherwise returns `false`.

## operator<=()

template<class T>

bool QDjangoQuerySet< T >::const_iterator::operator<= | ( | const const_iterator & | other | ) | const

inline

Returns `true` if other `points` to a position behind or equal this iterator; otherwise returns `false`.

## operator==()

template<class T>

bool QDjangoQuerySet< T >::const_iterator::operator== | ( | const const_iterator & | other | ) | const

inline

Returns `true` if `other` points to the same item as this iterator; otherwise returns `false`.

See also
  operator!=()

## operator>()

template<class T>

bool QDjangoQuerySet< T >::const_iterator::operator> | ( | const const_iterator & | other | ) | const

inline

Returns `true` if other `points` to a position before this iterator; otherwise returns `false`.

## operator>=()

template<class T>

bool QDjangoQuerySet< T >::const_iterator::operator>= | ( | const const_iterator & | other | ) | const

inline

Returns `true` if other `points` to a position before or equal this iterator; otherwise returns `false`.

The documentation for this class was generated from the following file:

- QDjangoQuerySet.h