Skip to content

Commit 1bafa80

Browse files
committedJul 14, 2016
Const correctness for numerous data provider methods
1 parent fd42ed3 commit 1bafa80

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

44 files changed

+375
-555
lines changed
 

‎doc/api_break.dox

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,21 @@ This page tries to maintain a list with incompatible changes that happened in pr
1818

1919
\section qgis_api_break_3_0 QGIS 3.0
2020

21+
\subsection qgis_api_break_3_0_DataProviders Data Providers
22+
23+
<ul>
24+
<li>Many methods in QgsDataProvider, QgsVectorDataProvider and QgsRasterDataProvider have been made const-correct.
25+
This has no effect on PyQGIS code, but c++ code implementing third-party providers will need to update the
26+
signatures of these methods to match. Affected methods are:
27+
<ul>
28+
<li>QgsDataProvider: crs(), extent(), isValid(), supportsSubsetString(), subsetString()</li>
29+
<li>QgsVectorDataProvider: getFeatures(), minimumValue(), maximumValue(), uniqueValues(), enumValues(), defaultValue(),
30+
attributeIndexes(), pkAttributeIndexes(), isSaveAndLoadStyleToDBSupported()</li>
31+
<li>QgsRasterInterface: extent()</li>
32+
</ul
33+
</li>
34+
</ul>
35+
2136
\subsection qgis_api_break_3_0_QgsVectorFileWriter QgsVectorFileWriter
2237

2338
<ul>

‎python/core/qgsdataprovider.sip

Lines changed: 12 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -54,12 +54,11 @@ class QgsDataProvider : QObject
5454
virtual ~QgsDataProvider();
5555

5656

57-
/** Get the QgsCoordinateReferenceSystem for this layer
58-
* @note Must be reimplemented by each provider.
59-
* If the provider isn't capable of returning
60-
* its projection an empty srs will be return, ti will return 0
57+
/* Returns the coordinate system for the data source.
58+
* If the provider isn't capable of returning its projection then an invalid
59+
* QgsCoordinateReferenceSystem will be returned.
6160
*/
62-
virtual QgsCoordinateReferenceSystem crs() = 0;
61+
virtual QgsCoordinateReferenceSystem crs() const = 0;
6362

6463

6564
/**
@@ -82,21 +81,21 @@ class QgsDataProvider : QObject
8281

8382

8483
/**
85-
* Get the extent of the layer
84+
* Returns the extent of the layer.
8685
* @return QgsRectangle containing the extent of the layer
8786
*/
88-
virtual QgsRectangle extent() = 0;
87+
virtual QgsRectangle extent() const = 0;
8988

9089

9190
/**
9291
* Returns true if this is a valid layer. It is up to individual providers
93-
* to determine what constitutes a valid layer
92+
* to determine what constitutes a valid layer.
9493
*/
95-
virtual bool isValid() = 0;
94+
virtual bool isValid() const = 0;
9695

9796

9897
/**
99-
* Update the extents of the layer. Not implemented by default
98+
* Update the extents of the layer. Not implemented by default.
10099
*/
101100
virtual void updateExtents();
102101

@@ -109,16 +108,16 @@ class QgsDataProvider : QObject
109108
*/
110109
virtual bool setSubsetString( const QString& subset, bool updateFeatureCount = true );
111110

112-
/** Provider supports setting of subset strings */
113-
virtual bool supportsSubsetString();
111+
/** Returns true if the provider supports setting of subset strings. */
112+
virtual bool supportsSubsetString() const;
114113

115114
/**
116115
* Returns the subset definition string (typically sql) currently in
117116
* use by the layer and used by the provider to limit the feature set.
118117
* Must be overridden in the dataprovider, otherwise returns a null
119118
* QString.
120119
*/
121-
virtual QString subsetString();
120+
virtual QString subsetString() const;
122121

123122

124123
/**

0 commit comments

Comments
 (0)
Please sign in to comment.