QgsProcessingFeatureSink class

QgsProxyFeatureSink subclass which reports feature addition errors to a QgsProcessingContext.

Base classes

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

Constructors, destructors, conversion operators

QgsProcessingFeatureSink(QgsFeatureSink* originalSink, const QString& sinkName, QgsProcessingContext& context, bool ownsOriginalSink = false)
Constructor for QgsProcessingFeatureSink, accepting an original feature sink originalSink and processing context.

Public functions

auto addFeature(QgsFeature& feature, QgsFeatureSink::Flags flags = nullptr) -> bool override
Adds a single feature to the sink.
auto addFeatures(QgsFeatureList& features, QgsFeatureSink::Flags flags = nullptr) -> bool override
Adds a list of features to the sink.
auto addFeatures(QgsFeatureIterator& iterator, QgsFeatureSink::Flags flags = nullptr) -> bool override
Adds all features from the specified iterator to the sink.

Function documentation

QgsProcessingFeatureSink::QgsProcessingFeatureSink(QgsFeatureSink* originalSink, const QString& sinkName, QgsProcessingContext& context, bool ownsOriginalSink = false)

Constructor for QgsProcessingFeatureSink, accepting an original feature sink originalSink and processing context.

Any added features are added to the originalSink, with feature writing errors being reports to context.

The context must exist for the lifetime of this object.

The sinkName is used to identify the destination sink when reporting errors.

Ownership of originalSink is dictated by ownsOriginalSource. If ownsOriginalSink is false, ownership is not transferred, and callers must ensure that originalSink exists for the lifetime of this object. If ownsOriginalSink is true, then this object will take ownership of originalSink.

bool QgsProcessingFeatureSink::addFeature(QgsFeature& feature, QgsFeatureSink::Flags flags = nullptr) override

Adds a single feature to the sink.

Returns true in case of success and false in case of failure

Feature addition behavior is controlled by the specified flags.

bool QgsProcessingFeatureSink::addFeatures(QgsFeatureList& features, QgsFeatureSink::Flags flags = nullptr) override

Adds a list of features to the sink.

Returns true in case of success and false in case of failure

Feature addition behavior is controlled by the specified flags.

bool QgsProcessingFeatureSink::addFeatures(QgsFeatureIterator& iterator, QgsFeatureSink::Flags flags = nullptr) override

Adds all features from the specified iterator to the sink.

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

Feature addition behavior is controlled by the specified flags.