Skip to content

Commit 04a9264

Browse files
committed
Sipify core.QgsFeatureIterator
1 parent 05933b1 commit 04a9264

File tree

3 files changed

+196
-71
lines changed

3 files changed

+196
-71
lines changed

python/auto_sip.blacklist

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ core/qgseditorwidgetsetup.sip
99
core/qgserror.sip
1010
core/qgsexpressioncontext.sip
1111
core/qgsexpressioncontextgenerator.sip
12-
core/qgsfeatureiterator.sip
1312
core/qgsfeaturerequest.sip
1413
core/qgsgeometrysimplifier.sip
1514
core/qgsgeometryvalidator.sip

python/core/qgsfeatureiterator.sip

Lines changed: 149 additions & 66 deletions
Original file line numberDiff line numberDiff line change
@@ -1,125 +1,208 @@
1+
/************************************************************************
2+
* This file has been generated automatically from *
3+
* *
4+
* src/core/qgsfeatureiterator.h *
5+
* *
6+
* Do not edit manually ! Edit header and run scripts/sipify.pl again *
7+
************************************************************************/
8+
9+
10+
111
class QgsAbstractFeatureIterator
212
{
13+
%Docstring
14+
Internal feature iterator to be implemented within data providers
15+
%End
16+
317
%TypeHeaderCode
4-
#include <qgsfeatureiterator.h>
18+
#include "qgsfeatureiterator.h"
519
%End
620
public:
721

8-
//! Status of expression compilation for filter expression requests
922
enum CompileStatus
1023
{
11-
NoCompilation, /*!< Expression could not be compiled or not attempt was made to compile expression */
12-
PartiallyCompiled, /*!< Expression was partially compiled, but extra checks need to be applied to features*/
13-
Compiled, /*!< Expression was fully compiled and delegated to data provider source*/
24+
NoCompilation,
25+
PartiallyCompiled,
26+
Compiled,
1427
};
1528

16-
//! base class constructor - stores the iteration parameters
1729
QgsAbstractFeatureIterator( const QgsFeatureRequest &request );
30+
%Docstring
31+
base class constructor - stores the iteration parameters
32+
%End
1833

19-
//! destructor makes sure that the iterator is closed properly
2034
virtual ~QgsAbstractFeatureIterator();
35+
%Docstring
36+
destructor makes sure that the iterator is closed properly
37+
%End
2138

22-
//! fetch next feature, return true on success
2339
virtual bool nextFeature( QgsFeature &f );
40+
%Docstring
41+
fetch next feature, return true on success
42+
:rtype: bool
43+
%End
2444

25-
//! reset the iterator to the starting position
2645
virtual bool rewind() = 0;
27-
//! end of iterating: free the resources / lock
46+
%Docstring
47+
reset the iterator to the starting position
48+
:rtype: bool
49+
%End
2850
virtual bool close() = 0;
51+
%Docstring
52+
end of iterating: free the resources / lock
53+
:rtype: bool
54+
%End
55+
2956

30-
/** Returns the status of expression compilation for filter expression requests.
31-
* @note added in QGIS 2.16
32-
*/
3357
CompileStatus compileStatus() const;
58+
%Docstring
59+
Returns the status of expression compilation for filter expression requests.
60+
.. versionadded:: 2.16
61+
:rtype: CompileStatus
62+
%End
3463

3564
protected:
36-
/**
37-
* If you write a feature iterator for your provider, this is the method you
38-
* need to implement!!
39-
*
40-
* @param f The feature to write to
41-
* @return true if a feature was written to f
42-
*/
65+
4366
virtual bool fetchFeature( QgsFeature &f ) = 0;
67+
%Docstring
68+
If you write a feature iterator for your provider, this is the method you
69+
need to implement!!
70+
71+
\param f The feature to write to
72+
:return: true if a feature was written to f
73+
:rtype: bool
74+
%End
4475

45-
/**
46-
* By default, the iterator will fetch all features and check if the feature
47-
* matches the expression.
48-
* If you have a more sophisticated metodology (SQL request for the features...)
49-
* and you check for the expression in your fetchFeature method, you can just
50-
* redirect this call to fetchFeature so the default check will be omitted.
51-
*
52-
* @param f The feature to write to
53-
* @return true if a feature was written to f
54-
*/
5576
virtual bool nextFeatureFilterExpression( QgsFeature &f );
77+
%Docstring
78+
By default, the iterator will fetch all features and check if the feature
79+
matches the expression.
80+
If you have a more sophisticated metodology (SQL request for the features...)
81+
and you check for the expression in your fetchFeature method, you can just
82+
redirect this call to fetchFeature so the default check will be omitted.
83+
84+
\param f The feature to write to
85+
:return: true if a feature was written to f
86+
:rtype: bool
87+
%End
5688

57-
/**
58-
* By default, the iterator will fetch all features and check if the id
59-
* is in the request.
60-
* If you have a more sophisticated metodology (SQL request for the features...)
61-
* and you are sure, that any feature you return from fetchFeature will match
62-
* if the request was FilterFids you can just redirect this call to fetchFeature
63-
* so the default check will be omitted.
64-
*
65-
* @param f The feature to write to
66-
* @return true if a feature was written to f
67-
*/
6889
virtual bool nextFeatureFilterFids( QgsFeature &f );
90+
%Docstring
91+
By default, the iterator will fetch all features and check if the id
92+
is in the request.
93+
If you have a more sophisticated metodology (SQL request for the features...)
94+
and you are sure, that any feature you return from fetchFeature will match
95+
if the request was FilterFids you can just redirect this call to fetchFeature
96+
so the default check will be omitted.
97+
98+
\param f The feature to write to
99+
:return: true if a feature was written to f
100+
:rtype: bool
101+
%End
102+
103+
104+
105+
106+
void ref();
107+
%Docstring
108+
Add reference
109+
%End
110+
void deref();
111+
%Docstring
112+
Remove reference, delete if refs == 0
113+
%End
114+
69115

70-
void ref(); //!< add reference
71-
void deref(); //!< remove reference, delete if refs == 0
72116

73-
//! Setup the simplification of geometries to fetch using the specified simplify method
74117
virtual bool prepareSimplification( const QgsSimplifyMethod &simplifyMethod );
118+
%Docstring
119+
Setup the simplification of geometries to fetch using the specified simplify method
120+
:rtype: bool
121+
%End
122+
75123
};
76124

77125

78126
class QgsFeatureIterator
79127
{
80-
%TypeHeaderCode
81-
#include <qgsfeatureiterator.h>
128+
%Docstring
129+
Wrapper for iterator of features from vector data provider or vector layer
82130
%End
83131

132+
%TypeHeaderCode
133+
#include "qgsfeatureiterator.h"
134+
%End
84135
public:
136+
85137
QgsFeatureIterator *__iter__();
138+
%Docstring
139+
:rtype: QgsFeatureIterator
140+
%End
86141
%MethodCode
87-
sipRes = sipCpp;
142+
sipRes = sipCpp;
88143
%End
89144

90-
SIP_PYOBJECT __next__();
145+
SIP_PYOBJECT __next__();
91146
%MethodCode
92-
QgsFeature *f = new QgsFeature;
93-
if (sipCpp->nextFeature(*f))
94-
sipRes = sipConvertFromType(f, sipType_QgsFeature, Py_None);
95-
else
96-
{
97-
delete f;
98-
PyErr_SetString(PyExc_StopIteration,"");
99-
}
147+
QgsFeature *f = new QgsFeature;
148+
if ( sipCpp->nextFeature( *f ) )
149+
sipRes = sipConvertFromType( f, sipType_QgsFeature, Py_None );
150+
else
151+
{
152+
delete f;
153+
PyErr_SetString( PyExc_StopIteration, "" );
154+
}
100155
%End
101156

102-
//! construct invalid iterator
103157
QgsFeatureIterator();
104-
//! construct a valid iterator
105-
// QgsFeatureIterator( QgsAbstractFeatureIterator *iter );
106-
//! copy constructor copies the iterator, increases ref.count
158+
%Docstring
159+
construct invalid iterator
160+
%End
107161
QgsFeatureIterator( const QgsFeatureIterator &fi );
108-
//! destructor deletes the iterator if it has no more references
162+
%Docstring
163+
copy constructor copies the iterator, increases ref.count
164+
%End
109165
~QgsFeatureIterator();
166+
%Docstring
167+
destructor deletes the iterator if it has no more references
168+
%End
110169

111-
// QgsFeatureIterator &operator=(const QgsFeatureIterator &other);
112170

113171
bool nextFeature( QgsFeature &f );
172+
%Docstring
173+
:rtype: bool
174+
%End
114175
bool rewind();
176+
%Docstring
177+
:rtype: bool
178+
%End
115179
bool close();
180+
%Docstring
181+
:rtype: bool
182+
%End
116183

117-
//! find out whether the iterator is still valid or closed already
118184
bool isClosed() const;
185+
%Docstring
186+
find out whether the iterator is still valid or closed already
187+
:rtype: bool
188+
%End
189+
119190

120-
/** Returns the status of expression compilation for filter expression requests.
121-
* @note added in QGIS 2.16
122-
*/
123191
QgsAbstractFeatureIterator::CompileStatus compileStatus() const;
192+
%Docstring
193+
Returns the status of expression compilation for filter expression requests.
194+
.. versionadded:: 2.16
195+
:rtype: QgsAbstractFeatureIterator.CompileStatus
196+
%End
197+
124198

125199
};
200+
201+
202+
/************************************************************************
203+
* This file has been generated automatically from *
204+
* *
205+
* src/core/qgsfeatureiterator.h *
206+
* *
207+
* Do not edit manually ! Edit header and run scripts/sipify.pl again *
208+
************************************************************************/

0 commit comments

Comments
 (0)