Skip to content

Commit 2f29e16

Browse files
committedOct 12, 2017
[Server][WFS] check const and indetation
1 parent 1558b03 commit 2f29e16

8 files changed

+85
-59
lines changed
 

‎src/server/qgsrequesthandler.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -251,12 +251,12 @@ void QgsRequestHandler::parseInput()
251251
if ( map.item( i ).isNull() )
252252
continue;
253253

254-
QDomNode attrNode = map.item( i );
255-
QDomAttr attr = attrNode.toAttr();
254+
const QDomNode attrNode = map.item( i );
255+
const QDomAttr attr = attrNode.toAttr();
256256
if ( attr.isNull() )
257257
continue;
258258

259-
QString attrName = attr.name();
259+
const QString attrName = attr.name();
260260
if ( attrName.startsWith( "xmlns" ) || attrName.startsWith( "xsi:" ) )
261261
continue;
262262

‎src/server/services/wfs/qgswfsgetcapabilities.cpp

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,7 @@ namespace QgsWfs
166166
if ( !keywords.isEmpty() && !keywords.join( QStringLiteral( ", " ) ).isEmpty() )
167167
{
168168
QDomElement keywordsElem = doc.createElement( QStringLiteral( "ows:Keywords" ) );
169-
for ( QString keyword : keywords )
169+
for ( const QString &keyword : keywords )
170170
{
171171
if ( !keyword.isEmpty() )
172172
{
@@ -193,7 +193,7 @@ namespace QgsWfs
193193

194194
QDomElement feesElem = doc.createElement( QStringLiteral( "ows:Fees" ) );
195195
QDomText feesText = doc.createTextNode( "None" );
196-
QString fees = QgsServerProjectUtils::owsServiceFees( *project );
196+
const QString fees = QgsServerProjectUtils::owsServiceFees( *project );
197197
if ( !fees.isEmpty() )
198198
{
199199
feesText = doc.createTextNode( fees );
@@ -202,7 +202,7 @@ namespace QgsWfs
202202
serviceElem.appendChild( feesElem );
203203

204204
QDomElement accessConstraintsElem = doc.createElement( QStringLiteral( "ows:AccessConstraints" ) );
205-
QString accessConstraints = QgsServerProjectUtils::owsServiceAccessConstraints( *project );
205+
const QString accessConstraints = QgsServerProjectUtils::owsServiceAccessConstraints( *project );
206206
QDomText accessConstraintsText = doc.createTextNode( "None" );
207207
if ( !accessConstraints.isEmpty() )
208208
{
@@ -221,7 +221,7 @@ namespace QgsWfs
221221
QDomElement serviceElem = doc.createElement( QStringLiteral( "ows:ServiceProvider" ) );
222222

223223
//ProviderName
224-
QString contactOrganization = QgsServerProjectUtils::owsServiceContactOrganization( *project );
224+
const QString contactOrganization = QgsServerProjectUtils::owsServiceContactOrganization( *project );
225225
if ( !contactOrganization.isEmpty() )
226226
{
227227
QDomElement providerNameElem = doc.createElement( QStringLiteral( "ows:ProviderName" ) );
@@ -230,8 +230,8 @@ namespace QgsWfs
230230
serviceElem.appendChild( providerNameElem );
231231
}
232232

233-
QString contactPerson = QgsServerProjectUtils::owsServiceContactPerson( *project );
234-
QString contactPosition = QgsServerProjectUtils::owsServiceContactPosition( *project );
233+
const QString contactPerson = QgsServerProjectUtils::owsServiceContactPerson( *project );
234+
const QString contactPosition = QgsServerProjectUtils::owsServiceContactPosition( *project );
235235
if ( !contactPerson.isEmpty() ||
236236
!contactPosition.isEmpty() )
237237
{
@@ -254,9 +254,9 @@ namespace QgsWfs
254254
serviceContactElem.appendChild( positionNameElem );
255255
}
256256

257-
QString contactMail = QgsServerProjectUtils::owsServiceContactMail( *project );
258-
QString contactPhone = QgsServerProjectUtils::owsServiceContactPhone( *project );
259-
QString onlineResource = QgsServerProjectUtils::owsServiceOnlineResource( *project );
257+
const QString contactMail = QgsServerProjectUtils::owsServiceContactMail( *project );
258+
const QString contactPhone = QgsServerProjectUtils::owsServiceContactPhone( *project );
259+
const QString onlineResource = QgsServerProjectUtils::owsServiceOnlineResource( *project );
260260
if ( !contactMail.isEmpty() ||
261261
!contactPhone.isEmpty() ||
262262
!onlineResource.isEmpty() )
@@ -414,13 +414,13 @@ namespace QgsWfs
414414
QDomElement queryElement = doc.createElement( QStringLiteral( "Query" )/*wfs:Query*/ );
415415
operationsElement.appendChild( queryElement );
416416

417-
QStringList wfsLayerIds = QgsServerProjectUtils::wfsLayerIds( *project );
418-
QStringList wfstUpdateLayersId = QgsServerProjectUtils::wfstUpdateLayerIds( *project );
419-
QStringList wfstInsertLayersId = QgsServerProjectUtils::wfstInsertLayerIds( *project );
420-
QStringList wfstDeleteLayersId = QgsServerProjectUtils::wfstDeleteLayerIds( *project );
421-
for ( int i = 0; i < wfsLayerIds.size(); ++i )
417+
const QStringList wfsLayerIds = QgsServerProjectUtils::wfsLayerIds( *project );
418+
const QStringList wfstUpdateLayersId = QgsServerProjectUtils::wfstUpdateLayerIds( *project );
419+
const QStringList wfstInsertLayersId = QgsServerProjectUtils::wfstInsertLayerIds( *project );
420+
const QStringList wfstDeleteLayersId = QgsServerProjectUtils::wfstDeleteLayerIds( *project );
421+
for ( const QString &wfsLayerId : wfsLayerIds )
422422
{
423-
QgsMapLayer *layer = project->mapLayer( wfsLayerIds.at( i ) );
423+
QgsMapLayer *layer = project->mapLayer( wfsLayerId );
424424
if ( layer->type() != QgsMapLayer::LayerType::VectorLayer )
425425
{
426426
continue;
@@ -482,14 +482,14 @@ namespace QgsWfs
482482
}
483483

484484
//create DefaultSRS element
485-
QString defaultSrs = layer->crs().authid();
485+
const QString defaultSrs = layer->crs().authid();
486486
QDomElement srsElem = doc.createElement( QStringLiteral( "DefaultSRS" ) );
487487
QDomText srsText = doc.createTextNode( defaultSrs );
488488
srsElem.appendChild( srsText );
489489
layerElem.appendChild( srsElem );
490490

491491
//create OtherSRS elements
492-
QStringList outputCrsList = QgsServerProjectUtils::wmsOutputCrsList( *project );
492+
const QStringList outputCrsList = QgsServerProjectUtils::wmsOutputCrsList( *project );
493493
for ( const QString &crs : outputCrsList )
494494
{
495495
if ( crs == defaultSrs )

‎src/server/services/wfs/qgswfsgetcapabilities_1_0_0.cpp

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ namespace QgsWfs
120120
nameElem.appendChild( nameText );
121121
serviceElem.appendChild( nameElem );
122122

123-
QString title = QgsServerProjectUtils::owsServiceTitle( *project );
123+
const QString title = QgsServerProjectUtils::owsServiceTitle( *project );
124124
if ( !title.isEmpty() )
125125
{
126126
QDomElement titleElem = doc.createElement( QStringLiteral( "Title" ) );
@@ -129,7 +129,7 @@ namespace QgsWfs
129129
serviceElem.appendChild( titleElem );
130130
}
131131

132-
QString abstract = QgsServerProjectUtils::owsServiceAbstract( *project );
132+
const QString abstract = QgsServerProjectUtils::owsServiceAbstract( *project );
133133
if ( !abstract.isEmpty() )
134134
{
135135
QDomElement abstractElem = doc.createElement( QStringLiteral( "Abstract" ) );
@@ -138,7 +138,7 @@ namespace QgsWfs
138138
serviceElem.appendChild( abstractElem );
139139
}
140140

141-
QStringList keywords = QgsServerProjectUtils::owsServiceKeywords( *project );
141+
const QStringList keywords = QgsServerProjectUtils::owsServiceKeywords( *project );
142142
if ( !keywords.isEmpty() && !keywords.join( QStringLiteral( ", " ) ).isEmpty() )
143143
{
144144
QDomElement keywordsElem = doc.createElement( QStringLiteral( "Keywords" ) );
@@ -148,15 +148,15 @@ namespace QgsWfs
148148
}
149149

150150
QDomElement onlineResourceElem = doc.createElement( QStringLiteral( "OnlineResource" ) );
151-
QString onlineResource = QgsServerProjectUtils::owsServiceOnlineResource( *project );
151+
const QString onlineResource = QgsServerProjectUtils::owsServiceOnlineResource( *project );
152152
if ( !onlineResource.isEmpty() )
153153
{
154154
QDomText onlineResourceText = doc.createTextNode( onlineResource );
155155
onlineResourceElem.appendChild( onlineResourceText );
156156
}
157157
serviceElem.appendChild( onlineResourceElem );
158158

159-
QString fees = QgsServerProjectUtils::owsServiceFees( *project );
159+
const QString fees = QgsServerProjectUtils::owsServiceFees( *project );
160160
if ( !fees.isEmpty() )
161161
{
162162
QDomElement feesElem = doc.createElement( QStringLiteral( "Fees" ) );
@@ -165,7 +165,7 @@ namespace QgsWfs
165165
serviceElem.appendChild( feesElem );
166166
}
167167

168-
QString accessConstraints = QgsServerProjectUtils::owsServiceAccessConstraints( *project );
168+
const QString accessConstraints = QgsServerProjectUtils::owsServiceAccessConstraints( *project );
169169
if ( !accessConstraints.isEmpty() )
170170
{
171171
QDomElement accessConstraintsElem = doc.createElement( QStringLiteral( "AccessConstraints" ) );
@@ -259,13 +259,13 @@ namespace QgsWfs
259259
QDomElement queryElement = doc.createElement( QStringLiteral( "Query" )/*wfs:Query*/ );
260260
operationsElement.appendChild( queryElement );
261261

262-
QStringList wfsLayerIds = QgsServerProjectUtils::wfsLayerIds( *project );
263-
QStringList wfstUpdateLayersId = QgsServerProjectUtils::wfstUpdateLayerIds( *project );
264-
QStringList wfstInsertLayersId = QgsServerProjectUtils::wfstInsertLayerIds( *project );
265-
QStringList wfstDeleteLayersId = QgsServerProjectUtils::wfstDeleteLayerIds( *project );
266-
for ( int i = 0; i < wfsLayerIds.size(); ++i )
262+
const QStringList wfsLayerIds = QgsServerProjectUtils::wfsLayerIds( *project );
263+
const QStringList wfstUpdateLayersId = QgsServerProjectUtils::wfstUpdateLayerIds( *project );
264+
const QStringList wfstInsertLayersId = QgsServerProjectUtils::wfstInsertLayerIds( *project );
265+
const QStringList wfstDeleteLayersId = QgsServerProjectUtils::wfstDeleteLayerIds( *project );
266+
for ( const QString &wfsLayerId : wfsLayerIds )
267267
{
268-
QgsMapLayer *layer = project->mapLayer( wfsLayerIds.at( i ) );
268+
QgsMapLayer *layer = project->mapLayer( wfsLayerId );
269269
if ( layer->type() != QgsMapLayer::LayerType::VectorLayer )
270270
{
271271
continue;

‎src/server/services/wfs/qgswfsgetfeature.h

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,11 +50,13 @@ namespace QgsWfs
5050
QString geometryName;
5151
};
5252

53-
/** Add SortBy element to featureRequest
53+
/**
54+
* Add SortBy element to featureRequest
5455
*/
5556
void parseSortByElement( QDomElement &sortByElem, QgsFeatureRequest &featureRequest, const QString &typeName );
5657

57-
/** Transform Query element to getFeatureQuery
58+
/**
59+
* Transform Query element to getFeatureQuery
5860
*/
5961
getFeatureQuery parseQueryElement( QDomElement &queryElem );
6062

‎src/server/services/wfs/qgswfsparameters.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -475,4 +475,4 @@ namespace QgsWfs
475475
{
476476
throw QgsBadRequestException( QStringLiteral( "Invalid WFS Parameter" ), msg );
477477
}
478-
}
478+
}

‎src/server/services/wfs/qgswfsparameters.h

Lines changed: 34 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,8 @@ namespace QgsWfs
123123
*/
124124
QgsProjectVersion versionAsNumber() const;
125125

126-
/** Returns OUTPUTFORMAT parameter as a string.
126+
/**
127+
* Returns OUTPUTFORMAT parameter as a string.
127128
* \returns outputFormat parameter as string
128129
*/
129130
QString outputFormatAsString() const;
@@ -135,91 +136,107 @@ namespace QgsWfs
135136
*/
136137
Format outputFormat() const;
137138

138-
/** Returns RESULTTYPE parameter as a string.
139+
/**
140+
* Returns RESULTTYPE parameter as a string.
139141
* \returns resultType parameter as string
140142
*/
141143
QString resultTypeAsString() const;
142144

143-
/** Returns resultType. If the RESULTTYPE parameter is not used, then the
145+
/**
146+
* Returns resultType. If the RESULTTYPE parameter is not used, then the
144147
* default value is RESULTS.
145148
* \returns resultType
146149
*/
147150
ResultType resultType() const;
148151

149-
/** Returns PROPERTYNAME parameter as list.
152+
/**
153+
* Returns PROPERTYNAME parameter as list.
150154
* \returns propertyName parameter as list
151155
*/
152156
QStringList propertyNames() const;
153157

154-
/** Returns MAXFEATURES parameter as a string.
158+
/**
159+
* Returns MAXFEATURES parameter as a string.
155160
* \returns maxFeatures parameter as string
156161
*/
157162
QString maxFeatures() const;
158163

159-
/** Returns MAXFEATURES parameter as an int or its default value if not
164+
/**
165+
* Returns MAXFEATURES parameter as an int or its default value if not
160166
* defined. An exception is raised if I is defined and cannot be
161167
* converted.
162168
* \returns maxFeatures parameter
163169
* \throws QgsBadRequestException
164170
*/
165171
int maxFeaturesAsInt() const;
166172

167-
/** Returns STARTINDEX parameter as a string.
173+
/**
174+
* Returns STARTINDEX parameter as a string.
168175
* \returns startIndex parameter as string
169176
*/
170177
QString startIndex() const;
171178

172-
/** Returns STARTINDEX parameter as an int or its default value if not
179+
/**
180+
* Returns STARTINDEX parameter as an int or its default value if not
173181
* defined. An exception is raised if I is defined and cannot be
174182
* converted.
175183
* \returns startIndex parameter
176184
* \throws QgsBadRequestException
177185
*/
178186
int startIndexAsInt() const;
179187

180-
/** Returns SRSNAME parameter as a string.
188+
/**
189+
* Returns SRSNAME parameter as a string.
181190
* \returns srsName parameter as string
182191
*/
183192
QString srsName() const;
184193

185-
/** Returns TYPENAME parameter as list.
194+
/**
195+
* Returns TYPENAME parameter as list.
186196
* \returns typeName parameter as list
187197
*/
188198
QStringList typeNames() const;
189199

190-
/** Returns FEATUREID parameter as list.
200+
/**
201+
* Returns FEATUREID parameter as list.
191202
* \returns featureId parameter as list
192203
*/
193204
QStringList featureIds() const;
194205

195-
/** Returns FILTER parameter as list.
206+
/**
207+
* Returns FILTER parameter as list.
196208
* \returns filter parameter as list
197209
*/
198210
QStringList filters() const;
199211

200-
/** Returns BBOX if defined or an empty string.
212+
/**
213+
* Returns BBOX if defined or an empty string.
201214
* \returns bbox parameter
202215
*/
203216
QString bbox() const;
204217

205-
/** Returns BBOX as a rectangle if defined and valid. An exception is
218+
/**
219+
* Returns BBOX as a rectangle if defined and valid. An exception is
206220
* raised if the BBOX string cannot be converted into a rectangle.
207221
* \returns bbox as rectangle
208222
* \throws QgsBadRequestException
209223
*/
210224
QgsRectangle bboxAsRectangle() const;
211225

212-
/** Returns SORTBY parameter as list.
226+
/**
227+
* Returns SORTBY parameter as list.
213228
* \returns sortBy parameter as list
214229
*/
215230
QStringList sortBy() const;
216231

217-
/** Returns EXP_FILTER parameter as list.
232+
/**
233+
* Returns EXP_FILTER parameter as list.
218234
* \returns expFilters parameter as list
219235
*/
220236
QStringList expFilters() const;
221237

222-
/** Returns GEOMETRYNAME parameter as a string.
238+
/**
239+
* Returns GEOMETRYNAME parameter as a string.
223240
* \returns geometryName parameter as string
224241
*/
225242
QString geometryNameAsString() const;

‎src/server/services/wfs/qgswfsserviceexception.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,8 @@ namespace QgsWfs
7272
{}
7373
};
7474

75-
/** \ingroup server
75+
/**
76+
* \ingroup server
7677
* \class QgsBadRequestException
7778
* \brief Exception thrown in case of malformed request
7879
*/

‎src/server/services/wfs/qgswfstransaction_1_0_0.h

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -81,29 +81,35 @@ namespace QgsWfs
8181
QList< transactionDelete > deletes;
8282
};
8383

84-
/** Transform Insert element to transactionInsert
84+
/**
85+
* Transform Insert element to transactionInsert
8586
*/
8687
transactionInsert parseInsertActionElement( QDomElement &actionElem );
8788

88-
/** Transform Update element to transactionUpdate
89+
/**
90+
* Transform Update element to transactionUpdate
8991
*/
9092
transactionUpdate parseUpdateActionElement( QDomElement &actionElem );
9193

92-
/** Transform Delete element to transactionDelete
94+
/**
95+
* Transform Delete element to transactionDelete
9396
*/
9497
transactionDelete parseDeleteActionElement( QDomElement &actionElem );
9598

96-
/** Transform RequestBody root element to getFeatureRequest
99+
/**
100+
* Transform RequestBody root element to getFeatureRequest
97101
*/
98102
transactionRequest parseTransactionRequestBody( QDomElement &docElem );
99103

100104
transactionRequest parseTransactionParameters( QgsServerRequest::Parameters parameters );
101105

102-
/** Transform GML feature nodes to features
106+
/**
107+
* Transform GML feature nodes to features
103108
*/
104109
QgsFeatureList featuresFromGML( QDomNodeList featureNodeList, QgsVectorDataProvider *provider );
105110

106-
/** Perform the transaction
111+
/**
112+
* Perform the transaction
107113
*/
108114
void performTransaction( transactionRequest &aRequest, QgsServerInterface *serverIface, const QgsProject *project );
109115

0 commit comments

Comments
 (0)
Please sign in to comment.