diff --git a/python/core/qgsfeaturesink.sip b/python/core/qgsfeaturesink.sip index c65c02f1a85..7e240a1fe01 100644 --- a/python/core/qgsfeaturesink.sip +++ b/python/core/qgsfeaturesink.sip @@ -55,6 +55,12 @@ class QgsFeatureSink :rtype: bool %End + virtual bool flushBuffer(); +%Docstring + Flushes any internal buffer which may exist in the sink, causing any buffered features to be added to the sink's destination. + :return: false if any buffered features could not be added to the sink. + :rtype: bool +%End }; QFlags operator|(QgsFeatureSink::Flag f1, QFlags f2); diff --git a/python/core/qgsvectorlayerexporter.sip b/python/core/qgsvectorlayerexporter.sip index 7831494cbed..26822d66818 100644 --- a/python/core/qgsvectorlayerexporter.sip +++ b/python/core/qgsvectorlayerexporter.sip @@ -124,12 +124,8 @@ class QgsVectorLayerExporter : QgsFeatureSink Finalizes the export and closes the new created layer. %End - bool flushBuffer(); -%Docstring - Flush the buffer writing the features to the new layer. -.. versionadded:: 3.0 - :rtype: bool -%End + virtual bool flushBuffer(); + private: QgsVectorLayerExporter( const QgsVectorLayerExporter &rh ); diff --git a/src/core/qgsfeaturesink.h b/src/core/qgsfeaturesink.h index e97d81c4779..a71029c23ad 100644 --- a/src/core/qgsfeaturesink.h +++ b/src/core/qgsfeaturesink.h @@ -71,6 +71,11 @@ class CORE_EXPORT QgsFeatureSink */ virtual bool addFeatures( QgsFeatureIterator &iterator, QgsFeatureSink::Flags flags = 0 ); + /** + * Flushes any internal buffer which may exist in the sink, causing any buffered features to be added to the sink's destination. + * \returns false if any buffered features could not be added to the sink. + */ + virtual bool flushBuffer() { return true; } }; Q_DECLARE_OPERATORS_FOR_FLAGS( QgsFeatureSink::Flags ) diff --git a/src/core/qgsvectorlayerexporter.h b/src/core/qgsvectorlayerexporter.h index 6462ae083e2..9e3e6eb74e0 100644 --- a/src/core/qgsvectorlayerexporter.h +++ b/src/core/qgsvectorlayerexporter.h @@ -141,11 +141,7 @@ class CORE_EXPORT QgsVectorLayerExporter : public QgsFeatureSink */ ~QgsVectorLayerExporter(); - /** - * Flush the buffer writing the features to the new layer. - * \since QGIS 3.0 - */ - bool flushBuffer(); + bool flushBuffer() override; private: