Commit e252cc0 1 parent adf5eb7 commit e252cc0 Copy full SHA for e252cc0
File tree 3 files changed +52
-2
lines changed
python/core/auto_generated
3 files changed +52
-2
lines changed Original file line number Diff line number Diff line change @@ -66,6 +66,27 @@ if the feature count is unknown.
66
66
%Docstring
67
67
Returns the number of features contained in the source, or -1
68
68
if the feature count is unknown.
69
+ %End
70
+
71
+ virtual bool empty() const;
72
+ %Docstring
73
+ Determines if there are any features available in the source.
74
+
75
+ In case it is not known if there are features available, false is returned.
76
+ Use ``emptyUnknown()`` to determine if this value is reliable.
77
+
78
+ .. seealso:: :py:func:`QgsVectorDataProvider.empty`
79
+ information.
80
+
81
+ .. versionadded:: 3.2
82
+ %End
83
+
84
+ virtual bool emptyUnknown() const;
85
+ %Docstring
86
+ Returns true if the value returned by ``empty()`` may be wrong.
87
+ This depends on the dataprovider.
88
+
89
+ .. versionadded:: 3.2
69
90
%End
70
91
71
92
virtual QSet<QVariant> uniqueValues( int fieldIndex, int limit = -1 ) const;
@@ -139,7 +160,6 @@ for its ownership.
139
160
140
161
.. versionadded:: 3.0
141
162
%End
142
-
143
163
};
144
164
145
165
Original file line number Diff line number Diff line change 23
23
#include " qgsvectorlayer.h"
24
24
#include " qgsvectordataprovider.h"
25
25
26
+ bool QgsFeatureSource::empty () const
27
+ {
28
+ return featureCount ();
29
+ }
30
+
31
+ bool QgsFeatureSource::emptyUnknown () const
32
+ {
33
+ return featureCount () == -1 ;
34
+ }
35
+
26
36
QSet<QVariant> QgsFeatureSource::uniqueValues ( int fieldIndex, int limit ) const
27
37
{
28
38
if ( fieldIndex < 0 || fieldIndex >= fields ().count () )
Original file line number Diff line number Diff line change @@ -85,6 +85,27 @@ class CORE_EXPORT QgsFeatureSource
85
85
*/
86
86
virtual long featureCount () const = 0;
87
87
88
+ /* *
89
+ * Determines if there are any features available in the source.
90
+ *
91
+ * In case it is not known if there are features available, false is returned.
92
+ * Use ``emptyUnknown()`` to determine if this value is reliable.
93
+ *
94
+ * \see QgsVectorDataProvider::empty() for data provider specific
95
+ * information.
96
+ *
97
+ * \since QGIS 3.2
98
+ */
99
+ virtual bool empty () const ;
100
+
101
+ /* *
102
+ * Returns true if the value returned by ``empty()`` may be wrong.
103
+ * This depends on the dataprovider.
104
+ *
105
+ * \since QGIS 3.2
106
+ */
107
+ virtual bool emptyUnknown () const ;
108
+
88
109
/* *
89
110
* Returns the set of unique values contained within the specified \a fieldIndex from this source.
90
111
* If specified, the \a limit option can be used to limit the number of returned values.
@@ -150,7 +171,6 @@ class CORE_EXPORT QgsFeatureSource
150
171
*/
151
172
QgsVectorLayer *materialize ( const QgsFeatureRequest &request,
152
173
QgsFeedback *feedback = nullptr ) SIP_FACTORY;
153
-
154
174
};
155
175
156
176
Q_DECLARE_METATYPE ( QgsFeatureSource * )
You can’t perform that action at this time.
0 commit comments