Navigation Menu

Skip to content

Commit

Permalink
Astyle formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
elpaso committed Nov 26, 2014
1 parent 329b9d7 commit de98fb1
Show file tree
Hide file tree
Showing 10 changed files with 111 additions and 107 deletions.
8 changes: 4 additions & 4 deletions src/mapserver/qgshttprequesthandler.cpp
Expand Up @@ -32,8 +32,8 @@
#include <QUrl>
#include <fcgi_stdio.h>

QgsHttpRequestHandler::QgsHttpRequestHandler()
: QgsRequestHandler()
QgsHttpRequestHandler::QgsHttpRequestHandler():
QgsRequestHandler()
{
mException = NULL;
mHeadersSent = FALSE;
Expand Down Expand Up @@ -138,7 +138,7 @@ void QgsHttpRequestHandler::sendHeaders()

void QgsHttpRequestHandler::sendBody() const
{
size_t result = fwrite( (void*)mBody.data(), mBody.size(), 1, FCGI_stdout );
size_t result = fwrite(( void* )mBody.data(), mBody.size(), 1, FCGI_stdout );
#ifdef QGISDEBUG
QgsDebugMsg( QString( "Sent %1 blocks of %2 bytes" ).arg( result ).arg( mBody.size() ) );
#else
Expand Down Expand Up @@ -170,7 +170,7 @@ void QgsHttpRequestHandler::sendResponse()
filtersIterator.value()->sendResponse();
}
#endif
if (! headersSent() )
if ( ! headersSent() )
{
sendHeaders();
}
Expand Down
6 changes: 3 additions & 3 deletions src/mapserver/qgshttprequesthandler.h
Expand Up @@ -55,9 +55,9 @@ class QgsHttpRequestHandler: public QgsRequestHandler
virtual void setInfoFormat( const QString &format );
virtual bool responseReady() const;
virtual bool exceptionRaised() const;
virtual void setParameter(const QString &key, const QString &value);
virtual QString parameter(const QString &key) const;
virtual int removeParameter(const QString &key);
virtual void setParameter( const QString &key, const QString &value );
virtual QString parameter( const QString &key ) const;
virtual int removeParameter( const QString &key );
#ifdef MAPSERVER_HAVE_PYTHON_PLUGINS
virtual void setPluginFilters( QgsServerFiltersMap pluginFilters );
#endif
Expand Down
2 changes: 1 addition & 1 deletion src/mapserver/qgsrequesthandler.h
Expand Up @@ -95,7 +95,7 @@ class QgsRequestHandler
/**Allow core services to call plugin hooks through sendResponse() */
virtual void setPluginFilters( QgsServerFiltersMap pluginFilters ) = 0;
#endif
protected:
protected:
virtual void sendHeaders( ) = 0;
virtual void sendBody( ) const = 0;
#ifdef MAPSERVER_HAVE_PYTHON_PLUGINS
Expand Down
10 changes: 5 additions & 5 deletions src/mapserver/qgsserverfilter.cpp
Expand Up @@ -27,8 +27,8 @@
*
*/

QgsServerFilter::QgsServerFilter(QgsServerInterface *serverInterface):
mServerInterface( serverInterface )
QgsServerFilter::QgsServerFilter( QgsServerInterface *serverInterface ):
mServerInterface( serverInterface )
{
}

Expand All @@ -39,16 +39,16 @@ QgsServerFilter::~QgsServerFilter()

void QgsServerFilter::requestReady()
{
QgsDebugMsg( "QgsServerFilter plugin default requestReady called");
QgsDebugMsg( "QgsServerFilter plugin default requestReady called" );
}

void QgsServerFilter::responseComplete()
{
QgsDebugMsg( "QgsServerFilter plugin default responseComplete called");
QgsDebugMsg( "QgsServerFilter plugin default responseComplete called" );
}


void QgsServerFilter::sendResponse()
{
QgsDebugMsg( "QgsServerFilter plugin default sendResponse called");
QgsDebugMsg( "QgsServerFilter plugin default sendResponse called" );
}
22 changes: 11 additions & 11 deletions src/mapserver/qgsserverfilter.h
Expand Up @@ -33,20 +33,20 @@ class QgsServerInterface;
class QgsServerFilter
{

public:
public:

/** Constructor */
QgsServerFilter( QgsServerInterface* serverInterface );
/** Destructor */
virtual ~QgsServerFilter();
QgsServerInterface* serverInterface( ) { return mServerInterface; }
virtual void requestReady();
virtual void responseComplete();
virtual void sendResponse();
/** Constructor */
QgsServerFilter( QgsServerInterface* serverInterface );
/** Destructor */
virtual ~QgsServerFilter();
QgsServerInterface* serverInterface( ) { return mServerInterface; }
virtual void requestReady();
virtual void responseComplete();
virtual void sendResponse();

private:
private:

QgsServerInterface* mServerInterface;
QgsServerInterface* mServerInterface;

};

Expand Down
2 changes: 1 addition & 1 deletion src/mapserver/qgsserverinterface.h
Expand Up @@ -47,7 +47,7 @@ class QgsServerInterface
virtual void registerFilter( QgsServerFilter* filter, int priority = 0 ) = 0;
virtual QgsServerFiltersMap filters( ) = 0;
/*Pass environment variables to python*/
virtual QString getEnv(const QString& name ) const = 0;
virtual QString getEnv( const QString& name ) const = 0;

};

Expand Down
10 changes: 5 additions & 5 deletions src/mapserver/qgsserverinterfaceimpl.cpp
Expand Up @@ -21,15 +21,15 @@


QgsServerInterfaceImpl::QgsServerInterfaceImpl( QgsCapabilitiesCache* capCache ) :
mCapabilitiesCache( capCache )
mCapabilitiesCache( capCache )
{
mRequestHandler = NULL;
}


QString QgsServerInterfaceImpl::getEnv(const QString& name ) const
QString QgsServerInterfaceImpl::getEnv( const QString& name ) const
{
return getenv( name.toLocal8Bit() );
return getenv( name.toLocal8Bit() );
}


Expand All @@ -38,12 +38,12 @@ QgsServerInterfaceImpl::~QgsServerInterfaceImpl()
{
}

void QgsServerInterfaceImpl::setRequestHandler( QgsRequestHandler * requestHandler)
void QgsServerInterfaceImpl::setRequestHandler( QgsRequestHandler * requestHandler )
{
mRequestHandler = requestHandler;
}

void QgsServerInterfaceImpl::registerFilter( QgsServerFilter *filter, int priority )
{
mFilters.insert(priority, filter);
mFilters.insert( priority, filter );
}
30 changes: 15 additions & 15 deletions src/mapserver/qgsserverinterfaceimpl.h
Expand Up @@ -36,26 +36,26 @@
class QgsServerInterfaceImpl : public QgsServerInterface
{

public:
public:

/** Constructor */
QgsServerInterfaceImpl( QgsCapabilitiesCache *capCache );
/** Constructor */
QgsServerInterfaceImpl( QgsCapabilitiesCache *capCache );

/** Destructor */
~QgsServerInterfaceImpl();
/** Destructor */
~QgsServerInterfaceImpl();

void setRequestHandler( QgsRequestHandler* requestHandler );
QgsCapabilitiesCache* capabiblitiesCache() { return mCapabilitiesCache; }
QgsRequestHandler* requestHandler( ) { return mRequestHandler; }
void registerFilter( QgsServerFilter *filter, int priority = 0 );
QgsServerFiltersMap filters( ) { return mFilters; }
QString getEnv(const QString& name ) const;
void setRequestHandler( QgsRequestHandler* requestHandler );
QgsCapabilitiesCache* capabiblitiesCache() { return mCapabilitiesCache; }
QgsRequestHandler* requestHandler( ) { return mRequestHandler; }
void registerFilter( QgsServerFilter *filter, int priority = 0 );
QgsServerFiltersMap filters( ) { return mFilters; }
QString getEnv( const QString& name ) const;

private:
private:

QgsServerFiltersMap mFilters;
QgsCapabilitiesCache* mCapabilitiesCache;
QgsRequestHandler* mRequestHandler;
QgsServerFiltersMap mFilters;
QgsCapabilitiesCache* mCapabilitiesCache;
QgsRequestHandler* mRequestHandler;

};

Expand Down
122 changes: 63 additions & 59 deletions src/mapserver/qgsserverplugins.cpp
Expand Up @@ -34,80 +34,84 @@ QgsPythonUtils* QgsServerPlugins::mPythonUtils;
QStringList QgsServerPlugins::mServerPlugins;

// This code is mainly borrowed from QGIS desktop Python plugin initialization
bool QgsServerPlugins::initPlugins(QgsServerInterface *interface)
bool QgsServerPlugins::initPlugins( QgsServerInterface *interface )
{

QString pythonlibName( "qgispython" );
QString pythonlibName( "qgispython" );
#if defined(Q_WS_MAC) || defined(Q_OS_LINUX)
pythonlibName.prepend( QgsApplication::libraryPath() );
pythonlibName.prepend( QgsApplication::libraryPath() );
#endif
#ifdef __MINGW32__
pythonlibName.prepend( "lib" );
pythonlibName.prepend( "lib" );
#endif
QString version = QString( "%1.%2.%3" ).arg( QGis::QGIS_VERSION_INT / 10000 ).arg( QGis::QGIS_VERSION_INT / 100 % 100 ).arg( QGis::QGIS_VERSION_INT % 100 );
QgsDebugMsg( QString( "load library %1 (%2)" ).arg( pythonlibName ).arg( version ) );
QLibrary pythonlib( pythonlibName, version );
// It's necessary to set these two load hints, otherwise Python library won't work correctly
// see http://lists.kde.org/?l=pykde&m=117190116820758&w=2
pythonlib.setLoadHints( QLibrary::ResolveAllSymbolsHint | QLibrary::ExportExternalSymbolsHint );
QString version = QString( "%1.%2.%3" ).arg( QGis::QGIS_VERSION_INT / 10000 ).arg( QGis::QGIS_VERSION_INT / 100 % 100 ).arg( QGis::QGIS_VERSION_INT % 100 );
QgsDebugMsg( QString( "load library %1 (%2)" ).arg( pythonlibName ).arg( version ) );
QLibrary pythonlib( pythonlibName, version );
// It's necessary to set these two load hints, otherwise Python library won't work correctly
// see http://lists.kde.org/?l=pykde&m=117190116820758&w=2
pythonlib.setLoadHints( QLibrary::ResolveAllSymbolsHint | QLibrary::ExportExternalSymbolsHint );
if ( !pythonlib.load() )
{
pythonlib.setFileName( pythonlibName );
if ( !pythonlib.load() )
{
pythonlib.setFileName( pythonlibName );
if ( !pythonlib.load() )
{
QgsDebugMsg( QString( "Couldn't load Python support library: %1" ).arg( pythonlib.errorString() ) );
return FALSE;
}
QgsDebugMsg( QString( "Couldn't load Python support library: %1" ).arg( pythonlib.errorString() ) );
return FALSE;
}
}

QgsDebugMsg("Python support library loaded successfully.");
typedef QgsPythonUtils*( *inst )();
inst pythonlib_inst = ( inst ) cast_to_fptr( pythonlib.resolve( "instance" ) );
if ( !pythonlib_inst )
{
//using stderr on purpose because we want end users to see this [TS]
QgsDebugMsg( QString( "Couldn't resolve python support library's instance() symbol." ) );
return FALSE;
}
QgsDebugMsg( "Python support library loaded successfully." );
typedef QgsPythonUtils*( *inst )();
inst pythonlib_inst = ( inst ) cast_to_fptr( pythonlib.resolve( "instance" ) );
if ( !pythonlib_inst )
{
//using stderr on purpose because we want end users to see this [TS]
QgsDebugMsg( QString( "Couldn't resolve python support library's instance() symbol." ) );
return FALSE;
}

QgsDebugMsg("Python support library's instance() symbol resolved.");
mPythonUtils = pythonlib_inst();
mPythonUtils->initServerPython( interface );
QgsDebugMsg( "Python support library's instance() symbol resolved." );
mPythonUtils = pythonlib_inst();
mPythonUtils->initServerPython( interface );

if ( mPythonUtils && mPythonUtils->isEnabled() )
{
QgsDebugMsg("Python support ENABLED :-)");
}
else
{
QgsDebugMsg("Python support FAILED :-(");
return FALSE;
}
if ( mPythonUtils && mPythonUtils->isEnabled() )
{
QgsDebugMsg( "Python support ENABLED :-)" );
}
else
{
QgsDebugMsg( "Python support FAILED :-(" );
return FALSE;
}

//Init plugins: loads a list of installed plugins and filter them
//for "server" metadata
QListIterator<QString> plugins( mPythonUtils->pluginList() );
bool atLeastOneEnabled = FALSE;
while (plugins.hasNext())
//Init plugins: loads a list of installed plugins and filter them
//for "server" metadata
QListIterator<QString> plugins( mPythonUtils->pluginList() );
bool atLeastOneEnabled = FALSE;
while ( plugins.hasNext() )
{
QString pluginName = plugins.next();
QString pluginService = mPythonUtils->getPluginMetadata( pluginName, "server" );
if ( pluginService == "True" )
{
QString pluginName = plugins.next();
QString pluginService = mPythonUtils->getPluginMetadata(pluginName, "server" );
if ( pluginService == "True" )
if ( mPythonUtils->loadPlugin( pluginName ) )
{
if ( mPythonUtils->startServerPlugin( pluginName ) )
{
atLeastOneEnabled = TRUE;
mServerPlugins.append( pluginName );
QgsMessageLog::logMessage( QString( "Server plugin %1 loaded!" ).arg( pluginName ), "Server", QgsMessageLog::INFO );
}
else
{
QgsMessageLog::logMessage( QString( "Error loading server plugin %1" ).arg( pluginName ), "Server", QgsMessageLog::CRITICAL );
}
}
else
{
if ( mPythonUtils->loadPlugin( pluginName ) )
{
if ( mPythonUtils->startServerPlugin( pluginName ))
{
atLeastOneEnabled = TRUE;
mServerPlugins.append( pluginName );
QgsMessageLog::logMessage( QString("Server plugin %1 loaded!").arg( pluginName ), "Server", QgsMessageLog::INFO );
} else {
QgsMessageLog::logMessage( QString("Error loading server plugin %1").arg( pluginName ), "Server", QgsMessageLog::CRITICAL );
}
} else {
QgsMessageLog::logMessage( QString("Error starting server plugin %1").arg( pluginName ), "Server", QgsMessageLog::CRITICAL );
}
QgsMessageLog::logMessage( QString( "Error starting server plugin %1" ).arg( pluginName ), "Server", QgsMessageLog::CRITICAL );
}
}
return mPythonUtils && mPythonUtils->isEnabled() && atLeastOneEnabled;
}
return mPythonUtils && mPythonUtils->isEnabled() && atLeastOneEnabled;
}
6 changes: 3 additions & 3 deletions src/mapserver/qgsserverplugins.h
Expand Up @@ -23,10 +23,10 @@
#include "qgsserverinterface.h"

class QgsServerPlugins
{
public:
{
public:
explicit QgsServerPlugins();
static bool initPlugins(QgsServerInterface* interface);
static bool initPlugins( QgsServerInterface* interface );
static QgsPythonUtils* mPythonUtils;
static QStringList mServerPlugins;
};
Expand Down

0 comments on commit de98fb1

Please sign in to comment.