Add extra parameter QgsProject* to QgsService::executeRequest

This commit is contained in:
David Marteau 2016-12-15 16:31:48 +01:00
parent bac1890f9c
commit ec226eeab8
4 changed files with 11 additions and 9 deletions

View File

@ -62,9 +62,8 @@ class QgsService
/**
* Execute the requests and set result in QgsServerRequest
* @param request a QgsServerRequest instance
* @param response a QgsServerResponse instance
*/
virtual void executeRequest( const QgsServerRequest& request, QgsServerResponse& response ) = 0;
virtual void executeRequest( const QgsServerRequest& request, QgsServerResponse& response,
QgsProject* project = nullptr ) = 0;
};

View File

@ -63,13 +63,13 @@ class QgsServiceRegistry
void registerService( QgsService* service /Transfer/ );
/**
* Unregister service from its name and version
* Unregister service from its name and version
*
* @param name the tame of the service
* @param version (optional) the specific version to unload
* @return the number of unregstered services
*
* If the version is not specified then all versions from the specified service
* If the version is not specified then all versions from the specified service
* are unloaded
*/
int unregisterService( const QString& name, const QString& version = QString() );

View File

@ -24,6 +24,8 @@
#include "qgsserverrequest.h"
#include "qgsserverresponse.h"
class QgsProject;
/**
* \ingroup server
* QgsService
@ -61,10 +63,9 @@ class SERVER_EXPORT QgsService
/**
* Execute the requests and set result in QgsServerRequest
* @param request a QgsServerRequest instance
* @param response a QgsServerResponse instance
*/
virtual void executeRequest( const QgsServerRequest& request, QgsServerResponse& response ) = 0;
virtual void executeRequest( const QgsServerRequest& request, QgsServerResponse& response,
QgsProject* project = nullptr ) = 0;
};
#endif

View File

@ -31,8 +31,10 @@ class SampleService: public QgsService
return method == QgsServerRequest::GetMethod;
}
void executeRequest( const QgsServerRequest& request, QgsServerResponse& response )
void executeRequest( const QgsServerRequest& request, QgsServerResponse& response,
QgsProject* project )
{
Q_UNUSED( project );
Q_UNUSED( request );
QgsDebugMsg( "SampleService::executeRequest called" );
response.write( QString( "Hello world from myService" ) );