QGIS API Documentation 3.41.0-Master (af5edcb665c)
|
A simple feature sink which proxies feature addition on to another feature sink. More...
#include <qgsproxyfeaturesink.h>
Public Member Functions | |
QgsProxyFeatureSink (QgsFeatureSink *sink) | |
Constructs a new QgsProxyFeatureSink which forwards features onto a destination sink. | |
bool | addFeature (QgsFeature &feature, QgsFeatureSink::Flags flags=QgsFeatureSink::Flags()) override |
Adds a single feature to the sink. | |
bool | addFeatures (QgsFeatureIterator &iterator, QgsFeatureSink::Flags flags=QgsFeatureSink::Flags()) override |
Adds all features from the specified iterator to the sink. | |
bool | addFeatures (QgsFeatureList &features, QgsFeatureSink::Flags flags=QgsFeatureSink::Flags()) override |
Adds a list of features to the sink. | |
QgsFeatureSink * | destinationSink () |
Returns the destination QgsFeatureSink which the proxy will forward features to. | |
void | finalize () override |
Finalizes the sink, flushing any buffered features to the destination. | |
bool | flushBuffer () override |
Flushes any internal buffer which may exist in the sink, causing any buffered features to be added to the sink's destination. | |
QString | lastError () const override |
Returns the most recent error encountered by the sink, e.g. | |
Public Member Functions inherited from QgsFeatureSink | |
virtual | ~QgsFeatureSink ()=default |
Protected Attributes | |
QgsFeatureSink * | mSink = nullptr |
Underlying destination sink. | |
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... | |
typedef QFlags< Flag > | Flags |
enum | SinkFlag { RegeneratePrimaryKey = 1 << 1 } |
Flags that can be set on a QgsFeatureSink. More... | |
typedef QFlags< SinkFlag > | SinkFlags |
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.
Definition at line 38 of file qgsproxyfeaturesink.h.
QgsProxyFeatureSink::QgsProxyFeatureSink | ( | QgsFeatureSink * | sink | ) |
Constructs a new QgsProxyFeatureSink which forwards features onto a destination sink.
Definition at line 21 of file qgsproxyfeaturesink.cpp.
|
overridevirtual |
Adds a single feature to the sink.
Feature addition behavior is controlled by the specified flags.
true
in case of success and false
in case of failure Reimplemented from QgsFeatureSink.
Definition at line 25 of file qgsproxyfeaturesink.cpp.
|
overridevirtual |
Adds all features from the specified iterator to the sink.
Feature addition behavior is controlled by the specified flags.
true
if all features were added successfully, or false
if any feature could not be added Reimplemented from QgsFeatureSink.
Definition at line 41 of file qgsproxyfeaturesink.cpp.
|
overridevirtual |
Adds a list of features to the sink.
Feature addition behavior is controlled by the specified flags.
true
in case of success and false
in case of failure Implements QgsFeatureSink.
Definition at line 33 of file qgsproxyfeaturesink.cpp.
|
inline |
Returns the destination QgsFeatureSink which the proxy will forward features to.
Definition at line 56 of file qgsproxyfeaturesink.h.
|
overridevirtual |
Finalizes the sink, flushing any buffered features to the destination.
Reimplemented from QgsFeatureSink.
Definition at line 62 of file qgsproxyfeaturesink.cpp.
|
overridevirtual |
Flushes any internal buffer which may exist in the sink, causing any buffered features to be added to the sink's destination.
false
if any buffered features could not be added to the sink. Reimplemented from QgsFeatureSink.
Definition at line 54 of file qgsproxyfeaturesink.cpp.
|
overridevirtual |
Returns the most recent error encountered by the sink, e.g.
when a call to addFeatures() returns false
.
Reimplemented from QgsFeatureSink.
Definition at line 49 of file qgsproxyfeaturesink.cpp.
|
protected |
Underlying destination sink.
Definition at line 61 of file qgsproxyfeaturesink.h.