QGIS API Documentation 3.28.0-Firenze (ed3ad0430f)
Public Member Functions | List of all members
QgsProxyFeatureSink Class Reference

A simple feature sink which proxies feature addition on to another feature sink. More...

#include <qgsproxyfeaturesink.h>

Inheritance diagram for QgsProxyFeatureSink:
Inheritance graph
[legend]

Public Member Functions

 QgsProxyFeatureSink (QgsFeatureSink *sink)
 Constructs a new QgsProxyFeatureSink which forwards features onto a destination sink. More...
 
bool addFeature (QgsFeature &feature, QgsFeatureSink::Flags flags=QgsFeatureSink::Flags()) override
 Adds a single feature to the sink. More...
 
bool addFeatures (QgsFeatureIterator &iterator, QgsFeatureSink::Flags flags=QgsFeatureSink::Flags()) override
 Adds all features from the specified iterator to the sink. More...
 
bool addFeatures (QgsFeatureList &features, QgsFeatureSink::Flags flags=QgsFeatureSink::Flags()) override
 Adds a list of features to the sink. More...
 
QgsFeatureSinkdestinationSink ()
 Returns the destination QgsFeatureSink which the proxy will forward features to. More...
 
QString lastError () const override
 Returns the most recent error encountered by the sink, e.g. More...
 
- Public Member Functions inherited from QgsFeatureSink
virtual ~QgsFeatureSink ()=default
 
virtual bool addFeature (QgsFeature &feature, QgsFeatureSink::Flags flags=QgsFeatureSink::Flags())
 Adds a single feature to the sink. More...
 
virtual bool addFeatures (QgsFeatureIterator &iterator, QgsFeatureSink::Flags flags=QgsFeatureSink::Flags())
 Adds all features from the specified iterator to the sink. More...
 
virtual bool addFeatures (QgsFeatureList &features, QgsFeatureSink::Flags flags=QgsFeatureSink::Flags())=0
 Adds a list of features to the sink. More...
 
virtual bool flushBuffer ()
 Flushes any internal buffer which may exist in the sink, causing any buffered features to be added to the sink's destination. More...
 
virtual QString lastError () const
 Returns the most recent error encountered by the sink, e.g. More...
 

Additional Inherited Members

- Public Types inherited from QgsFeatureSink
enum  Flag { FastInsert = 1 << 1 , RollBackOnErrors = 1 << 2 }
 Flags controlling how features are added to a sink. More...
 
enum  SinkFlag { RegeneratePrimaryKey = 1 << 1 }
 Flags that can be set on a QgsFeatureSink. More...
 

Detailed Description

A simple feature sink which proxies feature addition on to another feature sink.

This class is designed to allow factory methods which always return new QgsFeatureSink objects. Since it is not always possible to create an entirely new QgsFeatureSink (e.g. if the feature sink is a layer's data provider), a new QgsProxyFeatureSink can instead be returned which forwards features on to the destination sink. The proxy sink can be safely deleted without affecting the destination sink.

Since
QGIS 3.0

Definition at line 39 of file qgsproxyfeaturesink.h.

Constructor & Destructor Documentation

◆ QgsProxyFeatureSink()

QgsProxyFeatureSink::QgsProxyFeatureSink ( QgsFeatureSink sink)

Constructs a new QgsProxyFeatureSink which forwards features onto a destination sink.

Definition at line 21 of file qgsproxyfeaturesink.cpp.

Member Function Documentation

◆ addFeature()

bool QgsProxyFeatureSink::addFeature ( QgsFeature feature,
QgsFeatureSink::Flags  flags = QgsFeatureSink::Flags() 
)
inlineoverridevirtual

Adds a single feature to the sink.

Feature addition behavior is controlled by the specified flags.

See also
addFeatures()
Returns
true in case of success and false in case of failure

Reimplemented from QgsFeatureSink.

Reimplemented in QgsProcessingFeatureSink.

Definition at line 47 of file qgsproxyfeaturesink.h.

◆ addFeatures() [1/2]

bool QgsProxyFeatureSink::addFeatures ( QgsFeatureIterator iterator,
QgsFeatureSink::Flags  flags = QgsFeatureSink::Flags() 
)
inlineoverridevirtual

Adds all features from the specified iterator to the sink.

Feature addition behavior is controlled by the specified flags.

Returns
true if all features were added successfully, or false if any feature could not be added

Reimplemented from QgsFeatureSink.

Reimplemented in QgsProcessingFeatureSink.

Definition at line 49 of file qgsproxyfeaturesink.h.

◆ addFeatures() [2/2]

bool QgsProxyFeatureSink::addFeatures ( QgsFeatureList features,
QgsFeatureSink::Flags  flags = QgsFeatureSink::Flags() 
)
inlineoverridevirtual

Adds a list of features to the sink.

Feature addition behavior is controlled by the specified flags.

See also
addFeature()
Returns
true in case of success and false in case of failure

Implements QgsFeatureSink.

Reimplemented in QgsProcessingFeatureSink.

Definition at line 48 of file qgsproxyfeaturesink.h.

◆ destinationSink()

QgsFeatureSink * QgsProxyFeatureSink::destinationSink ( )
inline

Returns the destination QgsFeatureSink which the proxy will forward features to.

Definition at line 55 of file qgsproxyfeaturesink.h.

◆ lastError()

QString QgsProxyFeatureSink::lastError ( ) const
inlineoverridevirtual

Returns the most recent error encountered by the sink, e.g.

when a call to addFeatures() returns false.

Since
QGIS 3.16

Reimplemented from QgsFeatureSink.

Definition at line 50 of file qgsproxyfeaturesink.h.


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