QGIS API Documentation 3.99.0-Master (2fe06baccd8)
Loading...
Searching...
No Matches
qgsfeaturesink.h
Go to the documentation of this file.
1/***************************************************************************
2 qgsfeaturesink.h
3 ----------------
4 begin : April 2017
5 copyright : (C) 2017 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 QGSFEATURESINK_H
19#define QGSFEATURESINK_H
20
21#include "qgis_core.h"
22#include "qgis_sip.h"
23#include "qgsfeature.h"
24#include "qgsfeatureiterator.h"
25
32class CORE_EXPORT QgsFeatureSink
33{
34 public:
35
42 {
43
55 };
56 Q_DECLARE_FLAGS( SinkFlags, SinkFlag )
57
58
59 enum Flag SIP_ENUM_BASETYPE( IntFlag )
60 {
61
69 FastInsert = 1 << 1,
70
78 };
79 Q_DECLARE_FLAGS( Flags, Flag )
80
81 virtual ~QgsFeatureSink() = default;
82
88 virtual void finalize();
89
95 virtual bool addFeature( QgsFeature &feature, QgsFeatureSink::Flags flags = QgsFeatureSink::Flags() );
96
102 virtual bool addFeatures( QgsFeatureList &features, QgsFeatureSink::Flags flags = QgsFeatureSink::Flags() ) = 0;
103
108 virtual bool addFeatures( QgsFeatureIterator &iterator, QgsFeatureSink::Flags flags = QgsFeatureSink::Flags() );
109
114 virtual bool flushBuffer() { return true; }
115
121 virtual QString lastError() const { return QString(); }
122};
123
125
127
128#endif // QGSFEATURESINK_H
Wrapper for iterator of features from vector data provider or vector layer.
An interface for objects which accept features via addFeature(s) methods.
QFlags< SinkFlag > SinkFlags
virtual bool flushBuffer()
Flushes any internal buffer which may exist in the sink, causing any buffered features to be added to...
virtual bool addFeature(QgsFeature &feature, QgsFeatureSink::Flags flags=QgsFeatureSink::Flags())
Adds a single feature to the sink.
Flag
Flags controlling how features are added to a sink.
@ RollBackOnErrors
Roll back the whole transaction if a single add feature operation fails.
@ FastInsert
Use faster inserts, at the cost of updating the passed features to reflect changes made at the provid...
SinkFlag
Flags that can be set on a QgsFeatureSink.
@ RegeneratePrimaryKey
This flag indicates, that a primary key field cannot be guaranteed to be unique and the sink should i...
virtual QString lastError() const
Returns the most recent error encountered by the sink, e.g.
virtual bool addFeatures(QgsFeatureList &features, QgsFeatureSink::Flags flags=QgsFeatureSink::Flags())=0
Adds a list of features to the sink.
virtual void finalize()
Finalizes the sink, flushing any buffered features to the destination.
QFlags< Flag > Flags
The feature class encapsulates a single feature including its unique ID, geometry and a list of field...
Definition qgsfeature.h:58
#define SIP_ENUM_BASETYPE(type)
Definition qgis_sip.h:275
Q_DECLARE_METATYPE(QgsDatabaseQueryLogEntry)
QList< QgsFeature > QgsFeatureList
Q_DECLARE_OPERATORS_FOR_FLAGS(QgsProjectionSelectionWidget::CrsOptions)