Skip to content

Commit b1745b0

Browse files
committedSep 12, 2017
Pass strings by const ref
1 parent a46cc54 commit b1745b0

File tree

2 files changed

+18
-20
lines changed

2 files changed

+18
-20
lines changed
 

‎src/core/geonode/qgsgeonoderequest.cpp

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,6 @@ QgsGeoNodeRequest::QgsGeoNodeRequest( bool forceRefresh, QObject *parent )
3737
QgsGeoNodeRequest::QgsGeoNodeRequest( const QString &baseUrl, /*const QgsWmsAuthorization &auth,*/ bool forceRefresh, QObject *parent )
3838
: QObject( parent )
3939
, mBaseUrl( baseUrl )
40-
, mGeoNodeReply( nullptr )
41-
, mIsAborted( false )
4240
, mForceRefresh( forceRefresh )
4341
{
4442

@@ -70,7 +68,7 @@ QList<QgsServiceLayerDetail> QgsGeoNodeRequest::getLayers()
7068
return parseLayers( this->response() );
7169
}
7270

73-
QgsGeoNodeStyle QgsGeoNodeRequest::getDefaultStyle( QString layerName )
71+
QgsGeoNodeStyle QgsGeoNodeRequest::getDefaultStyle( const QString &layerName )
7472
{
7573
QgsGeoNodeStyle defaultStyle;
7674
bool success = request( QStringLiteral( "/api/layers?name=" ) + layerName );
@@ -94,7 +92,7 @@ QgsGeoNodeStyle QgsGeoNodeRequest::getDefaultStyle( QString layerName )
9492

9593
}
9694

97-
QList<QgsGeoNodeStyle> QgsGeoNodeRequest::getStyles( QString layerName )
95+
QList<QgsGeoNodeStyle> QgsGeoNodeRequest::getStyles( const QString &layerName )
9896
{
9997
QList<QgsGeoNodeStyle> geoNodeStyles;
10098
bool success = request( QStringLiteral( "/api/styles?layer__name=" ) + layerName );
@@ -122,7 +120,7 @@ QList<QgsGeoNodeStyle> QgsGeoNodeRequest::getStyles( QString layerName )
122120

123121
}
124122

125-
QgsGeoNodeStyle QgsGeoNodeRequest::getStyle( QString styleID )
123+
QgsGeoNodeStyle QgsGeoNodeRequest::getStyle( const QString &styleID )
126124
{
127125
QString endPoint = QStringLiteral( "/api/styles/" ) + styleID;
128126

@@ -243,7 +241,7 @@ void QgsGeoNodeRequest::replyFinished()
243241

244242
}
245243

246-
QList<QgsServiceLayerDetail> QgsGeoNodeRequest::parseLayers( QByteArray layerResponse )
244+
QList<QgsServiceLayerDetail> QgsGeoNodeRequest::parseLayers( const QByteArray &layerResponse )
247245
{
248246
QList<QgsServiceLayerDetail> layers;
249247
if ( layerResponse.isEmpty() )
@@ -356,7 +354,7 @@ QList<QgsServiceLayerDetail> QgsGeoNodeRequest::parseLayers( QByteArray layerRes
356354
return layers;
357355
}
358356

359-
QgsGeoNodeStyle QgsGeoNodeRequest::retrieveStyle( QString styleUrl )
357+
QgsGeoNodeStyle QgsGeoNodeRequest::retrieveStyle( const QString &styleUrl )
360358
{
361359
QgsGeoNodeStyle geoNodeStyle;
362360

@@ -388,7 +386,7 @@ QgsGeoNodeStyle QgsGeoNodeRequest::retrieveStyle( QString styleUrl )
388386
return geoNodeStyle;
389387
}
390388

391-
QStringList QgsGeoNodeRequest::serviceUrls( QString serviceType )
389+
QStringList QgsGeoNodeRequest::serviceUrls( const QString &serviceType )
392390
{
393391
QStringList urls;
394392

@@ -432,7 +430,7 @@ QStringList QgsGeoNodeRequest::serviceUrls( QString serviceType )
432430
return urls;
433431
}
434432

435-
QgsStringMap QgsGeoNodeRequest::serviceUrlData( QString serviceType )
433+
QgsStringMap QgsGeoNodeRequest::serviceUrlData( const QString &serviceType )
436434
{
437435
QgsStringMap urls;
438436

@@ -478,7 +476,7 @@ QgsStringMap QgsGeoNodeRequest::serviceUrlData( QString serviceType )
478476
return urls;
479477
}
480478

481-
bool QgsGeoNodeRequest::request( QString endPoint )
479+
bool QgsGeoNodeRequest::request( const QString &endPoint )
482480
{
483481
abort();
484482
mIsAborted = false;

‎src/core/geonode/qgsgeonoderequest.h

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -62,21 +62,21 @@ class CORE_EXPORT QgsGeoNodeRequest : public QObject
6262
QgsGeoNodeRequest( const QString &baseUrl, /*const QgsWmsAuthorization &auth,*/ bool forceRefresh, QObject *parent = nullptr );
6363
virtual ~QgsGeoNodeRequest();
6464

65-
bool request( QString endPoint );
65+
bool request( const QString &endPoint );
6666

6767
QList<QgsServiceLayerDetail> getLayers();
6868

69-
QList<QgsGeoNodeStyle> getStyles( QString layerName );
69+
QList<QgsGeoNodeStyle> getStyles( const QString &layerName );
7070

71-
QgsGeoNodeStyle getDefaultStyle( QString layerName );
71+
QgsGeoNodeStyle getDefaultStyle( const QString &layerName );
7272

73-
QgsGeoNodeStyle getStyle( QString styleID );
73+
QgsGeoNodeStyle getStyle( const QString &styleID );
7474

7575
// Obtain list of unique URL in the geonode
76-
QStringList serviceUrls( QString serviceType );
76+
QStringList serviceUrls( const QString &serviceType );
7777

7878
// Obtain map of layer name and url for a service type
79-
QgsStringMap serviceUrlData( QString serviceType );
79+
QgsStringMap serviceUrlData( const QString &serviceType );
8080

8181
QString lastError() const { return mError; }
8282

@@ -91,8 +91,8 @@ class CORE_EXPORT QgsGeoNodeRequest : public QObject
9191
void setProtocol( const QString &protocol );
9292

9393
private:
94-
QList<QgsServiceLayerDetail> parseLayers( QByteArray layerResponse );
95-
QgsGeoNodeStyle retrieveStyle( QString styleUrl );
94+
QList<QgsServiceLayerDetail> parseLayers( const QByteArray &layerResponse );
95+
QgsGeoNodeStyle retrieveStyle( const QString &styleUrl );
9696

9797
signals:
9898
//! \brief emit a signal to be caught by qgisapp and display a statusQString on status bar
@@ -127,8 +127,8 @@ class CORE_EXPORT QgsGeoNodeRequest : public QObject
127127
//! Response
128128
QByteArray mHttpGeoNodeResponse;
129129

130-
bool mIsAborted;
131-
bool mForceRefresh;
130+
bool mIsAborted = false;
131+
bool mForceRefresh = false;
132132

133133
};
134134

0 commit comments

Comments
 (0)
Please sign in to comment.