Skip to content
Permalink
Browse files

fix typo, use Q_UNUSED, return null/empty QString() instead literal e…

…mpty string
  • Loading branch information
dmarteau committed Jan 10, 2017
1 parent 705547e commit bac1890f9c5e9b0ff076c1f7dd21cc59073fd2db
@@ -72,7 +72,7 @@ class QgsServiceRegistry
* If the version is not specified then all versions from the specified service
* are unloaded
*/
int unRegisterService( const QString& name, const QString& version = QString() );
int unregisterService( const QString& name, const QString& version = QString() );

/**
* Initialize registry, load modules and auto register services
@@ -40,9 +40,10 @@ QgsServerRequest::~QgsServerRequest()

}

QString QgsServerRequest::getHeader( const QString& /*name*/ ) const
QString QgsServerRequest::getHeader( const QString& name ) const
{
return "";
Q_UNUSED( name );
return QString();
}

QUrl QgsServerRequest::url() const
@@ -148,7 +148,7 @@ void QgsServiceRegistry::registerService( QgsService* service )
}
}

int QgsServiceRegistry::unRegisterService( const QString& name, const QString& version )
int QgsServiceRegistry::unregisterService( const QString& name, const QString& version )
{
// Check that we have a service of that name
int removed = 0;
@@ -84,7 +84,7 @@ class SERVER_EXPORT QgsServiceRegistry
* If the version is not specified then all versions from the specified service
* are unloaded
*/
int unRegisterService( const QString& name, const QString& version = QString() );
int unregisterService( const QString& name, const QString& version = QString() );

/**
* Initialize registry, load modules and auto register services
@@ -31,8 +31,9 @@ class SampleService: public QgsService
return method == QgsServerRequest::GetMethod;
}

void executeRequest( const QgsServerRequest& /*request*/, QgsServerResponse& response )
void executeRequest( const QgsServerRequest& request, QgsServerResponse& response )
{
Q_UNUSED( request );
QgsDebugMsg( "SampleService::executeRequest called" );
response.write( QString( "Hello world from myService" ) );
}
@@ -108,15 +108,15 @@ def test_unregister_services(self):
self.assertEqual( service.version(), "1.0c" )

# Remove one service
removed = reg.unRegisterService("STUFF", "1.0c")
removed = reg.unregisterService("STUFF", "1.0c")
self.assertEqual( removed, 1 )

# Check that we get the highest version
service = reg.getService("STUFF")
self.assertEqual( service.version(), "1.0b" )

# Remove all services
removed = reg.unRegisterService("STUFF")
removed = reg.unregisterService("STUFF")
self.assertEqual( removed, 2 )

# Check that there is no more services available

0 comments on commit bac1890

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