Skip to content
Permalink
Browse files

Pass strings by const ref

  • Loading branch information
nyalldawson committed Sep 5, 2017
1 parent a46cc54 commit b1745b0fea324df2f09c3784cc50c8b2e20ae1fe
Showing with 18 additions and 20 deletions.
  1. +8 −10 src/core/geonode/qgsgeonoderequest.cpp
  2. +10 −10 src/core/geonode/qgsgeonoderequest.h
@@ -37,8 +37,6 @@ QgsGeoNodeRequest::QgsGeoNodeRequest( bool forceRefresh, QObject *parent )
QgsGeoNodeRequest::QgsGeoNodeRequest( const QString &baseUrl, /*const QgsWmsAuthorization &auth,*/ bool forceRefresh, QObject *parent )
: QObject( parent )
, mBaseUrl( baseUrl )
, mGeoNodeReply( nullptr )
, mIsAborted( false )
, mForceRefresh( forceRefresh )
{

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

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

}

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

}

QgsGeoNodeStyle QgsGeoNodeRequest::getStyle( QString styleID )
QgsGeoNodeStyle QgsGeoNodeRequest::getStyle( const QString &styleID )
{
QString endPoint = QStringLiteral( "/api/styles/" ) + styleID;

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

}

QList<QgsServiceLayerDetail> QgsGeoNodeRequest::parseLayers( QByteArray layerResponse )
QList<QgsServiceLayerDetail> QgsGeoNodeRequest::parseLayers( const QByteArray &layerResponse )
{
QList<QgsServiceLayerDetail> layers;
if ( layerResponse.isEmpty() )
@@ -356,7 +354,7 @@ QList<QgsServiceLayerDetail> QgsGeoNodeRequest::parseLayers( QByteArray layerRes
return layers;
}

QgsGeoNodeStyle QgsGeoNodeRequest::retrieveStyle( QString styleUrl )
QgsGeoNodeStyle QgsGeoNodeRequest::retrieveStyle( const QString &styleUrl )
{
QgsGeoNodeStyle geoNodeStyle;

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

QStringList QgsGeoNodeRequest::serviceUrls( QString serviceType )
QStringList QgsGeoNodeRequest::serviceUrls( const QString &serviceType )
{
QStringList urls;

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

QgsStringMap QgsGeoNodeRequest::serviceUrlData( QString serviceType )
QgsStringMap QgsGeoNodeRequest::serviceUrlData( const QString &serviceType )
{
QgsStringMap urls;

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

bool QgsGeoNodeRequest::request( QString endPoint )
bool QgsGeoNodeRequest::request( const QString &endPoint )
{
abort();
mIsAborted = false;
@@ -62,21 +62,21 @@ class CORE_EXPORT QgsGeoNodeRequest : public QObject
QgsGeoNodeRequest( const QString &baseUrl, /*const QgsWmsAuthorization &auth,*/ bool forceRefresh, QObject *parent = nullptr );
virtual ~QgsGeoNodeRequest();

bool request( QString endPoint );
bool request( const QString &endPoint );

QList<QgsServiceLayerDetail> getLayers();

QList<QgsGeoNodeStyle> getStyles( QString layerName );
QList<QgsGeoNodeStyle> getStyles( const QString &layerName );

QgsGeoNodeStyle getDefaultStyle( QString layerName );
QgsGeoNodeStyle getDefaultStyle( const QString &layerName );

QgsGeoNodeStyle getStyle( QString styleID );
QgsGeoNodeStyle getStyle( const QString &styleID );

// Obtain list of unique URL in the geonode
QStringList serviceUrls( QString serviceType );
QStringList serviceUrls( const QString &serviceType );

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

QString lastError() const { return mError; }

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

private:
QList<QgsServiceLayerDetail> parseLayers( QByteArray layerResponse );
QgsGeoNodeStyle retrieveStyle( QString styleUrl );
QList<QgsServiceLayerDetail> parseLayers( const QByteArray &layerResponse );
QgsGeoNodeStyle retrieveStyle( const QString &styleUrl );

signals:
//! \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
//! Response
QByteArray mHttpGeoNodeResponse;

bool mIsAborted;
bool mForceRefresh;
bool mIsAborted = false;
bool mForceRefresh = false;

};

0 comments on commit b1745b0

Please sign in to comment.
You can’t perform that action at this time.