QGIS API Documentation 3.40.0-Bratislava (b56115d8743)
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
54 RegeneratePrimaryKey = 1 << 1,
55 };
56 Q_DECLARE_FLAGS( SinkFlags, SinkFlag )
57
58
59 enum Flag SIP_ENUM_BASETYPE( IntFlag )
60 {
61
69 FastInsert = 1 << 1,
70
77 RollBackOnErrors = 1 << 2,
78 };
79 Q_DECLARE_FLAGS( Flags, Flag )
80
81 virtual ~QgsFeatureSink() = default;
82
88 virtual bool addFeature( QgsFeature &feature, QgsFeatureSink::Flags flags = QgsFeatureSink::Flags() );
89
95 virtual bool addFeatures( QgsFeatureList &features, QgsFeatureSink::Flags flags = QgsFeatureSink::Flags() ) = 0;
96
101 virtual bool addFeatures( QgsFeatureIterator &iterator, QgsFeatureSink::Flags flags = QgsFeatureSink::Flags() );
102
107 virtual bool flushBuffer() { return true; }
108
114 virtual QString lastError() const { return QString(); }
115};
116
118
120
121#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
Flag
Flags controlling how features are added to a sink.
SinkFlag
Flags that can be set on a QgsFeatureSink.
virtual QString lastError() const
Returns the most recent error encountered by the sink, e.g.
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:278
Q_DECLARE_METATYPE(QgsDatabaseQueryLogEntry)
QList< QgsFeature > QgsFeatureList
Q_DECLARE_OPERATORS_FOR_FLAGS(QgsTextRendererUtils::CurvedTextFlags)