QGIS API Documentation  3.0.2-Girona (307d082)
Public Types | Public Member Functions | List of all members
QgsFeatureSink Class Referenceabstract

An interface for objects which accept features via addFeature(s) methods. More...

#include <qgsfeaturesink.h>

Inheritance diagram for QgsFeatureSink:
Inheritance graph
[legend]

Public Types

enum  Flag { FastInsert = 1 << 1 }
 Flags controlling how features are added to a sink. More...
 

Public Member Functions

virtual ~QgsFeatureSink ()=default
 
virtual bool addFeature (QgsFeature &feature, QgsFeatureSink::Flags flags=nullptr)
 Adds a single feature to the sink. More...
 
virtual bool addFeatures (QgsFeatureList &features, QgsFeatureSink::Flags flags=nullptr)=0
 Adds a list of features to the sink. More...
 
virtual bool addFeatures (QgsFeatureIterator &iterator, QgsFeatureSink::Flags flags=nullptr)
 Adds all features from the specified iterator 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...
 

Detailed Description

An interface for objects which accept features via addFeature(s) methods.

Since
QGIS 3.0

Definition at line 33 of file qgsfeaturesink.h.

Member Enumeration Documentation

◆ Flag

Flags controlling how features are added to a sink.

Enumerator
FastInsert 

Use faster inserts, at the cost of updating the passed features to reflect changes made at the provider.

This includes skipping the update of the passed feature IDs to match the resulting feature IDs for the feature within the data provider. Individual sink subclasses may or may not choose to respect this flag, depending on whether or not skipping this update represents a significant speed boost for the operation.

Definition at line 38 of file qgsfeaturesink.h.

Constructor & Destructor Documentation

◆ ~QgsFeatureSink()

virtual QgsFeatureSink::~QgsFeatureSink ( )
virtualdefault

Member Function Documentation

◆ addFeature()

bool QgsFeatureSink::addFeature ( QgsFeature feature,
QgsFeatureSink::Flags  flags = nullptr 
)
virtual

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 in QgsVectorLayer, QgsVectorFileWriter, QgsProcessingFeatureSink, QgsVectorLayerExporter, QgsProxyFeatureSink, and QgsFeatureStore.

Definition at line 20 of file qgsfeaturesink.cpp.

◆ addFeatures() [1/2]

virtual bool QgsFeatureSink::addFeatures ( QgsFeatureList features,
QgsFeatureSink::Flags  flags = nullptr 
)
pure virtual

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

Implemented in QgsVectorLayer, QgsVectorFileWriter, QgsProcessingFeatureSink, QgsVectorDataProvider, QgsVectorLayerJoinBuffer, QgsVectorLayerExporter, QgsProxyFeatureSink, and QgsFeatureStore.

◆ addFeatures() [2/2]

bool QgsFeatureSink::addFeatures ( QgsFeatureIterator iterator,
QgsFeatureSink::Flags  flags = nullptr 
)
virtual

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 in QgsProcessingFeatureSink, and QgsProxyFeatureSink.

Definition at line 34 of file qgsfeaturesink.cpp.

◆ flushBuffer()

virtual bool QgsFeatureSink::flushBuffer ( )
inlinevirtual

Flushes any internal buffer which may exist in the sink, causing any buffered features to be added to the sink's destination.

Returns
false if any buffered features could not be added to the sink.

Reimplemented in QgsVectorLayerExporter.

Definition at line 78 of file qgsfeaturesink.h.


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