Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Code shuffle to move QgsProxyFeatureSink to its own file
- Loading branch information
1 parent
70bbfca
commit c987e50
Showing
9 changed files
with
151 additions
and
75 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
/************************************************************************ | ||
* This file has been generated automatically from * | ||
* * | ||
* src/core/qgsproxyfeaturesink.h * | ||
* * | ||
* Do not edit manually ! Edit header and run scripts/sipify.pl again * | ||
************************************************************************/ | ||
|
||
|
||
|
||
|
||
|
||
class QgsProxyFeatureSink : QgsFeatureSink | ||
{ | ||
%Docstring | ||
A simple feature sink which proxies feature addition on to another feature sink. | ||
|
||
This class is designed to allow factory methods which always return new QgsFeatureSink | ||
objects. Since it is not always possible to create an entirely new QgsFeatureSink | ||
(e.g. if the feature sink is a layer's data provider), a new QgsProxyFeatureSink | ||
can instead be returned which forwards features on to the destination sink. The | ||
proxy sink can be safely deleted without affecting the destination sink. | ||
|
||
.. versionadded:: 3.0 | ||
%End | ||
|
||
%TypeHeaderCode | ||
#include "qgsproxyfeaturesink.h" | ||
%End | ||
public: | ||
|
||
QgsProxyFeatureSink( QgsFeatureSink *sink ); | ||
%Docstring | ||
Constructs a new QgsProxyFeatureSink which forwards features onto a destination ``sink``. | ||
%End | ||
virtual bool addFeature( QgsFeature &feature, QgsFeatureSink::Flags flags = 0 ); | ||
virtual bool addFeatures( QgsFeatureList &features, QgsFeatureSink::Flags flags = 0 ); | ||
virtual bool addFeatures( QgsFeatureIterator &iterator, QgsFeatureSink::Flags flags = 0 ); | ||
|
||
QgsFeatureSink *destinationSink(); | ||
%Docstring | ||
Returns the destination QgsFeatureSink which the proxy will forward features to. | ||
%End | ||
|
||
}; | ||
|
||
|
||
|
||
|
||
|
||
|
||
/************************************************************************ | ||
* This file has been generated automatically from * | ||
* * | ||
* src/core/qgsproxyfeaturesink.h * | ||
* * | ||
* Do not edit manually ! Edit header and run scripts/sipify.pl again * | ||
************************************************************************/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
/*************************************************************************** | ||
qgsproxyfeaturesink.cpp | ||
---------------------- | ||
begin : April 2020 | ||
copyright : (C) 2020 by Nyall Dawson | ||
email : nyall dot dawson at gmail dot com | ||
***************************************************************************/ | ||
|
||
/*************************************************************************** | ||
* * | ||
* This program is free software; you can redistribute it and/or modify * | ||
* it under the terms of the GNU General Public License as published by * | ||
* the Free Software Foundation; either version 2 of the License, or * | ||
* (at your option) any later version. * | ||
* * | ||
***************************************************************************/ | ||
|
||
#include "qgsproxyfeaturesink.h" | ||
|
||
|
||
QgsProxyFeatureSink::QgsProxyFeatureSink( QgsFeatureSink *sink ) | ||
: mSink( sink ) | ||
{} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
/*************************************************************************** | ||
qgsproxyfeaturesink.h | ||
---------------------- | ||
begin : April 2020 | ||
copyright : (C) 2020 by Nyall Dawson | ||
email : nyall dot dawson at gmail dot com | ||
***************************************************************************/ | ||
|
||
/*************************************************************************** | ||
* * | ||
* This program is free software; you can redistribute it and/or modify * | ||
* it under the terms of the GNU General Public License as published by * | ||
* the Free Software Foundation; either version 2 of the License, or * | ||
* (at your option) any later version. * | ||
* * | ||
***************************************************************************/ | ||
|
||
#ifndef QGSPROXYFEATURESINK_H | ||
#define QGSPROXYFEATURESINK_H | ||
|
||
#include "qgis_core.h" | ||
#include "qgis.h" | ||
#include "qgsfeaturesink.h" | ||
|
||
|
||
/** | ||
* \class QgsProxyFeatureSink | ||
* \ingroup core | ||
* A simple feature sink which proxies feature addition on to another feature sink. | ||
* | ||
* This class is designed to allow factory methods which always return new QgsFeatureSink | ||
* objects. Since it is not always possible to create an entirely new QgsFeatureSink | ||
* (e.g. if the feature sink is a layer's data provider), a new QgsProxyFeatureSink | ||
* can instead be returned which forwards features on to the destination sink. The | ||
* proxy sink can be safely deleted without affecting the destination sink. | ||
* | ||
* \since QGIS 3.0 | ||
*/ | ||
class CORE_EXPORT QgsProxyFeatureSink : public QgsFeatureSink | ||
{ | ||
public: | ||
|
||
/** | ||
* Constructs a new QgsProxyFeatureSink which forwards features onto a destination \a sink. | ||
*/ | ||
QgsProxyFeatureSink( QgsFeatureSink *sink ); | ||
bool addFeature( QgsFeature &feature, QgsFeatureSink::Flags flags = nullptr ) override { return mSink->addFeature( feature, flags ); } | ||
bool addFeatures( QgsFeatureList &features, QgsFeatureSink::Flags flags = nullptr ) override { return mSink->addFeatures( features, flags ); } | ||
bool addFeatures( QgsFeatureIterator &iterator, QgsFeatureSink::Flags flags = nullptr ) override { return mSink->addFeatures( iterator, flags ); } | ||
|
||
/** | ||
* Returns the destination QgsFeatureSink which the proxy will forward features to. | ||
*/ | ||
QgsFeatureSink *destinationSink() { return mSink; } | ||
|
||
private: | ||
|
||
QgsFeatureSink *mSink = nullptr; | ||
}; | ||
|
||
|
||
#endif // QGSPROXYFEATURESINK_H | ||
|
||
|
||
|
||
|