QGIS API Documentation  3.16.0-Hannover (43b64b13f3)
qgsproxyfeaturesink.h
Go to the documentation of this file.
1 /***************************************************************************
2  qgsproxyfeaturesink.h
3  ----------------------
4  begin : April 2020
5  copyright : (C) 2020 by Nyall Dawson
6  email : nyall dot dawson at gmail dot com
7  ***************************************************************************/
8 
9 /***************************************************************************
10  * *
11  * This program is free software; you can redistribute it and/or modify *
12  * it under the terms of the GNU General Public License as published by *
13  * the Free Software Foundation; either version 2 of the License, or *
14  * (at your option) any later version. *
15  * *
16  ***************************************************************************/
17 
18 #ifndef QGSPROXYFEATURESINK_H
19 #define QGSPROXYFEATURESINK_H
20 
21 #include "qgis_core.h"
22 #include "qgis.h"
23 #include "qgsfeaturesink.h"
24 
25 
39 class CORE_EXPORT QgsProxyFeatureSink : public QgsFeatureSink
40 {
41  public:
42 
47  bool addFeature( QgsFeature &feature, QgsFeatureSink::Flags flags = QgsFeatureSink::Flags() ) override { return mSink->addFeature( feature, flags ); }
48  bool addFeatures( QgsFeatureList &features, QgsFeatureSink::Flags flags = QgsFeatureSink::Flags() ) override { return mSink->addFeatures( features, flags ); }
49  bool addFeatures( QgsFeatureIterator &iterator, QgsFeatureSink::Flags flags = QgsFeatureSink::Flags() ) override { return mSink->addFeatures( iterator, flags ); }
50  QString lastError() const override { return mSink->lastError(); }
51 
55  QgsFeatureSink *destinationSink() { return mSink; }
56 
57  private:
58 
59  QgsFeatureSink *mSink = nullptr;
60 };
61 
62 
63 #endif // QGSPROXYFEATURESINK_H
64 
65 
66 
67 
QgsProxyFeatureSink::destinationSink
QgsFeatureSink * destinationSink()
Returns the destination QgsFeatureSink which the proxy will forward features to.
Definition: qgsproxyfeaturesink.h:55
QgsProxyFeatureSink
A simple feature sink which proxies feature addition on to another feature sink.
Definition: qgsproxyfeaturesink.h:40
qgsfeaturesink.h
qgis.h
QgsProxyFeatureSink::addFeature
bool addFeature(QgsFeature &feature, QgsFeatureSink::Flags flags=QgsFeatureSink::Flags()) override
Adds a single feature to the sink.
Definition: qgsproxyfeaturesink.h:47
QgsProxyFeatureSink::lastError
QString lastError() const override
Returns the most recent error encountered by the sink, e.g.
Definition: qgsproxyfeaturesink.h:50
QgsProxyFeatureSink::addFeatures
bool addFeatures(QgsFeatureList &features, QgsFeatureSink::Flags flags=QgsFeatureSink::Flags()) override
Adds a list of features to the sink.
Definition: qgsproxyfeaturesink.h:48
QgsProxyFeatureSink::addFeatures
bool addFeatures(QgsFeatureIterator &iterator, QgsFeatureSink::Flags flags=QgsFeatureSink::Flags()) override
Adds all features from the specified iterator to the sink.
Definition: qgsproxyfeaturesink.h:49
QgsFeatureList
QList< QgsFeature > QgsFeatureList
Definition: qgsfeature.h:583
QgsFeature
The feature class encapsulates a single feature including its id, geometry and a list of field/values...
Definition: qgsfeature.h:56
QgsFeatureIterator
Wrapper for iterator of features from vector data provider or vector layer.
Definition: qgsfeatureiterator.h:265
QgsFeatureSink
An interface for objects which accept features via addFeature(s) methods.
Definition: qgsfeaturesink.h:34