Skip to content

Commit fe800e2

Browse files
authored
Merge pull request #4797 from nyalldawson/flush_sink
Move flushBuffer method up to QgsFeatureSink
2 parents 7b1932a + bf3d55c commit fe800e2

File tree

4 files changed

+14
-11
lines changed

4 files changed

+14
-11
lines changed

python/core/qgsfeaturesink.sip

+6
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,12 @@ class QgsFeatureSink
5555
:rtype: bool
5656
%End
5757

58+
virtual bool flushBuffer();
59+
%Docstring
60+
Flushes any internal buffer which may exist in the sink, causing any buffered features to be added to the sink's destination.
61+
:return: false if any buffered features could not be added to the sink.
62+
:rtype: bool
63+
%End
5864
};
5965

6066
QFlags<QgsFeatureSink::Flag> operator|(QgsFeatureSink::Flag f1, QFlags<QgsFeatureSink::Flag> f2);

python/core/qgsvectorlayerexporter.sip

+2-6
Original file line numberDiff line numberDiff line change
@@ -124,12 +124,8 @@ class QgsVectorLayerExporter : QgsFeatureSink
124124
Finalizes the export and closes the new created layer.
125125
%End
126126

127-
bool flushBuffer();
128-
%Docstring
129-
Flush the buffer writing the features to the new layer.
130-
.. versionadded:: 3.0
131-
:rtype: bool
132-
%End
127+
virtual bool flushBuffer();
128+
133129

134130
private:
135131
QgsVectorLayerExporter( const QgsVectorLayerExporter &rh );

src/core/qgsfeaturesink.h

+5
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,11 @@ class CORE_EXPORT QgsFeatureSink
7171
*/
7272
virtual bool addFeatures( QgsFeatureIterator &iterator, QgsFeatureSink::Flags flags = 0 );
7373

74+
/**
75+
* Flushes any internal buffer which may exist in the sink, causing any buffered features to be added to the sink's destination.
76+
* \returns false if any buffered features could not be added to the sink.
77+
*/
78+
virtual bool flushBuffer() { return true; }
7479
};
7580

7681
Q_DECLARE_OPERATORS_FOR_FLAGS( QgsFeatureSink::Flags )

src/core/qgsvectorlayerexporter.h

+1-5
Original file line numberDiff line numberDiff line change
@@ -141,11 +141,7 @@ class CORE_EXPORT QgsVectorLayerExporter : public QgsFeatureSink
141141
*/
142142
~QgsVectorLayerExporter();
143143

144-
/**
145-
* Flush the buffer writing the features to the new layer.
146-
* \since QGIS 3.0
147-
*/
148-
bool flushBuffer();
144+
bool flushBuffer() override;
149145

150146
private:
151147

0 commit comments

Comments
 (0)