QGIS API Documentation  3.37.0-Master (a5b4d9743e8)
Public Member Functions | Protected Attributes | Friends | List of all members
QgsFeatureIterator Class Reference

Wrapper for iterator of features from vector data provider or vector layer. More...

#include <qgsfeatureiterator.h>

Public Member Functions

 QgsFeatureIterator ()=default
 Construct invalid iterator. More...
 
 QgsFeatureIterator (const QgsFeatureIterator &fi)
 Copy constructor copies the iterator, increases ref.count. More...
 
 QgsFeatureIterator (QgsAbstractFeatureIterator *iter)
 Construct a valid iterator. More...
 
 ~QgsFeatureIterator ()
 Destructor deletes the iterator if it has no more references. More...
 
bool close ()
 Call to end the iteration. More...
 
bool compileFailed () const
 Indicator if there was an error when sending the compiled query to the server. More...
 
QgsAbstractFeatureIterator::CompileStatus compileStatus () const
 Returns the status of expression compilation for filter expression requests. More...
 
bool isClosed () const
 find out whether the iterator is still valid or closed already More...
 
bool isValid () const
 Will return if this iterator is valid. More...
 
bool nextFeature (QgsFeature &f)
 Fetch next feature and stores in f, returns true on success. More...
 
QgsFeatureIteratoroperator= (const QgsFeatureIterator &other)
 
bool rewind ()
 Resets the iterator to the starting position. More...
 
void setInterruptionChecker (QgsFeedback *interruptionChecker)
 Attach an object that can be queried regularly by the iterator to check if it must stopped. More...
 

Protected Attributes

QgsAbstractFeatureIteratormIter = nullptr
 

Friends

bool operator!= (const QgsFeatureIterator &fi1, const QgsFeatureIterator &fi2)
 
bool operator== (const QgsFeatureIterator &fi1, const QgsFeatureIterator &fi2)
 

Detailed Description

Wrapper for iterator of features from vector data provider or vector layer.

Definition at line 289 of file qgsfeatureiterator.h.

Constructor & Destructor Documentation

◆ QgsFeatureIterator() [1/3]

QgsFeatureIterator::QgsFeatureIterator ( )
default

Construct invalid iterator.

◆ QgsFeatureIterator() [2/3]

QgsFeatureIterator::QgsFeatureIterator ( QgsAbstractFeatureIterator iter)
inline

Construct a valid iterator.

Definition at line 387 of file qgsfeatureiterator.h.

◆ QgsFeatureIterator() [3/3]

QgsFeatureIterator::QgsFeatureIterator ( const QgsFeatureIterator fi)
inline

Copy constructor copies the iterator, increases ref.count.

Definition at line 394 of file qgsfeatureiterator.h.

◆ ~QgsFeatureIterator()

QgsFeatureIterator::~QgsFeatureIterator ( )
inline

Destructor deletes the iterator if it has no more references.

Definition at line 401 of file qgsfeatureiterator.h.

Member Function Documentation

◆ close()

bool QgsFeatureIterator::close ( )
inline

Call to end the iteration.

This frees any resources used by the iterator.

Definition at line 420 of file qgsfeatureiterator.h.

◆ compileFailed()

bool QgsFeatureIterator::compileFailed ( ) const
inline

Indicator if there was an error when sending the compiled query to the server.

This indicates that there is something wrong with the expression compiler.

Since
QGIS 3.2

Definition at line 374 of file qgsfeatureiterator.h.

◆ compileStatus()

QgsAbstractFeatureIterator::CompileStatus QgsFeatureIterator::compileStatus ( ) const
inline

Returns the status of expression compilation for filter expression requests.

Definition at line 366 of file qgsfeatureiterator.h.

◆ isClosed()

bool QgsFeatureIterator::isClosed ( ) const
inline

find out whether the iterator is still valid or closed already

Definition at line 428 of file qgsfeatureiterator.h.

◆ isValid()

bool QgsFeatureIterator::isValid ( ) const

Will return if this iterator is valid.

An invalid iterator was probably introduced by a failed attempt to acquire a connection or is a default constructed iterator.

See also
isClosed to check if the iterator successfully completed and returned all the features.

Definition at line 278 of file qgsfeatureiterator.cpp.

◆ nextFeature()

bool QgsFeatureIterator::nextFeature ( QgsFeature f)
inline

Fetch next feature and stores in f, returns true on success.

Definition at line 407 of file qgsfeatureiterator.h.

◆ operator=()

QgsFeatureIterator & QgsFeatureIterator::operator= ( const QgsFeatureIterator other)

Definition at line 265 of file qgsfeatureiterator.cpp.

◆ rewind()

bool QgsFeatureIterator::rewind ( )
inline

Resets the iterator to the starting position.

Definition at line 412 of file qgsfeatureiterator.h.

◆ setInterruptionChecker()

void QgsFeatureIterator::setInterruptionChecker ( QgsFeedback interruptionChecker)
inline

Attach an object that can be queried regularly by the iterator to check if it must stopped.

This is mostly useful for iterators where a single nextFeature()/fetchFeature() iteration might be very long. A typical use case is the WFS provider.

Note
not available in Python bindings

Definition at line 443 of file qgsfeatureiterator.h.

Friends And Related Function Documentation

◆ operator!=

bool operator!= ( const QgsFeatureIterator fi1,
const QgsFeatureIterator fi2 
)
friend

Definition at line 438 of file qgsfeatureiterator.h.

◆ operator==

bool operator== ( const QgsFeatureIterator fi1,
const QgsFeatureIterator fi2 
)
friend

Definition at line 433 of file qgsfeatureiterator.h.

Member Data Documentation

◆ mIter

QgsAbstractFeatureIterator* QgsFeatureIterator::mIter = nullptr
protected

Definition at line 380 of file qgsfeatureiterator.h.


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