Skip to content

Commit

Permalink
Add extra parameter QgsProject* to QgsService::executeRequest
Browse files Browse the repository at this point in the history
  • Loading branch information
dmarteau committed Jan 10, 2017
1 parent bac1890 commit ec226ee
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 9 deletions.
5 changes: 2 additions & 3 deletions python/server/qgsservice.sip
Expand Up @@ -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;
};

4 changes: 2 additions & 2 deletions python/server/qgsserviceregistry.sip
Expand Up @@ -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() );
Expand Down
7 changes: 4 additions & 3 deletions src/server/qgsservice.h
Expand Up @@ -24,6 +24,8 @@
#include "qgsserverrequest.h"
#include "qgsserverresponse.h"

class QgsProject;

/**
* \ingroup server
* QgsService
Expand Down Expand Up @@ -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
Expand Down
4 changes: 3 additions & 1 deletion src/server/services/DummyService/dummy.cpp
Expand Up @@ -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" ) );
Expand Down

0 comments on commit ec226ee

Please sign in to comment.