Skip to content

Commit 3633363

Browse files
committed
Add a QgsFeatureSink interface for classes which accept adding features
1 parent 13b4472 commit 3633363

File tree

4 files changed

+103
-0
lines changed

4 files changed

+103
-0
lines changed

python/core/core.sip

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@
5656
%Include qgsfeaturefilterprovider.sip
5757
%Include qgsfeatureiterator.sip
5858
%Include qgsfeaturerequest.sip
59+
%Include qgsfeaturesink.sip
5960
%Include qgsfeedback.sip
6061
%Include qgsfield.sip
6162
%Include qgsfieldconstraints.sip

python/core/qgsfeaturesink.sip

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
/************************************************************************
2+
* This file has been generated automatically from *
3+
* *
4+
* src/core/qgsfeaturesink.h *
5+
* *
6+
* Do not edit manually ! Edit header and run scripts/sipify.pl again *
7+
************************************************************************/
8+
9+
10+
11+
12+
class QgsFeatureSink
13+
{
14+
%Docstring
15+
An interface for objects which accept features via addFeature(s) methods.
16+
17+
.. versionadded:: 3.0
18+
%End
19+
20+
%TypeHeaderCode
21+
#include "qgsfeaturesink.h"
22+
%End
23+
public:
24+
25+
virtual ~QgsFeatureSink();
26+
27+
virtual bool addFeature( QgsFeature &feature ) = 0;
28+
%Docstring
29+
Adds a single ``feature`` to the sink.
30+
\see addFeatures()
31+
:rtype: bool
32+
%End
33+
34+
virtual bool addFeatures( QgsFeatureList &features ) = 0;
35+
%Docstring
36+
Adds a list of ``features`` to the sink.
37+
\see addFeature()
38+
:rtype: bool
39+
%End
40+
41+
};
42+
43+
/************************************************************************
44+
* This file has been generated automatically from *
45+
* *
46+
* src/core/qgsfeaturesink.h *
47+
* *
48+
* Do not edit manually ! Edit header and run scripts/sipify.pl again *
49+
************************************************************************/

src/core/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -720,6 +720,7 @@ SET(QGIS_CORE_HDRS
720720
qgsfeaturefilterprovider.h
721721
qgsfeatureiterator.h
722722
qgsfeaturerequest.h
723+
qgsfeaturesink.h
723724
qgsfeaturestore.h
724725
qgsfieldformatter.h
725726
qgsfield_p.h

src/core/qgsfeaturesink.h

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
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.h"
23+
#include "qgsfeature.h"
24+
25+
/**
26+
* \class QgsFeatureSink
27+
* \ingroup core
28+
* An interface for objects which accept features via addFeature(s) methods.
29+
*
30+
* \since QGIS 3.0
31+
*/
32+
class CORE_EXPORT QgsFeatureSink
33+
{
34+
public:
35+
36+
virtual ~QgsFeatureSink() = default;
37+
38+
/**
39+
* Adds a single \a feature to the sink.
40+
* \see addFeatures()
41+
*/
42+
virtual bool addFeature( QgsFeature &feature ) = 0;
43+
44+
/**
45+
* Adds a list of \a features to the sink.
46+
* \see addFeature()
47+
*/
48+
virtual bool addFeatures( QgsFeatureList &features ) = 0;
49+
50+
};
51+
52+
#endif // QGSFEATURESINK_H

0 commit comments

Comments
 (0)