Merge pull request #4797 from nyalldawson/flush_sink

Move flushBuffer method up to QgsFeatureSink
This commit is contained in:
Nyall Dawson 2017-06-30 09:57:06 +10:00 committed by GitHub
commit fe800e25a5
4 changed files with 14 additions and 11 deletions

View File

@ -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<QgsFeatureSink::Flag> operator|(QgsFeatureSink::Flag f1, QFlags<QgsFeatureSink::Flag> f2);

View File

@ -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 );

View File

@ -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 )

View File

@ -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: