Finish flipping a lot of methods to take const references for

non-trivial types
This commit is contained in:
Nyall Dawson 2015-10-26 22:46:14 +11:00
parent f7f659be0b
commit 70bff3f6aa
114 changed files with 461 additions and 452 deletions

View File

@ -292,9 +292,9 @@ static void qtgui_UpdatePyArgv(PyObject *argvlist, int argc, char **argv)
static void registerOgrDrivers();
/** Converts absolute path to path relative to target */
static QString absolutePathToRelativePath( QString apath, QString targetPath );
static QString absolutePathToRelativePath( const QString& apath, const QString& targetPath );
/** Converts path relative to target to an absolute path */
static QString relativePathToAbsolutePath( QString rpath, QString targetPath );
static QString relativePathToAbsolutePath( const QString& rpath, const QString& targetPath );
/** Indicates whether running from build directory (not installed) */
static bool isRunningFromBuildDir();

View File

@ -95,7 +95,7 @@ class QgsDataItem : QObject
typedef QFlags<QgsDataItem::Capability> Capabilities;
// This will _write_ selected crs in data source
virtual bool setCrs( QgsCoordinateReferenceSystem crs );
virtual bool setCrs( const QgsCoordinateReferenceSystem& crs );
//! @deprecated since 2.8, returned type this will changed to Capabilities
virtual Capability capabilities() /Deprecated/;

View File

@ -82,7 +82,7 @@ class QgsDataProvider : QObject
* that can be used by the data provider to create a subset.
* Must be implemented in the dataprovider.
*/
virtual bool setSubsetString( QString subset, bool updateFeatureCount = true );
virtual bool setSubsetString( const QString& subset, bool updateFeatureCount = true );
/** Provider supports setting of subset strings */
virtual bool supportsSubsetString();

View File

@ -343,7 +343,7 @@ class QgsProjectBadLayerHandler
%End
public:
virtual void handleBadLayers( QList<QDomNode> layers, QDomDocument projectDom ) = 0;
virtual void handleBadLayers( const QList<QDomNode>& layers, const QDomDocument& projectDom ) = 0;
virtual ~QgsProjectBadLayerHandler();
};
@ -356,6 +356,6 @@ class QgsProjectBadLayerDefaultHandler : QgsProjectBadLayerHandler
%End
public:
virtual void handleBadLayers( QList<QDomNode> layers, QDomDocument projectDom );
virtual void handleBadLayers( const QList<QDomNode>& layers, const QDomDocument& projectDom );
};

View File

@ -25,7 +25,7 @@ class QgsPythonRunner
QgsPythonRunner();
virtual ~QgsPythonRunner();
virtual bool runCommand( QString command, QString messageOnError = QString() ) = 0;
virtual bool runCommand( const QString& command, const QString& messageOnError = QString() ) = 0;
virtual bool evalCommand( QString command, QString& result ) = 0;
virtual bool evalCommand( const QString& command, QString& result ) = 0;
};

View File

@ -93,7 +93,7 @@ class QgsRenderChecker
* @param theRenderedImageFile to optionally override the output filename
* @note: make sure to call setExpectedImage and setRenderedImage first.
*/
bool compareImages( const QString& theTestName, unsigned int theMismatchCount = 0, QString theRenderedImageFile = "" );
bool compareImages( const QString& theTestName, unsigned int theMismatchCount = 0, const QString& theRenderedImageFile = "" );
/** Get a list of all the anomalies. An anomaly is a rendered difference
* file where there is some red pixel content (indicating a render check
* mismatch), but where the output was still acceptible. If the render

View File

@ -159,7 +159,7 @@ class QgsRasterDataProvider : QgsDataProvider, QgsRasterInterface
* ACTUALLY exists you need to look at the existsFlag member in each struct stored in the
* list.
*/
virtual QList<QgsRasterPyramid> buildPyramidList( QList<int> overviewList = QList<int>() );
virtual QList<QgsRasterPyramid> buildPyramidList( const QList<int>& overviewList = QList<int>() );
/** \brief Returns true if raster has at least one populated histogram. */
bool hasPyramids();
@ -261,7 +261,7 @@ class QgsRasterDataProvider : QgsDataProvider, QgsRasterInterface
/** Validates creation options for a specific dataset and destination format.
* @note used by GDAL provider only
* @note see also validateCreationOptionsFormat() in gdal provider for validating options based on format only */
virtual QString validateCreationOptions( const QStringList& createOptions, QString format );
virtual QString validateCreationOptions( const QStringList& createOptions, const QString& format );
/** Validates pyramid creation options for a specific dataset and destination format
* @note used by GDAL provider only */

View File

@ -49,16 +49,16 @@ class QgisInterface : QObject
virtual void zoomToActiveLayer() = 0;
//! Add a vector layer
virtual QgsVectorLayer* addVectorLayer( QString vectorLayerPath, QString baseName, QString providerKey ) = 0;
virtual QgsVectorLayer* addVectorLayer( const QString& vectorLayerPath, const QString& baseName, const QString& providerKey ) = 0;
//! Add a raster layer given a raster layer file name
virtual QgsRasterLayer* addRasterLayer( QString rasterLayerPath, QString baseName = QString() ) = 0;
virtual QgsRasterLayer* addRasterLayer( const QString& rasterLayerPath, const QString& baseName = QString() ) = 0;
//! Add a WMS layer
virtual QgsRasterLayer* addRasterLayer( const QString& url, const QString& layerName, const QString& providerKey ) = 0;
//! Add a project
virtual bool addProject( QString theProject ) = 0;
virtual bool addProject( const QString& theProject ) = 0;
//! Start a blank project
virtual void newProject( bool thePromptToSaveFlag = false ) = 0;
@ -150,7 +150,7 @@ class QgisInterface : QObject
virtual void removeWebToolBarIcon( QAction *qAction ) = 0;
//! Add toolbar with specified name
virtual QToolBar *addToolBar( QString name ) = 0 /Factory/;
virtual QToolBar *addToolBar( const QString& name ) = 0 /Factory/;
//! Add a toolbar
//! @note added in 2.3
@ -181,7 +181,7 @@ class QgisInterface : QObject
* @return pointer to composer's view
* @note new composer window will be shown and activated
*/
virtual QgsComposerView* createNewComposer( QString title = QString() ) = 0;
virtual QgsComposerView* createNewComposer( const QString& title = QString() ) = 0;
/** Duplicate an existing parent composer from composer view
* @param composerView pointer to existing composer view
@ -189,7 +189,7 @@ class QgisInterface : QObject
* @return pointer to duplicate composer's view
* @note dupicate composer window will be hidden until loaded, then shown and activated
*/
virtual QgsComposerView* duplicateComposer( QgsComposerView* composerView, QString title = QString() ) = 0;
virtual QgsComposerView* duplicateComposer( QgsComposerView* composerView, const QString& title = QString() ) = 0;
/** Deletes parent composer of composer view, after closing composer window */
virtual void deleteComposer( QgsComposerView* composerView ) = 0;
@ -209,10 +209,10 @@ class QgisInterface : QObject
virtual QFont defaultStyleSheetFont() = 0;
/** Add action to the plugins menu */
virtual void addPluginToMenu( QString name, QAction* action ) = 0;
virtual void addPluginToMenu( const QString& name, QAction* action ) = 0;
/** Remove action from the plugins menu */
virtual void removePluginMenu( QString name, QAction* action ) = 0;
virtual void removePluginMenu( const QString& name, QAction* action ) = 0;
/** Add "add layer" action to layer menu */
virtual void insertAddLayerAction( QAction *action ) = 0;
@ -221,28 +221,28 @@ class QgisInterface : QObject
virtual void removeAddLayerAction( QAction *action ) = 0;
/** Add action to the Database menu */
virtual void addPluginToDatabaseMenu( QString name, QAction* action ) = 0;
virtual void addPluginToDatabaseMenu( const QString& name, QAction* action ) = 0;
/** Remove action from the Database menu */
virtual void removePluginDatabaseMenu( QString name, QAction* action ) = 0;
virtual void removePluginDatabaseMenu( const QString& name, QAction* action ) = 0;
/** Add action to the Raster menu */
virtual void addPluginToRasterMenu( QString name, QAction* action ) = 0;
virtual void addPluginToRasterMenu( const QString& name, QAction* action ) = 0;
/** Remove action from the Raster menu */
virtual void removePluginRasterMenu( QString name, QAction* action ) = 0;
virtual void removePluginRasterMenu( const QString& name, QAction* action ) = 0;
/** Add action to the Vector menu */
virtual void addPluginToVectorMenu( QString name, QAction* action ) = 0;
virtual void addPluginToVectorMenu( const QString& name, QAction* action ) = 0;
/** Remove action from the Vector menu */
virtual void removePluginVectorMenu( QString name, QAction* action ) = 0;
virtual void removePluginVectorMenu( const QString& name, QAction* action ) = 0;
/** Add action to the Web menu */
virtual void addPluginToWebMenu( QString name, QAction* action ) = 0;
virtual void addPluginToWebMenu( const QString& name, QAction* action ) = 0;
/** Remove action from the Web menu */
virtual void removePluginWebMenu( QString name, QAction* action ) = 0;
virtual void removePluginWebMenu( const QString& name, QAction* action ) = 0;
/** Add a dock widget to the main window */
virtual void addDockWidget( Qt::DockWidgetArea area, QDockWidget * dockwidget ) = 0;
@ -270,7 +270,7 @@ class QgisInterface : QObject
virtual void removeWindow( QAction *action ) = 0;
/** Register action to the shortcuts manager so its shortcut can be changed in GUI */
virtual bool registerMainWindowAction( QAction* action, QString defaultShortcut ) = 0;
virtual bool registerMainWindowAction( QAction* action, const QString& defaultShortcut ) = 0;
/** Unregister a previously registered action. (e.g. when plugin is going to be unloaded) */
virtual bool unregisterMainWindowAction( QAction* action ) = 0;
@ -284,7 +284,7 @@ class QgisInterface : QObject
* url to the QGIS documentation directory path (prefix/share/doc)
* @deprecated
*/
virtual void openURL( QString url, bool useQgisDocDirectory = true ) = 0 /Deprecated/;
virtual void openURL( const QString& url, bool useQgisDocDirectory = true ) = 0 /Deprecated/;
/** Accessors for inserting items into menus and toolbars.
* An item can be inserted before any existing action.
@ -488,7 +488,7 @@ class QgisInterface : QObject
*
* More information here: http://qt-project.org/forums/viewthread/27098/
*/
virtual void preloadForm( QString uifile ) = 0;
virtual void preloadForm( const QString& uifile ) = 0;
/** Return vector layers in edit mode
* @param modified whether to return only layers that have been modified

View File

@ -14,7 +14,7 @@ class QgsProjectBadLayerGuiHandler : QObject, QgsProjectBadLayerHandler
QgsProjectBadLayerGuiHandler();
/** Implementation of the handler */
virtual void handleBadLayers( QList<QDomNode> layers, QDomDocument projectDom );
virtual void handleBadLayers( const QList<QDomNode>& layers, const QDomDocument& projectDom );
/** Flag to store the Ignore button press of MessageBox used by QgsLegend */
static bool mIgnore;

View File

@ -7876,7 +7876,7 @@ class QgsPythonRunnerImpl : public QgsPythonRunner
public:
explicit QgsPythonRunnerImpl( QgsPythonUtils* pythonUtils ) : mPythonUtils( pythonUtils ) {}
virtual bool runCommand( QString command, QString messageOnError = QString() ) override
virtual bool runCommand( const QString& command, const QString& messageOnError = QString() ) override
{
if ( mPythonUtils && mPythonUtils->isEnabled() )
{
@ -7885,7 +7885,7 @@ class QgsPythonRunnerImpl : public QgsPythonRunner
return false;
}
virtual bool evalCommand( QString command, QString &result ) override
virtual bool evalCommand( const QString& command, QString &result ) override
{
if ( mPythonUtils && mPythonUtils->isEnabled() )
{

View File

@ -111,24 +111,26 @@ void QgisAppInterface::zoomToActiveLayer()
qgis->zoomToLayerExtent();
}
QgsVectorLayer* QgisAppInterface::addVectorLayer( QString vectorLayerPath, QString baseName, QString providerKey )
QgsVectorLayer* QgisAppInterface::addVectorLayer( const QString& vectorLayerPath, const QString& baseName, const QString& providerKey )
{
if ( baseName.isEmpty() )
QString nonNullBaseBame = baseName;
if ( nonNullBaseBame.isEmpty() )
{
QFileInfo fi( vectorLayerPath );
baseName = fi.completeBaseName();
nonNullBaseBame = fi.completeBaseName();
}
return qgis->addVectorLayer( vectorLayerPath, baseName, providerKey );
return qgis->addVectorLayer( vectorLayerPath, nonNullBaseBame, providerKey );
}
QgsRasterLayer* QgisAppInterface::addRasterLayer( QString rasterLayerPath, QString baseName )
QgsRasterLayer* QgisAppInterface::addRasterLayer( const QString& rasterLayerPath, const QString& baseName )
{
if ( baseName.isEmpty() )
QString nonNullBaseBame = baseName;
if ( nonNullBaseBame.isEmpty() )
{
QFileInfo fi( rasterLayerPath );
baseName = fi.completeBaseName();
nonNullBaseBame = fi.completeBaseName();
}
return qgis->addRasterLayer( rasterLayerPath, baseName );
return qgis->addRasterLayer( rasterLayerPath, nonNullBaseBame );
}
QgsRasterLayer* QgisAppInterface::addRasterLayer( const QString& url, const QString& baseName, const QString& providerKey )
@ -136,7 +138,7 @@ QgsRasterLayer* QgisAppInterface::addRasterLayer( const QString& url, const QStr
return qgis->addRasterLayer( url, baseName, providerKey );
}
bool QgisAppInterface::addProject( QString theProjectName )
bool QgisAppInterface::addProject( const QString& theProjectName )
{
return qgis->addProject( theProjectName );
}
@ -156,7 +158,7 @@ bool QgisAppInterface::setActiveLayer( QgsMapLayer *layer )
return qgis->setActiveLayer( layer );
}
void QgisAppInterface::addPluginToMenu( QString name, QAction* action )
void QgisAppInterface::addPluginToMenu( const QString& name, QAction* action )
{
qgis->addPluginToMenu( name, action );
}
@ -171,47 +173,47 @@ void QgisAppInterface::removeAddLayerAction( QAction *action )
qgis->removeAddLayerAction( action );
}
void QgisAppInterface::removePluginMenu( QString name, QAction* action )
void QgisAppInterface::removePluginMenu( const QString& name, QAction* action )
{
qgis->removePluginMenu( name, action );
}
void QgisAppInterface::addPluginToDatabaseMenu( QString name, QAction* action )
void QgisAppInterface::addPluginToDatabaseMenu( const QString& name, QAction* action )
{
qgis->addPluginToDatabaseMenu( name, action );
}
void QgisAppInterface::removePluginDatabaseMenu( QString name, QAction* action )
void QgisAppInterface::removePluginDatabaseMenu( const QString& name, QAction* action )
{
qgis->removePluginDatabaseMenu( name, action );
}
void QgisAppInterface::addPluginToRasterMenu( QString name, QAction* action )
void QgisAppInterface::addPluginToRasterMenu( const QString& name, QAction* action )
{
qgis->addPluginToRasterMenu( name, action );
}
void QgisAppInterface::removePluginRasterMenu( QString name, QAction* action )
void QgisAppInterface::removePluginRasterMenu( const QString& name, QAction* action )
{
qgis->removePluginRasterMenu( name, action );
}
void QgisAppInterface::addPluginToVectorMenu( QString name, QAction* action )
void QgisAppInterface::addPluginToVectorMenu( const QString& name, QAction* action )
{
qgis->addPluginToVectorMenu( name, action );
}
void QgisAppInterface::removePluginVectorMenu( QString name, QAction* action )
void QgisAppInterface::removePluginVectorMenu( const QString& name, QAction* action )
{
qgis->removePluginVectorMenu( name, action );
}
void QgisAppInterface::addPluginToWebMenu( QString name, QAction* action )
void QgisAppInterface::addPluginToWebMenu( const QString& name, QAction* action )
{
qgis->addPluginToWebMenu( name, action );
}
void QgisAppInterface::removePluginWebMenu( QString name, QAction* action )
void QgisAppInterface::removePluginWebMenu( const QString& name, QAction* action )
{
qgis->removePluginWebMenu( name, action );
}
@ -291,7 +293,7 @@ void QgisAppInterface::removeWebToolBarIcon( QAction *qAction )
qgis->removeWebToolBarIcon( qAction );
}
QToolBar* QgisAppInterface::addToolBar( QString name )
QToolBar* QgisAppInterface::addToolBar( const QString& name )
{
return qgis->addToolBar( name );
}
@ -301,7 +303,7 @@ void QgisAppInterface::addToolBar( QToolBar *toolbar, Qt::ToolBarArea area )
return qgis->addToolBar( toolbar, area );
}
void QgisAppInterface::openURL( QString url, bool useQgisDocDirectory )
void QgisAppInterface::openURL( const QString& url, bool useQgisDocDirectory )
{
qgis->openURL( url, useQgisDocDirectory );
}
@ -359,7 +361,7 @@ QList<QgsComposerView*> QgisAppInterface::activeComposers()
return composerViewList;
}
QgsComposerView* QgisAppInterface::createNewComposer( QString title )
QgsComposerView* QgisAppInterface::createNewComposer( const QString& title )
{
QgsComposer* composerObj = 0;
composerObj = qgis->createNewComposer( title );
@ -370,7 +372,7 @@ QgsComposerView* QgisAppInterface::createNewComposer( QString title )
return 0;
}
QgsComposerView* QgisAppInterface::duplicateComposer( QgsComposerView* composerView, QString title )
QgsComposerView* QgisAppInterface::duplicateComposer( QgsComposerView* composerView, const QString& title )
{
QgsComposer* composerObj = 0;
composerObj = qobject_cast<QgsComposer *>( composerView->composerWindow() );
@ -463,7 +465,7 @@ void QgisAppInterface::removeWindow( QAction *action )
qgis->removeWindow( action );
}
bool QgisAppInterface::registerMainWindowAction( QAction* action, QString defaultShortcut )
bool QgisAppInterface::registerMainWindowAction( QAction* action, const QString& defaultShortcut )
{
return QgsShortcutsManager::instance()->registerAction( action, defaultShortcut );
}
@ -624,7 +626,7 @@ bool QgisAppInterface::openFeatureForm( QgsVectorLayer *vlayer, QgsFeature &f, b
}
}
void QgisAppInterface::preloadForm( QString uifile )
void QgisAppInterface::preloadForm( const QString& uifile )
{
QSignalMapper* signalMapper = new QSignalMapper( this );
mTimer = new QTimer( this );
@ -638,7 +640,7 @@ void QgisAppInterface::preloadForm( QString uifile )
mTimer->start( 0 );
}
void QgisAppInterface::cacheloadForm( QString uifile )
void QgisAppInterface::cacheloadForm( const QString& uifile )
{
QFile file( uifile );

View File

@ -63,14 +63,14 @@ class APP_EXPORT QgisAppInterface : public QgisInterface
void zoomToActiveLayer() override;
//! Add a vector layer
QgsVectorLayer* addVectorLayer( QString vectorLayerPath, QString baseName, QString providerKey ) override;
QgsVectorLayer* addVectorLayer( const QString& vectorLayerPath, const QString& baseName, const QString& providerKey ) override;
//! Add a raster layer given its file name
QgsRasterLayer* addRasterLayer( QString rasterLayerPath, QString baseName ) override;
QgsRasterLayer* addRasterLayer( const QString& rasterLayerPath, const QString& baseName ) override;
//! Add a WMS layer
QgsRasterLayer* addRasterLayer( const QString& url, const QString& baseName, const QString& providerKey ) override;
//! Add a project
bool addProject( QString theProjectName ) override;
bool addProject( const QString& theProjectName ) override;
//! Start a new blank project
void newProject( bool thePromptToSaveFlag = false ) override;
@ -147,7 +147,7 @@ class APP_EXPORT QgisAppInterface : public QgisInterface
void removeWebToolBarIcon( QAction *qAction ) override;
//! Add toolbar with specified name
QToolBar* addToolBar( QString name ) override;
QToolBar* addToolBar( const QString& name ) override;
//! Add a toolbar
//! @note added in 2.3
@ -163,7 +163,7 @@ class APP_EXPORT QgisAppInterface : public QgisInterface
#ifndef Q_MOC_RUN
Q_DECL_DEPRECATED
#endif
void openURL( QString url, bool useQgisDocDirectory = true ) override;
void openURL( const QString& url, bool useQgisDocDirectory = true ) override;
/** Return a pointer to the map canvas used by qgisapp */
QgsMapCanvas * mapCanvas() override;
@ -199,7 +199,7 @@ class APP_EXPORT QgisAppInterface : public QgisInterface
* @return pointer to composer's view
* @note new composer window will be shown and activated
*/
QgsComposerView* createNewComposer( QString title = QString() ) override;
QgsComposerView* createNewComposer( const QString& title = QString() ) override;
// ### QGIS 3: return QgsComposer*, not QgsComposerView*
/** Duplicate an existing parent composer from composer view
@ -208,7 +208,7 @@ class APP_EXPORT QgisAppInterface : public QgisInterface
* @return pointer to duplicate composer's view
* @note dupicate composer window will be hidden until loaded, then shown and activated
*/
QgsComposerView* duplicateComposer( QgsComposerView* composerView, QString title = QString() ) override;
QgsComposerView* duplicateComposer( QgsComposerView* composerView, const QString& title = QString() ) override;
/** Deletes parent composer of composer view, after closing composer window */
void deleteComposer( QgsComposerView* composerView ) override;
@ -227,29 +227,29 @@ class APP_EXPORT QgisAppInterface : public QgisInterface
QFont defaultStyleSheetFont() override;
/** Add action to the plugins menu */
void addPluginToMenu( QString name, QAction* action ) override;
void addPluginToMenu( const QString& name, QAction* action ) override;
/** Remove action from the plugins menu */
void removePluginMenu( QString name, QAction* action ) override;
void removePluginMenu( const QString& name, QAction* action ) override;
/** Add action to the Database menu */
void addPluginToDatabaseMenu( QString name, QAction* action ) override;
void addPluginToDatabaseMenu( const QString& name, QAction* action ) override;
/** Remove action from the Database menu */
void removePluginDatabaseMenu( QString name, QAction* action ) override;
void removePluginDatabaseMenu( const QString& name, QAction* action ) override;
/** Add action to the Raster menu */
void addPluginToRasterMenu( QString name, QAction* action ) override;
void addPluginToRasterMenu( const QString& name, QAction* action ) override;
/** Remove action from the Raster menu */
void removePluginRasterMenu( QString name, QAction* action ) override;
void removePluginRasterMenu( const QString& name, QAction* action ) override;
/** Add action to the Vector menu */
void addPluginToVectorMenu( QString name, QAction* action ) override;
void addPluginToVectorMenu( const QString& name, QAction* action ) override;
/** Remove action from the Raster menu */
void removePluginVectorMenu( QString name, QAction* action ) override;
void removePluginVectorMenu( const QString& name, QAction* action ) override;
/** Add action to the Web menu */
void addPluginToWebMenu( QString name, QAction* action ) override;
void addPluginToWebMenu( const QString& name, QAction* action ) override;
/** Remove action from the Web menu */
void removePluginWebMenu( QString name, QAction* action ) override;
void removePluginWebMenu( const QString& name, QAction* action ) override;
/** Add "add layer" action to the layer menu */
void insertAddLayerAction( QAction *action ) override;
@ -283,7 +283,7 @@ class APP_EXPORT QgisAppInterface : public QgisInterface
virtual void removeWindow( QAction *action ) override;
/** Register action to the shortcuts manager so its shortcut can be changed in GUI. */
virtual bool registerMainWindowAction( QAction* action, QString defaultShortcut ) override;
virtual bool registerMainWindowAction( QAction* action, const QString& defaultShortcut ) override;
/** Unregister a previously registered action. (e.g. when plugin is going to be unloaded. */
virtual bool unregisterMainWindowAction( QAction* action ) override;
@ -466,7 +466,7 @@ class APP_EXPORT QgisAppInterface : public QgisInterface
*
* More information here: http://qt-project.org/forums/viewthread/27098/
*/
virtual void preloadForm( QString uifile ) override;
virtual void preloadForm( const QString& uifile ) override;
/** Return vector layers in edit mode
* @param modified whether to return only layers that have been modified
@ -482,7 +482,7 @@ class APP_EXPORT QgisAppInterface : public QgisInterface
private slots:
void cacheloadForm( QString uifile );
void cacheloadForm( const QString& uifile );
private:

View File

@ -37,7 +37,7 @@ QgsHandleBadLayersHandler::QgsHandleBadLayersHandler()
{
}
void QgsHandleBadLayersHandler::handleBadLayers( QList<QDomNode> layers, QDomDocument projectDom )
void QgsHandleBadLayersHandler::handleBadLayers( const QList<QDomNode>& layers, const QDomDocument& projectDom )
{
QApplication::setOverrideCursor( Qt::ArrowCursor );
QgsHandleBadLayers *dialog = new QgsHandleBadLayers( layers, projectDom );

View File

@ -30,7 +30,7 @@ class APP_EXPORT QgsHandleBadLayersHandler
QgsHandleBadLayersHandler();
/** Implementation of the handler */
virtual void handleBadLayers( QList<QDomNode> layers, QDomDocument projectDom ) override;
virtual void handleBadLayers( const QList<QDomNode>& layers, const QDomDocument& projectDom ) override;
};

View File

@ -896,30 +896,32 @@ void QgsApplication::registerOgrDrivers()
}
}
QString QgsApplication::absolutePathToRelativePath( QString aPath, QString targetPath )
QString QgsApplication::absolutePathToRelativePath( const QString& aPath, const QString& targetPath )
{
QString aPathUrl = aPath;
QString tPathUrl = targetPath;
#if defined( Q_OS_WIN )
const Qt::CaseSensitivity cs = Qt::CaseInsensitive;
aPath.replace( "\\", "/" );
if ( aPath.startsWith( "//" ) )
aPathUrl.replace( "\\", "/" );
if ( aPathUrl.startsWith( "//" ) )
{
// keep UNC prefix
aPath = "\\\\" + aPath.mid( 2 );
aPathUrl = "\\\\" + aPathUrl.mid( 2 );
}
targetPath.replace( "\\", "/" );
if ( targetPath.startsWith( "//" ) )
tPathUrl.replace( "\\", "/" );
if ( tPathUrl.startsWith( "//" ) )
{
// keep UNC prefix
targetPath = "\\\\" + targetPath.mid( 2 );
tPathUrl = "\\\\" + tPathUrl.mid( 2 );
}
#else
const Qt::CaseSensitivity cs = Qt::CaseSensitive;
#endif
QStringList targetElems = targetPath.split( "/", QString::SkipEmptyParts );
QStringList aPathElems = aPath.split( "/", QString::SkipEmptyParts );
QStringList targetElems = tPathUrl.split( "/", QString::SkipEmptyParts );
QStringList aPathElems = aPathUrl.split( "/", QString::SkipEmptyParts );
targetElems.removeAll( "." );
aPathElems.removeAll( "." );
@ -938,7 +940,7 @@ QString QgsApplication::absolutePathToRelativePath( QString aPath, QString targe
if ( n == 0 )
{
// no common parts; might not even be a file
return aPath;
return aPathUrl;
}
if ( targetElems.size() > 0 )
@ -959,7 +961,7 @@ QString QgsApplication::absolutePathToRelativePath( QString aPath, QString targe
return aPathElems.join( "/" );
}
QString QgsApplication::relativePathToAbsolutePath( QString rpath, QString targetPath )
QString QgsApplication::relativePathToAbsolutePath( const QString& rpath, const QString& targetPath )
{
// relative path should always start with ./ or ../
if ( !rpath.startsWith( "./" ) && !rpath.startsWith( "../" ) )
@ -967,15 +969,18 @@ QString QgsApplication::relativePathToAbsolutePath( QString rpath, QString targe
return rpath;
}
#if defined(Q_OS_WIN)
rpath.replace( "\\", "/" );
targetPath.replace( "\\", "/" );
QString rPathUrl = rpath;
QString targetPathUrl = targetPath;
bool uncPath = targetPath.startsWith( "//" );
#if defined(Q_OS_WIN)
rPathUrl.replace( "\\", "/" );
targetPathUrl.replace( "\\", "/" );
bool uncPath = targetPathUrl.startsWith( "//" );
#endif
QStringList srcElems = rpath.split( "/", QString::SkipEmptyParts );
QStringList targetElems = targetPath.split( "/", QString::SkipEmptyParts );
QStringList srcElems = rPathUrl.split( "/", QString::SkipEmptyParts );
QStringList targetElems = targetPathUrl.split( "/", QString::SkipEmptyParts );
#if defined(Q_OS_WIN)
if ( uncPath )

View File

@ -274,9 +274,9 @@ class CORE_EXPORT QgsApplication : public QApplication
static void registerOgrDrivers();
/** Converts absolute path to path relative to target */
static QString absolutePathToRelativePath( QString apath, QString targetPath );
static QString absolutePathToRelativePath( const QString& apath, const QString& targetPath );
/** Converts path relative to target to an absolute path */
static QString relativePathToAbsolutePath( QString rpath, QString targetPath );
static QString relativePathToAbsolutePath( const QString& rpath, const QString& targetPath );
/** Indicates whether running from build directory (not installed) */
static bool isRunningFromBuildDir() { return ABISYM( mRunningFromBuildDir ); }

View File

@ -470,7 +470,7 @@ void QgsDataItem::refresh()
}
}
void QgsDataItem::refresh( QVector<QgsDataItem*> children )
void QgsDataItem::refresh( const QVector<QgsDataItem*>& children )
{
QgsDebugMsgLevel( "mPath = " + mPath, 2 );

View File

@ -35,7 +35,7 @@
class QgsDataProvider;
class QgsDataItem;
typedef QgsDataItem * dataItem_t( QString, QgsDataItem* );
typedef QgsDataItem * dataItem_t( const QString&, QgsDataItem* );
/** Animated icon is keeping an animation running if there are listeners connected to frameChanged */
class CORE_EXPORT QgsAnimatedIcon : public QObject
@ -152,7 +152,7 @@ class CORE_EXPORT QgsDataItem : public QObject
Q_DECLARE_FLAGS( Capabilities, Capability )
// This will _write_ selected crs in data source
virtual bool setCrs( QgsCoordinateReferenceSystem crs )
virtual bool setCrs( const QgsCoordinateReferenceSystem& crs )
{ Q_UNUSED( crs ); return false; }
//! @deprecated since 2.8, returned type this will changed to Capabilities
@ -203,7 +203,7 @@ class CORE_EXPORT QgsDataItem : public QObject
protected:
virtual void populate( const QVector<QgsDataItem*>& children );
virtual void refresh( QVector<QgsDataItem*> children );
virtual void refresh( const QVector<QgsDataItem*>& children );
/** The item is scheduled to be deleted. E.g. if deleteLater() is called when
* item is in Populating state (createChildren() running in another thread),
* the deferredDelete() returns true and item will be deleted once Populating finished.

View File

@ -141,7 +141,7 @@ class CORE_EXPORT QgsDataProvider : public QObject
* that can be used by the data provider to create a subset.
* Must be implemented in the dataprovider.
*/
virtual bool setSubsetString( QString subset, bool updateFeatureCount = true )
virtual bool setSubsetString( const QString& subset, bool updateFeatureCount = true )
{
// NOP by default
Q_UNUSED( subset );

View File

@ -1990,7 +1990,7 @@ bool QgsProject::topologicalEditing() const
return ( QgsProject::instance()->readNumEntry( "Digitizing", "/TopologicalEditing", 0 ) > 0 );
}
void QgsProjectBadLayerDefaultHandler::handleBadLayers( QList<QDomNode> /*layers*/, QDomDocument /*projectDom*/ )
void QgsProjectBadLayerDefaultHandler::handleBadLayers( const QList<QDomNode>& /*layers*/, const QDomDocument& /*projectDom*/ )
{
// just ignore any bad layers
}

View File

@ -415,7 +415,7 @@ class CORE_EXPORT QgsProject : public QObject
class CORE_EXPORT QgsProjectBadLayerHandler
{
public:
virtual void handleBadLayers( QList<QDomNode> layers, QDomDocument projectDom ) = 0;
virtual void handleBadLayers( const QList<QDomNode>& layers, const QDomDocument& projectDom ) = 0;
virtual ~QgsProjectBadLayerHandler() {}
};
@ -424,7 +424,7 @@ class CORE_EXPORT QgsProjectBadLayerHandler
class CORE_EXPORT QgsProjectBadLayerDefaultHandler : public QgsProjectBadLayerHandler
{
public:
virtual void handleBadLayers( QList<QDomNode> layers, QDomDocument projectDom ) override;
virtual void handleBadLayers( const QList<QDomNode>& layers, const QDomDocument& projectDom ) override;
};

View File

@ -42,7 +42,7 @@ typedef QString databaseDrivers_t();
typedef QString directoryDrivers_t();
typedef QString protocolDrivers_t();
//typedef int dataCapabilities_t();
//typedef QgsDataItem * dataItem_t(QString);
//typedef QgsDataItem * dataItem_t(const QString&);

View File

@ -50,9 +50,9 @@ class CORE_EXPORT QgsPythonRunner
QgsPythonRunner();
virtual ~QgsPythonRunner();
virtual bool runCommand( QString command, QString messageOnError = QString() ) = 0;
virtual bool runCommand( const QString& command, const QString& messageOnError = QString() ) = 0;
virtual bool evalCommand( QString command, QString& result ) = 0;
virtual bool evalCommand( const QString& command, QString& result ) = 0;
static QgsPythonRunner* mInstance;
};

View File

@ -244,7 +244,7 @@ bool QgsRenderChecker::runTest( const QString& theTestName,
bool QgsRenderChecker::compareImages( const QString& theTestName,
unsigned int theMismatchCount,
QString theRenderedImageFile )
const QString& theRenderedImageFile )
{
if ( mExpectedImageFile.isEmpty() )
{

View File

@ -128,7 +128,7 @@ class CORE_EXPORT QgsRenderChecker
* @param theRenderedImageFile to optionally override the output filename
* @note: make sure to call setExpectedImage and setRenderedImage first.
*/
bool compareImages( const QString& theTestName, unsigned int theMismatchCount = 0, QString theRenderedImageFile = "" );
bool compareImages( const QString& theTestName, unsigned int theMismatchCount = 0, const QString& theRenderedImageFile = "" );
/** Get a list of all the anomalies. An anomaly is a rendered difference
* file where there is some red pixel content (indicating a render check
* mismatch), but where the output was still acceptible. If the render

View File

@ -116,7 +116,7 @@ typedef int listStyles_t(
typedef QString getStyleById_t(
const QString& uri,
QString styleID,
const QString& styleID,
QString& errCause
);

View File

@ -281,7 +281,7 @@ class CORE_EXPORT QgsRasterDataProvider : public QgsDataProvider, public QgsRast
* ACTUALLY exists you need to look at the existsFlag member in each struct stored in the
* list.
*/
virtual QList<QgsRasterPyramid> buildPyramidList( QList<int> overviewList = QList<int>() )
virtual QList<QgsRasterPyramid> buildPyramidList( const QList<int>& overviewList = QList<int>() )
{ Q_UNUSED( overviewList ); return QList<QgsRasterPyramid>(); }
/** \brief Returns true if raster has at least one populated histogram. */
@ -393,7 +393,7 @@ class CORE_EXPORT QgsRasterDataProvider : public QgsDataProvider, public QgsRast
/** Validates creation options for a specific dataset and destination format.
* @note used by GDAL provider only
* @note see also validateCreationOptionsFormat() in gdal provider for validating options based on format only */
virtual QString validateCreationOptions( const QStringList& createOptions, QString format )
virtual QString validateCreationOptions( const QStringList& createOptions, const QString& format )
{ Q_UNUSED( createOptions ); Q_UNUSED( format ); return QString(); }
/** Validates pyramid creation options for a specific dataset and destination format

View File

@ -97,16 +97,16 @@ class GUI_EXPORT QgisInterface : public QObject
virtual void zoomToActiveLayer() = 0;
//! Add a vector layer
virtual QgsVectorLayer* addVectorLayer( QString vectorLayerPath, QString baseName, QString providerKey ) = 0;
virtual QgsVectorLayer* addVectorLayer( const QString& vectorLayerPath, const QString& baseName, const QString& providerKey ) = 0;
//! Add a raster layer given a raster layer file name
virtual QgsRasterLayer* addRasterLayer( QString rasterLayerPath, QString baseName = QString() ) = 0;
virtual QgsRasterLayer* addRasterLayer( const QString& rasterLayerPath, const QString& baseName = QString() ) = 0;
//! Add a WMS layer
virtual QgsRasterLayer* addRasterLayer( const QString& url, const QString& layerName, const QString& providerKey ) = 0;
//! Add a project
virtual bool addProject( QString theProject ) = 0;
virtual bool addProject( const QString& theProject ) = 0;
//! Start a blank project
virtual void newProject( bool thePromptToSaveFlag = false ) = 0;
@ -198,7 +198,7 @@ class GUI_EXPORT QgisInterface : public QObject
virtual void removeWebToolBarIcon( QAction *qAction ) = 0;
//! Add toolbar with specified name
virtual QToolBar *addToolBar( QString name ) = 0;
virtual QToolBar *addToolBar( const QString& name ) = 0;
//! Add a toolbar
//! @note added in 2.3
@ -234,7 +234,7 @@ class GUI_EXPORT QgisInterface : public QObject
* @return pointer to composer's view
* @note new composer window will be shown and activated
*/
virtual QgsComposerView* createNewComposer( QString title = QString() ) = 0;
virtual QgsComposerView* createNewComposer( const QString& title = QString() ) = 0;
/** Duplicate an existing parent composer from composer view
* @param composerView pointer to existing composer view
@ -242,7 +242,7 @@ class GUI_EXPORT QgisInterface : public QObject
* @return pointer to duplicate composer's view
* @note dupicate composer window will be hidden until loaded, then shown and activated
*/
virtual QgsComposerView* duplicateComposer( QgsComposerView* composerView, QString title = QString() ) = 0;
virtual QgsComposerView* duplicateComposer( QgsComposerView* composerView, const QString& title = QString() ) = 0;
/** Deletes parent composer of composer view, after closing composer window */
virtual void deleteComposer( QgsComposerView* composerView ) = 0;
@ -262,10 +262,10 @@ class GUI_EXPORT QgisInterface : public QObject
virtual QFont defaultStyleSheetFont() = 0;
/** Add action to the plugins menu */
virtual void addPluginToMenu( QString name, QAction* action ) = 0;
virtual void addPluginToMenu( const QString& name, QAction* action ) = 0;
/** Remove action from the plugins menu */
virtual void removePluginMenu( QString name, QAction* action ) = 0;
virtual void removePluginMenu( const QString& name, QAction* action ) = 0;
/** Add "add layer" action to layer menu */
virtual void insertAddLayerAction( QAction *action ) = 0;
@ -274,28 +274,28 @@ class GUI_EXPORT QgisInterface : public QObject
virtual void removeAddLayerAction( QAction *action ) = 0;
/** Add action to the Database menu */
virtual void addPluginToDatabaseMenu( QString name, QAction* action ) = 0;
virtual void addPluginToDatabaseMenu( const QString& name, QAction* action ) = 0;
/** Remove action from the Database menu */
virtual void removePluginDatabaseMenu( QString name, QAction* action ) = 0;
virtual void removePluginDatabaseMenu( const QString& name, QAction* action ) = 0;
/** Add action to the Raster menu */
virtual void addPluginToRasterMenu( QString name, QAction* action ) = 0;
virtual void addPluginToRasterMenu( const QString& name, QAction* action ) = 0;
/** Remove action from the Raster menu */
virtual void removePluginRasterMenu( QString name, QAction* action ) = 0;
virtual void removePluginRasterMenu( const QString& name, QAction* action ) = 0;
/** Add action to the Vector menu */
virtual void addPluginToVectorMenu( QString name, QAction* action ) = 0;
virtual void addPluginToVectorMenu( const QString& name, QAction* action ) = 0;
/** Remove action from the Vector menu */
virtual void removePluginVectorMenu( QString name, QAction* action ) = 0;
virtual void removePluginVectorMenu( const QString& name, QAction* action ) = 0;
/** Add action to the Web menu */
virtual void addPluginToWebMenu( QString name, QAction* action ) = 0;
virtual void addPluginToWebMenu( const QString& name, QAction* action ) = 0;
/** Remove action from the Web menu */
virtual void removePluginWebMenu( QString name, QAction* action ) = 0;
virtual void removePluginWebMenu( const QString& name, QAction* action ) = 0;
/** Add a dock widget to the main window */
virtual void addDockWidget( Qt::DockWidgetArea area, QDockWidget * dockwidget ) = 0;
@ -323,7 +323,7 @@ class GUI_EXPORT QgisInterface : public QObject
virtual void removeWindow( QAction *action ) = 0;
/** Register action to the shortcuts manager so its shortcut can be changed in GUI */
virtual bool registerMainWindowAction( QAction* action, QString defaultShortcut ) = 0;
virtual bool registerMainWindowAction( QAction* action, const QString& defaultShortcut ) = 0;
/** Unregister a previously registered action. (e.g. when plugin is going to be unloaded) */
virtual bool unregisterMainWindowAction( QAction* action ) = 0;
@ -340,7 +340,7 @@ class GUI_EXPORT QgisInterface : public QObject
#ifndef Q_MOC_RUN
Q_DECL_DEPRECATED
#endif
virtual void openURL( QString url, bool useQgisDocDirectory = true ) = 0;
virtual void openURL( const QString& url, bool useQgisDocDirectory = true ) = 0;
/** Accessors for inserting items into menus and toolbars.
@ -551,7 +551,7 @@ class GUI_EXPORT QgisInterface : public QObject
*
* More information here: http://qt-project.org/forums/viewthread/27098/
*/
virtual void preloadForm( QString uifile ) = 0;
virtual void preloadForm( const QString& uifile ) = 0;
/** Return vector layers in edit mode
* @param modified whether to return only layers that have been modified

View File

@ -31,7 +31,7 @@ QgsProjectBadLayerGuiHandler::QgsProjectBadLayerGuiHandler()
bool QgsProjectBadLayerGuiHandler::mIgnore = false;
void QgsProjectBadLayerGuiHandler::handleBadLayers( QList<QDomNode> layers, QDomDocument projectDom )
void QgsProjectBadLayerGuiHandler::handleBadLayers( const QList<QDomNode>& layers, const QDomDocument& projectDom )
{
Q_UNUSED( projectDom );

View File

@ -30,7 +30,7 @@ class GUI_EXPORT QgsProjectBadLayerGuiHandler : public QObject, public QgsProjec
QgsProjectBadLayerGuiHandler();
/** Implementation of the handler */
virtual void handleBadLayers( QList<QDomNode> layers, QDomDocument projectDom ) override;
virtual void handleBadLayers( const QList<QDomNode>& layers, const QDomDocument& projectDom ) override;
/** Flag to store the Ignore button press of MessageBox used by QgsLegend */
static bool mIgnore;

View File

@ -234,8 +234,8 @@ void QgsRasterFormatSaveOptionsWidget::apply()
}
// typedefs for gdal provider function pointers
typedef QString validateCreationOptionsFormat_t( const QStringList& createOptions, QString format );
typedef QString helpCreationOptionsFormat_t( QString format );
typedef QString validateCreationOptionsFormat_t( const QStringList& createOptions, const QString& format );
typedef QString helpCreationOptionsFormat_t( const QString& format );
void QgsRasterFormatSaveOptionsWidget::helpOptions()
{

View File

@ -30,7 +30,7 @@
#include <QUrl>
QgsDelimitedTextFile::QgsDelimitedTextFile( QString url ) :
QgsDelimitedTextFile::QgsDelimitedTextFile( const QString& url ) :
mFileName( QString() ),
mEncoding( "UTF-8" ),
mFile( 0 ),
@ -136,7 +136,7 @@ void QgsDelimitedTextFile::resetDefinition()
}
// Extract the provider definition from the url
bool QgsDelimitedTextFile::setFromUrl( QString url )
bool QgsDelimitedTextFile::setFromUrl( const QString& url )
{
QUrl qurl = QUrl::fromEncoded( url.toAscii() );
return setFromUrl( qurl );
@ -308,13 +308,13 @@ QUrl QgsDelimitedTextFile::url()
return url;
}
void QgsDelimitedTextFile::setFileName( QString filename )
void QgsDelimitedTextFile::setFileName( const QString& filename )
{
resetDefinition();
mFileName = filename;
}
void QgsDelimitedTextFile::setEncoding( QString encoding )
void QgsDelimitedTextFile::setEncoding( const QString& encoding )
{
resetDefinition();
mEncoding = encoding;
@ -341,7 +341,7 @@ void QgsDelimitedTextFile::setTypeWhitespace()
mType = DelimTypeWhitespace;
}
void QgsDelimitedTextFile::setTypeRegexp( QString regexp )
void QgsDelimitedTextFile::setTypeRegexp( const QString& regexp )
{
resetDefinition();
mType = DelimTypeRegexp;
@ -372,7 +372,7 @@ QString QgsDelimitedTextFile::encodeChars( QString chars )
return chars;
}
void QgsDelimitedTextFile::setTypeCSV( QString delim, QString quote, QString escape )
void QgsDelimitedTextFile::setTypeCSV( const QString& delim, const QString& quote, const QString& escape )
{
resetDefinition();
mType = DelimTypeCSV;
@ -484,7 +484,7 @@ QStringList &QgsDelimitedTextFile::fieldNames()
return mFieldNames;
}
int QgsDelimitedTextFile::fieldIndex( QString name )
int QgsDelimitedTextFile::fieldIndex( const QString& name )
{
// If not yet opened then reset file to read column headers
//

View File

@ -94,14 +94,14 @@ class QgsDelimitedTextFile : public QObject
DelimTypeRegexp
};
explicit QgsDelimitedTextFile( QString url = QString() );
explicit QgsDelimitedTextFile( const QString& url = QString() );
virtual ~QgsDelimitedTextFile();
/** Set the filename
* @param filename the name of the file
*/
void setFileName( QString filename );
void setFileName( const QString& filename );
/** Return the filename
* @return filename the name of the file
*/
@ -113,7 +113,7 @@ class QgsDelimitedTextFile : public QObject
/** Set the file encoding (defuault is UTF-8)
* @param encoding the encoding to use for the fileName()
*/
void setEncoding( QString encoding );
void setEncoding( const QString& encoding );
/** Return the file encoding
* @return encoding The file encoding
*/
@ -122,7 +122,7 @@ class QgsDelimitedTextFile : public QObject
/** Decode the parser settings from a url as a string
* @param url The url from which the delimiter and delimiterType items are read
*/
bool setFromUrl( QString url );
bool setFromUrl( const QString& url );
/** Decode the parser settings from a url
* @param url The url from which the delimiter and delimiterType items are read
*/
@ -140,14 +140,14 @@ class QgsDelimitedTextFile : public QObject
/** Set the parser for parsing based on a reqular expression delimiter
@param regexp A string defining the regular expression
*/
void setTypeRegexp( QString regexp );
void setTypeRegexp( const QString& regexp );
/** Set the parser to use a character type delimiter.
* @param delim The field delimiter character set
* @param quote The quote character, used to define quoted fields
* @param escape The escape character used to escape quote or delim
* characters.
*/
void setTypeCSV( QString delim = QString( "," ), QString quote = QString( "\"" ), QString escape = QString( "\"" ) );
void setTypeCSV( const QString& delim = QString( "," ), const QString& quote = QString( "\"" ), const QString& escape = QString( "\"" ) );
/** Set the number of header lines to skip
* @param skiplines The maximum lines to skip
@ -231,7 +231,7 @@ class QgsDelimitedTextFile : public QObject
* @return index The zero based index of the field name, or -1 if the field
* name does not exist or cannot be inferred
*/
int fieldIndex( QString name );
int fieldIndex( const QString& name );
/** Reads the next record from the stream splits into string fields.
* @param fields The string list to populate with the fields

View File

@ -57,7 +57,7 @@ QRegExp QgsDelimitedTextProvider::WktZMRegexp( "\\s*(?:z|m|zm)(?=\\s*\\()", Qt::
QRegExp QgsDelimitedTextProvider::WktCrdRegexp( "(\\-?\\d+(?:\\.\\d*)?\\s+\\-?\\d+(?:\\.\\d*)?)\\s[\\s\\d\\.\\-]+" );
QRegExp QgsDelimitedTextProvider::CrdDmsRegexp( "^\\s*(?:([-+nsew])\\s*)?(\\d{1,3})(?:[^0-9.]+([0-5]?\\d))?[^0-9.]+([0-5]?\\d(?:\\.\\d+)?)[^0-9.]*([-+nsew])?\\s*$", Qt::CaseInsensitive );
QgsDelimitedTextProvider::QgsDelimitedTextProvider( QString uri )
QgsDelimitedTextProvider::QgsDelimitedTextProvider( const QString& uri )
: QgsVectorDataProvider( uri )
, mLayerValid( false )
, mValid( false )
@ -204,7 +204,7 @@ QgsAbstractFeatureSource *QgsDelimitedTextProvider::featureSource() const
return new QgsDelimitedTextFeatureSource( this );
}
QStringList QgsDelimitedTextProvider::readCsvtFieldTypes( QString filename, QString *message )
QStringList QgsDelimitedTextProvider::readCsvtFieldTypes( const QString& filename, QString *message )
{
// Look for a file with the same name as the data file, but an extra 't' or 'T' at the end
QStringList types;
@ -926,7 +926,7 @@ bool QgsDelimitedTextProvider::recordIsEmpty( QStringList &record )
return true;
}
void QgsDelimitedTextProvider::recordInvalidLine( QString message )
void QgsDelimitedTextProvider::recordInvalidLine( const QString& message )
{
if ( mInvalidLines.size() < mMaxInvalidLines )
{
@ -938,7 +938,7 @@ void QgsDelimitedTextProvider::recordInvalidLine( QString message )
}
}
void QgsDelimitedTextProvider::reportErrors( QStringList messages, bool showDialog )
void QgsDelimitedTextProvider::reportErrors( const QStringList& messages, bool showDialog )
{
if ( !mInvalidLines.isEmpty() || ! messages.isEmpty() )
{
@ -983,22 +983,23 @@ void QgsDelimitedTextProvider::reportErrors( QStringList messages, bool showDial
}
}
bool QgsDelimitedTextProvider::setSubsetString( QString subset, bool updateFeatureCount )
bool QgsDelimitedTextProvider::setSubsetString( const QString& subset, bool updateFeatureCount )
{
// If not changing string, then oll ok, nothing to do
QString nonNullSubset = subset.isNull() ? QString( "" ) : subset;
if ( subset.isNull() ) subset = "";
if ( subset == mSubsetString ) return true;
// If not changing string, then oll ok, nothing to do
if ( nonNullSubset == mSubsetString )
return true;
bool valid = true;
// If there is a new subset string then encode it..
QgsExpression *expression = 0;
if ( ! subset.isEmpty() )
if ( ! nonNullSubset.isEmpty() )
{
expression = new QgsExpression( subset );
expression = new QgsExpression( nonNullSubset );
QString error;
if ( expression->hasParserError() )
{
@ -1019,7 +1020,7 @@ bool QgsDelimitedTextProvider::setSubsetString( QString subset, bool updateFeatu
delete expression;
expression = 0;
QString tag( "DelimitedText" );
QgsMessageLog::logMessage( tr( "Invalid subset string %1 for %2" ).arg( subset, mFile->fileName() ), tag );
QgsMessageLog::logMessage( tr( "Invalid subset string %1 for %2" ).arg( nonNullSubset, mFile->fileName() ), tag );
}
}
@ -1032,7 +1033,7 @@ bool QgsDelimitedTextProvider::setSubsetString( QString subset, bool updateFeatu
// a friend class after it has been freed but before it has been
// reassigned
QString previousSubset = mSubsetString;
mSubsetString = subset;
mSubsetString = nonNullSubset;
mSubsetExpression = expression;
if ( tmpSubsetExpression ) delete tmpSubsetExpression;
// Update the feature count and extents if requested
@ -1062,7 +1063,7 @@ bool QgsDelimitedTextProvider::setSubsetString( QString subset, bool updateFeatu
// Reset the subset index
rescanFile();
// Encode the subset string into the data source URI.
setUriParameter( "subset", subset );
setUriParameter( "subset", nonNullSubset );
}
}
else
@ -1085,7 +1086,7 @@ bool QgsDelimitedTextProvider::setSubsetString( QString subset, bool updateFeatu
return valid;
}
void QgsDelimitedTextProvider::setUriParameter( QString parameter, QString value )
void QgsDelimitedTextProvider::setUriParameter( const QString& parameter, const QString& value )
{
QUrl url = QUrl::fromEncoded( dataSourceUri().toAscii() );
if ( url.hasQueryItem( parameter ) ) url.removeAllQueryItems( parameter );

View File

@ -75,7 +75,7 @@ class QgsDelimitedTextProvider : public QgsVectorDataProvider
GeomAsWkt
};
explicit QgsDelimitedTextProvider( QString uri = QString() );
explicit QgsDelimitedTextProvider( const QString& uri = QString() );
virtual ~QgsDelimitedTextProvider();
@ -164,7 +164,7 @@ class QgsDelimitedTextProvider : public QgsVectorDataProvider
* Set the subset string used to create a subset of features in
* the layer.
*/
virtual bool setSubsetString( QString subset, bool updateFeatureCount = true ) override;
virtual bool setSubsetString( const QString& subset, bool updateFeatureCount = true ) override;
/**
* provider supports setting of subset strings
@ -209,7 +209,7 @@ class QgsDelimitedTextProvider : public QgsVectorDataProvider
* @param message Pointer to a string to receive a status message
* @return A list of field type strings, empty if not found or not valid
*/
QStringList readCsvtFieldTypes( QString filename, QString *message = 0 );
QStringList readCsvtFieldTypes( const QString& filename, QString *message = 0 );
private slots:
@ -225,10 +225,10 @@ class QgsDelimitedTextProvider : public QgsVectorDataProvider
void resetCachedSubset();
void resetIndexes();
void clearInvalidLines();
void recordInvalidLine( QString message );
void reportErrors( QStringList messages = QStringList(), bool showDialog = false );
void recordInvalidLine( const QString& message );
void reportErrors( const QStringList& messages = QStringList(), bool showDialog = false );
static bool recordIsEmpty( QStringList &record );
void setUriParameter( QString parameter, QString value );
void setUriParameter( const QString& parameter, const QString& value );
static QgsGeometry *geomFromWkt( QString &sWkt, bool wktHasPrefixRegexp, bool wktHasZM );

View File

@ -224,7 +224,7 @@ QString QgsDelimitedTextSourceSelect::selectedChars()
chars.append( txtDelimiterOther->text() );
return chars;
}
void QgsDelimitedTextSourceSelect::setSelectedChars( QString delimiters )
void QgsDelimitedTextSourceSelect::setSelectedChars( const QString& delimiters )
{
QString chars = QgsDelimitedTextFile::decodeChars( delimiters );
cbxDelimComma->setChecked( chars.contains( "," ) );
@ -237,7 +237,7 @@ void QgsDelimitedTextSourceSelect::setSelectedChars( QString delimiters )
txtDelimiterOther->setText( chars );
}
void QgsDelimitedTextSourceSelect::loadSettings( QString subkey, bool loadGeomSettings )
void QgsDelimitedTextSourceSelect::loadSettings( const QString& subkey, bool loadGeomSettings )
{
QSettings settings;
@ -294,7 +294,7 @@ void QgsDelimitedTextSourceSelect::loadSettings( QString subkey, bool loadGeomSe
}
void QgsDelimitedTextSourceSelect::saveSettings( QString subkey, bool saveGeomSettings )
void QgsDelimitedTextSourceSelect::saveSettings( const QString& subkey, bool saveGeomSettings )
{
QSettings settings;
QString key = mPluginKey;
@ -331,7 +331,7 @@ void QgsDelimitedTextSourceSelect::saveSettings( QString subkey, bool saveGeomSe
}
void QgsDelimitedTextSourceSelect::loadSettingsForFile( QString filename )
void QgsDelimitedTextSourceSelect::loadSettingsForFile( const QString& filename )
{
if ( filename.isEmpty() ) return;
QFileInfo fi( filename );
@ -341,7 +341,7 @@ void QgsDelimitedTextSourceSelect::loadSettingsForFile( QString filename )
mLastFileType = filetype;
}
void QgsDelimitedTextSourceSelect::saveSettingsForFile( QString filename )
void QgsDelimitedTextSourceSelect::saveSettingsForFile( const QString& filename )
{
if ( filename.isEmpty() ) return;
QFileInfo fi( filename );
@ -567,7 +567,7 @@ void QgsDelimitedTextSourceSelect::updateFieldLists()
}
bool QgsDelimitedTextSourceSelect::trySetXYField( QStringList &fields, QList<bool> &isValidNumber, QString xname, QString yname )
bool QgsDelimitedTextSourceSelect::trySetXYField( QStringList &fields, QList<bool> &isValidNumber, const QString& xname, const QString& yname )
{
// If fields already set, then nothing to do
if ( cmbXField->currentIndex() >= 0 && cmbYField->currentIndex() >= 0 ) return true;

View File

@ -41,12 +41,12 @@ class QgsDelimitedTextSourceSelect : public QDialog, private Ui::QgsDelimitedTex
void updateFieldLists();
void getOpenFileName();
QString selectedChars();
void setSelectedChars( QString delimiters );
void loadSettings( QString subkey = QString(), bool loadGeomSettings = true );
void saveSettings( QString subkey = QString(), bool saveGeomSettings = true );
void loadSettingsForFile( QString filename );
void saveSettingsForFile( QString filename );
bool trySetXYField( QStringList &fields, QList<bool> &isValidNumber, QString xname, QString yname );
void setSelectedChars( const QString& delimiters );
void loadSettings( const QString& subkey = QString(), bool loadGeomSettings = true );
void saveSettings( const QString& subkey = QString(), bool saveGeomSettings = true );
void loadSettingsForFile( const QString& filename );
void saveSettingsForFile( const QString& filename );
bool trySetXYField( QStringList &fields, QList<bool> &isValidNumber, const QString& xname, const QString& yname );
private:
QgsDelimitedTextFile *mFile;

View File

@ -24,7 +24,7 @@ void buildSupportedRasterFileFilterAndExtensions( QString & theFileFiltersString
QgsGdalLayerItem::QgsGdalLayerItem( QgsDataItem* parent,
QString name, QString path, QString uri,
const QString& name, const QString& path, const QString& uri,
QStringList *theSublayers )
: QgsLayerItem( parent, name, path, uri, QgsLayerItem::Raster, "gdal" )
{
@ -58,7 +58,7 @@ QgsLayerItem::Capability QgsGdalLayerItem::capabilities()
return mCapabilities & SetCrs ? SetCrs : NoCapabilities;
}
bool QgsGdalLayerItem::setCrs( QgsCoordinateReferenceSystem crs )
bool QgsGdalLayerItem::setCrs( const QgsCoordinateReferenceSystem& crs )
{
GDALDatasetH hDS = GDALOpen( TO8F( mPath ), GA_Update );
if ( !hDS )

View File

@ -25,11 +25,11 @@ class QgsGdalLayerItem : public QgsLayerItem
public:
QgsGdalLayerItem( QgsDataItem* parent,
QString name, QString path, QString uri,
const QString& name, const QString& path, const QString& uri,
QStringList *theSublayers = NULL );
~QgsGdalLayerItem();
bool setCrs( QgsCoordinateReferenceSystem crs ) override;
bool setCrs( const QgsCoordinateReferenceSystem& crs ) override;
Capability capabilities() override;
QVector<QgsDataItem*> createChildren() override;

View File

@ -1781,7 +1781,7 @@ QList<QgsRasterPyramid> QgsGdalProvider::buildPyramidList()
}
#endif
QList<QgsRasterPyramid> QgsGdalProvider::buildPyramidList( QList<int> overviewList )
QList<QgsRasterPyramid> QgsGdalProvider::buildPyramidList( const QList<int>& overviewList )
{
int myWidth = mWidth;
int myHeight = mHeight;
@ -1790,7 +1790,8 @@ QList<QgsRasterPyramid> QgsGdalProvider::buildPyramidList( QList<int> overviewLi
mPyramidList.clear();
// if overviewList is empty (default) build the pyramid list
if ( overviewList.isEmpty() )
QList<int> nonEmptyList = overviewList;
if ( nonEmptyList.isEmpty() )
{
int myDivisor = 2;
@ -1798,14 +1799,14 @@ QList<QgsRasterPyramid> QgsGdalProvider::buildPyramidList( QList<int> overviewLi
while (( myWidth / myDivisor > 32 ) && (( myHeight / myDivisor ) > 32 ) )
{
overviewList.append( myDivisor );
nonEmptyList.append( myDivisor );
//sqare the divisor each step
myDivisor = ( myDivisor * 2 );
}
}
// loop over pyramid list
Q_FOREACH ( int myDivisor, overviewList )
Q_FOREACH ( int myDivisor, nonEmptyList )
{
//
// First we build up a list of potential pyramid layers
@ -1874,7 +1875,7 @@ QStringList QgsGdalProvider::subLayers() const
return mSubLayers;
}
void QgsGdalProvider::emitProgress( int theType, double theProgress, QString theMessage )
void QgsGdalProvider::emitProgress( int theType, double theProgress, const QString& theMessage )
{
emit progress( theType, theProgress, theMessage );
}
@ -2707,7 +2708,7 @@ QGISEXTERN QgsGdalProvider * create(
QGis::DataType type,
int width, int height, double* geoTransform,
const QgsCoordinateReferenceSystem& crs,
QStringList createOptions )
const QStringList& createOptions )
{
//get driver
GDALDriverH driver = GDALGetDriverByName( format.toLocal8Bit().data() );
@ -2816,7 +2817,7 @@ QGISEXTERN void buildSupportedRasterFileFilter( QString & theFileFiltersString )
/**
Gets creation options metadata for a given format
*/
QGISEXTERN QString helpCreationOptionsFormat( QString format )
QGISEXTERN QString helpCreationOptionsFormat( const QString& format )
{
QString message;
GDALDriverH myGdalDriver = GDALGetDriverByName( format.toLocal8Bit().constData() );
@ -2848,7 +2849,7 @@ QGISEXTERN QString helpCreationOptionsFormat( QString format )
/**
Validates creation options for a given format, regardless of layer.
*/
QGISEXTERN QString validateCreationOptionsFormat( const QStringList& createOptions, QString format )
QGISEXTERN QString validateCreationOptionsFormat( const QStringList& createOptions, const QString& format )
{
GDALDriverH myGdalDriver = GDALGetDriverByName( format.toLocal8Bit().constData() );
if ( ! myGdalDriver )
@ -2864,7 +2865,7 @@ QGISEXTERN QString validateCreationOptionsFormat( const QStringList& createOptio
return QString();
}
QString QgsGdalProvider::validateCreationOptions( const QStringList& createOptions, QString format )
QString QgsGdalProvider::validateCreationOptions( const QStringList& createOptions, const QString& format )
{
QString message;

View File

@ -224,13 +224,13 @@ class QgsGdalProvider : public QgsRasterDataProvider, QgsGdalProviderBase
const QString & theResamplingMethod = "NEAREST",
QgsRaster::RasterPyramidsFormat theFormat = QgsRaster::PyramidsGTiff,
const QStringList & theCreateOptions = QStringList() ) override;
QList<QgsRasterPyramid> buildPyramidList( QList<int> overviewList = QList<int>() ) override;
QList<QgsRasterPyramid> buildPyramidList( const QList<int>& overviewList = QList<int>() ) override;
/** \brief Close data set and release related data */
void closeDataset();
/** Emit a signal to notify of the progress event. */
void emitProgress( int theType, double theProgress, QString theMessage );
void emitProgress( int theType, double theProgress, const QString& theMessage );
void emitProgressUpdate( int theProgress );
static QMap<QString, QString> supportedMimes();
@ -243,7 +243,7 @@ class QgsGdalProvider : public QgsRasterDataProvider, QgsGdalProviderBase
/** Remove dataset*/
bool remove() override;
QString validateCreationOptions( const QStringList& createOptions, QString format ) override;
QString validateCreationOptions( const QStringList& createOptions, const QString& format ) override;
QString validatePyramidsCreationOptions( QgsRaster::RasterPyramidsFormat pyramidsFormat,
const QStringList & theConfigOptions, const QString & fileFormat );

View File

@ -225,7 +225,7 @@ QgsGPSData::TrackIterator QgsGPSData::tracksEnd()
QgsGPSData::WaypointIterator QgsGPSData::addWaypoint( double lat, double lon,
QString name, double ele )
const QString& name, double ele )
{
QgsWaypoint wpt;
wpt.lat = lat;
@ -248,7 +248,7 @@ QgsGPSData::WaypointIterator QgsGPSData::addWaypoint( const QgsWaypoint& wpt )
}
QgsGPSData::RouteIterator QgsGPSData::addRoute( QString name )
QgsGPSData::RouteIterator QgsGPSData::addRoute( const QString& name )
{
QgsRoute rte;
rte.name = name;
@ -268,7 +268,7 @@ QgsGPSData::RouteIterator QgsGPSData::addRoute( const QgsRoute& rte )
}
QgsGPSData::TrackIterator QgsGPSData::addTrack( QString name )
QgsGPSData::TrackIterator QgsGPSData::addTrack( const QString& name )
{
QgsTrack trk;
trk.name = name;

View File

@ -181,20 +181,20 @@ class QgsGPSData
/** This function tries to add a new waypoint. An iterator to the new
waypoint will be returned (it will be waypointsEnd() if the waypoint
couldn't be added. */
WaypointIterator addWaypoint( double lat, double lon, QString name = "",
WaypointIterator addWaypoint( double lat, double lon, const QString& name = "",
double ele = -std::numeric_limits<double>::max() );
WaypointIterator addWaypoint( const QgsWaypoint& wpt );
/** This function tries to add a new route. It returns an iterator to the
new route. */
RouteIterator addRoute( QString name = "" );
RouteIterator addRoute( const QString& name = "" );
RouteIterator addRoute( const QgsRoute& rte );
/** This function tries to add a new track. An iterator to the new track
will be returned. */
TrackIterator addTrack( QString name = "" );
TrackIterator addTrack( const QString& name = "" );
TrackIterator addTrack( const QgsTrack& trk );

View File

@ -67,7 +67,7 @@ const QString GPX_KEY = "gpx";
const QString GPX_DESCRIPTION = QObject::tr( "GPS eXchange format provider" );
QgsGPXProvider::QgsGPXProvider( QString uri )
QgsGPXProvider::QgsGPXProvider( const QString& uri )
: QgsVectorDataProvider( uri )
, data( 0 )
, mFeatureType( WaypointType )

View File

@ -43,7 +43,7 @@ class QgsGPXProvider : public QgsVectorDataProvider
Q_OBJECT
public:
explicit QgsGPXProvider( QString uri = QString() );
explicit QgsGPXProvider( const QString& uri = QString() );
virtual ~QgsGPXProvider();
/* Functions inherited from QgsVectorDataProvider */

View File

@ -227,7 +227,7 @@ class QgsGrassImportItem : public QgsDataItem, public QgsGrassObjectItemBase
protected:
// override refresh to keep Populating state
virtual void refresh( QVector<QgsDataItem*> children ) override { Q_UNUSED( children ); }
virtual void refresh( const QVector<QgsDataItem*>& children ) override { Q_UNUSED( children ); }
//bool mDeleteAction;
QgsGrassImport* mImport;

View File

@ -30,7 +30,7 @@
static const QString TEXT_PROVIDER_KEY = "memory";
static const QString TEXT_PROVIDER_DESCRIPTION = "Memory provider";
QgsMemoryProvider::QgsMemoryProvider( QString uri )
QgsMemoryProvider::QgsMemoryProvider( const QString& uri )
: QgsVectorDataProvider( uri )
, mSpatialIndex( 0 )
{
@ -431,7 +431,7 @@ QString QgsMemoryProvider::subsetString()
return mSubsetString;
}
bool QgsMemoryProvider::setSubsetString( QString theSQL, bool updateFeatureCount )
bool QgsMemoryProvider::setSubsetString( const QString& theSQL, bool updateFeatureCount )
{
Q_UNUSED( updateFeatureCount );

View File

@ -28,7 +28,7 @@ class QgsMemoryProvider : public QgsVectorDataProvider
Q_OBJECT
public:
explicit QgsMemoryProvider( QString uri = QString() );
explicit QgsMemoryProvider( const QString& uri = QString() );
virtual ~QgsMemoryProvider();
@ -115,7 +115,7 @@ class QgsMemoryProvider : public QgsVectorDataProvider
QString subsetString() override;
/** Mutator for sql where clause used to limit dataset size */
bool setSubsetString( QString theSQL, bool updateFeatureCount = true ) override;
bool setSubsetString( const QString& theSQL, bool updateFeatureCount = true ) override;
virtual bool supportsSubsetString() override { return true; }

View File

@ -33,7 +33,7 @@
#include <QtSql/QSqlError>
// ---------------------------------------------------------------------------
QgsMssqlConnectionItem::QgsMssqlConnectionItem( QgsDataItem* parent, QString name, QString path )
QgsMssqlConnectionItem::QgsMssqlConnectionItem( QgsDataItem* parent, const QString& name, const QString& path )
: QgsDataCollectionItem( parent, name, path )
, mUseGeometryColumns( false )
, mUseEstimatedMetadata( false )
@ -406,7 +406,7 @@ bool QgsMssqlConnectionItem::handleDrop( const QMimeData * data, Qt::DropAction
// ---------------------------------------------------------------------------
QgsMssqlLayerItem::QgsMssqlLayerItem( QgsDataItem* parent, QString name, QString path, QgsLayerItem::LayerType layerType, QgsMssqlLayerProperty layerProperty )
QgsMssqlLayerItem::QgsMssqlLayerItem( QgsDataItem* parent, const QString& name, const QString& path, QgsLayerItem::LayerType layerType, const QgsMssqlLayerProperty& layerProperty )
: QgsLayerItem( parent, name, path, QString(), layerType, "mssql" )
, mLayerProperty( layerProperty )
{
@ -443,7 +443,7 @@ QString QgsMssqlLayerItem::createUri()
}
// ---------------------------------------------------------------------------
QgsMssqlSchemaItem::QgsMssqlSchemaItem( QgsDataItem* parent, QString name, QString path )
QgsMssqlSchemaItem::QgsMssqlSchemaItem( QgsDataItem* parent, const QString& name, const QString& path )
: QgsDataCollectionItem( parent, name, path )
{
mIconName = "mIconDbSchema.png";
@ -474,7 +474,7 @@ void QgsMssqlSchemaItem::addLayers( QgsDataItem* newLayers )
}
}
QgsMssqlLayerItem* QgsMssqlSchemaItem::addLayer( QgsMssqlLayerProperty layerProperty, bool refresh )
QgsMssqlLayerItem* QgsMssqlSchemaItem::addLayer( const QgsMssqlLayerProperty& layerProperty, bool refresh )
{
QGis::WkbType wkbType = QgsMssqlTableModel::wkbTypeFromMssql( layerProperty.type );
QString tip = tr( "%1 as %2 in %3" ).arg( layerProperty.geometryColName, QgsMssqlTableModel::displayStringForWkbType( wkbType ), layerProperty.srid );
@ -523,7 +523,7 @@ QgsMssqlLayerItem* QgsMssqlSchemaItem::addLayer( QgsMssqlLayerProperty layerProp
}
// ---------------------------------------------------------------------------
QgsMssqlRootItem::QgsMssqlRootItem( QgsDataItem* parent, QString name, QString path )
QgsMssqlRootItem::QgsMssqlRootItem( QgsDataItem* parent, const QString& name, const QString& path )
: QgsDataCollectionItem( parent, name, path )
{
mIconName = "mIconMssql.svg";

View File

@ -33,7 +33,7 @@ class QgsMssqlRootItem : public QgsDataCollectionItem
{
Q_OBJECT
public:
QgsMssqlRootItem( QgsDataItem* parent, QString name, QString path );
QgsMssqlRootItem( QgsDataItem* parent, const QString& name, const QString& path );
~QgsMssqlRootItem();
QVector<QgsDataItem*> createChildren() override;
@ -51,7 +51,7 @@ class QgsMssqlConnectionItem : public QgsDataCollectionItem
{
Q_OBJECT
public:
QgsMssqlConnectionItem( QgsDataItem* parent, QString name, QString path );
QgsMssqlConnectionItem( QgsDataItem* parent, const QString& name, const QString& path );
~QgsMssqlConnectionItem();
QVector<QgsDataItem*> createChildren() override;
@ -92,12 +92,12 @@ class QgsMssqlSchemaItem : public QgsDataCollectionItem
{
Q_OBJECT
public:
QgsMssqlSchemaItem( QgsDataItem* parent, QString name, QString path );
QgsMssqlSchemaItem( QgsDataItem* parent, const QString& name, const QString& path );
~QgsMssqlSchemaItem();
QVector<QgsDataItem*> createChildren() override;
QgsMssqlLayerItem* addLayer( QgsMssqlLayerProperty layerProperty, bool refresh );
QgsMssqlLayerItem* addLayer( const QgsMssqlLayerProperty& layerProperty, bool refresh );
void refresh() override {} // do not refresh directly
void addLayers( QgsDataItem* newLayers );
};
@ -107,7 +107,7 @@ class QgsMssqlLayerItem : public QgsLayerItem
Q_OBJECT
public:
QgsMssqlLayerItem( QgsDataItem* parent, QString name, QString path, QgsLayerItem::LayerType layerType, QgsMssqlLayerProperty layerProperties );
QgsMssqlLayerItem( QgsDataItem* parent, const QString& name, const QString& path, QgsLayerItem::LayerType layerType, const QgsMssqlLayerProperty& layerProperties );
~QgsMssqlLayerItem();
QString createUri();

View File

@ -146,7 +146,7 @@ QgsMssqlNewConnection::~QgsMssqlNewConnection()
delete bar;
}
bool QgsMssqlNewConnection::testConnection( QString testDatabase )
bool QgsMssqlNewConnection::testConnection( const QString& testDatabase )
{
bar->pushMessage( "Testing connection", "....." );
// Gross but needed to show the last message.

View File

@ -36,7 +36,7 @@ class QgsMssqlNewConnection : public QDialog, private Ui::QgsMssqlNewConnectionB
~QgsMssqlNewConnection();
//! Tests the connection using the parameters supplied
bool testConnection( QString testDatabase = QString() );
bool testConnection( const QString& testDatabase = QString() );
/**
* @brief List all databases found for the given server.

View File

@ -53,7 +53,7 @@ static const QString TEXT_PROVIDER_KEY = "mssql";
static const QString TEXT_PROVIDER_DESCRIPTION = "MSSQL spatial data provider";
int QgsMssqlProvider::sConnectionId = 0;
QgsMssqlProvider::QgsMssqlProvider( QString uri )
QgsMssqlProvider::QgsMssqlProvider( const QString& uri )
: QgsVectorDataProvider( uri )
, mNumberFeatures( 0 )
, mCrs()
@ -204,7 +204,7 @@ bool QgsMssqlProvider::OpenDatabase( QSqlDatabase db )
return true;
}
QSqlDatabase QgsMssqlProvider::GetDatabase( QString service, QString host, QString database, QString username, QString password )
QSqlDatabase QgsMssqlProvider::GetDatabase( const QString& service, const QString& host, const QString& database, const QString& username, const QString& password )
{
QSqlDatabase db;
QString connectionName;
@ -274,7 +274,7 @@ QSqlDatabase QgsMssqlProvider::GetDatabase( QString service, QString host, QStri
return db;
}
QVariant::Type QgsMssqlProvider::DecodeSqlType( QString sqlTypeName )
QVariant::Type QgsMssqlProvider::DecodeSqlType( const QString& sqlTypeName )
{
QVariant::Type type = QVariant::Invalid;
if ( sqlTypeName.startsWith( "decimal", Qt::CaseInsensitive ) ||
@ -1392,7 +1392,7 @@ QString QgsMssqlProvider::name() const
return TEXT_PROVIDER_KEY;
} // ::name()
bool QgsMssqlProvider::setSubsetString( QString theSQL, bool )
bool QgsMssqlProvider::setSubsetString( const QString& theSQL, bool )
{
QString prevWhere = mSqlWhereClause;
@ -1542,7 +1542,7 @@ void QgsMssqlProvider::mssqlWkbTypeAndDimension( QGis::WkbType wkbType, QString
}
}
QGis::WkbType QgsMssqlProvider::getWkbType( QString geometryType, int dim )
QGis::WkbType QgsMssqlProvider::getWkbType( const QString& geometryType, int dim )
{
if ( dim == 3 )
{
@ -1865,7 +1865,7 @@ QGISEXTERN int dataCapabilities()
return QgsDataProvider::Database;
}
QGISEXTERN QgsDataItem *dataItem( QString thePath, QgsDataItem *parentItem )
QGISEXTERN QgsDataItem *dataItem( const QString& thePath, QgsDataItem *parentItem )
{
Q_UNUSED( thePath );
return new QgsMssqlRootItem( parentItem, "MSSQL", "mssql:" );

View File

@ -49,11 +49,11 @@ class QgsMssqlProvider : public QgsVectorDataProvider
Q_OBJECT
public:
explicit QgsMssqlProvider( QString uri = QString() );
explicit QgsMssqlProvider( const QString& uri = QString() );
virtual ~QgsMssqlProvider();
static QSqlDatabase GetDatabase( QString service, QString host, QString database, QString username, QString password );
static QSqlDatabase GetDatabase( const QString& service, const QString& host, const QString& database, const QString& username, const QString& password );
virtual QgsAbstractFeatureSource* featureSource() const override;
@ -135,7 +135,7 @@ class QgsMssqlProvider : public QgsVectorDataProvider
QString subsetString() override;
/** Mutator for sql where clause used to limit dataset size */
bool setSubsetString( QString theSQL, bool updateFeatureCount = true ) override;
bool setSubsetString( const QString& theSQL, bool updateFeatureCount = true ) override;
virtual bool supportsSubsetString() override { return true; }
@ -242,7 +242,7 @@ class QgsMssqlProvider : public QgsVectorDataProvider
protected:
/** Loads fields from input file to member attributeFields */
QVariant::Type DecodeSqlType( QString sqlTypeName );
QVariant::Type DecodeSqlType( const QString& sqlTypeName );
void loadFields();
void loadMetadata();
@ -306,13 +306,13 @@ class QgsMssqlProvider : public QgsVectorDataProvider
QString mSqlWhereClause;
// Sets the error messages
void setLastError( QString error )
void setLastError( const QString& error )
{
mLastError = error;
}
static void mssqlWkbTypeAndDimension( QGis::WkbType wkbType, QString &geometryType, int &dim );
static QGis::WkbType getWkbType( QString geometryType, int dim );
static QGis::WkbType getWkbType( const QString& geometryType, int dim );
friend class QgsMssqlFeatureSource;

View File

@ -229,7 +229,7 @@ void QgsMssqlSourceSelect::on_btnDelete_clicked()
emit connectionsChanged();
}
void QgsMssqlSourceSelect::deleteConnection( QString name )
void QgsMssqlSourceSelect::deleteConnection( const QString& name )
{
QString key = "/MSSQL/connections/" + name;
QSettings settings;
@ -382,7 +382,7 @@ void QgsMssqlSourceSelect::on_mSearchModeComboBox_currentIndexChanged( const QSt
on_mSearchTableEdit_textChanged( mSearchTableEdit->text() );
}
void QgsMssqlSourceSelect::setLayerType( QgsMssqlLayerProperty layerProperty )
void QgsMssqlSourceSelect::setLayerType( const QgsMssqlLayerProperty& layerProperty )
{
QgsDebugMsg( "entering." );
mTableModel.setGeometryTypesForTable( layerProperty );
@ -688,7 +688,7 @@ void QgsMssqlSourceSelect::setSql( const QModelIndex &index )
delete vlayer;
}
void QgsMssqlSourceSelect::addSearchGeometryColumn( QString connectionName, QgsMssqlLayerProperty layerProperty, bool estimateMetadata )
void QgsMssqlSourceSelect::addSearchGeometryColumn( const QString& connectionName, const QgsMssqlLayerProperty& layerProperty, bool estimateMetadata )
{
// store the column details and do the query in a thread
if ( !mColumnTypeThread )
@ -707,7 +707,7 @@ void QgsMssqlSourceSelect::addSearchGeometryColumn( QString connectionName, QgsM
emit addGeometryColumn( layerProperty );
}
QString QgsMssqlSourceSelect::fullDescription( QString schema, QString table, QString column, QString type )
QString QgsMssqlSourceSelect::fullDescription( const QString& schema, const QString& table, const QString& column, const QString& type )
{
QString full_desc = "";
if ( !schema.isEmpty() )
@ -738,7 +738,7 @@ void QgsMssqlSourceSelect::setSearchExpression( const QString& regexp )
}
QgsMssqlGeomColumnTypeThread::QgsMssqlGeomColumnTypeThread( QString connectionName, bool useEstimatedMetadata )
QgsMssqlGeomColumnTypeThread::QgsMssqlGeomColumnTypeThread( const QString& connectionName, bool useEstimatedMetadata )
: QThread()
, mConnectionName( connectionName )
, mUseEstimatedMetadata( useEstimatedMetadata )
@ -747,7 +747,7 @@ QgsMssqlGeomColumnTypeThread::QgsMssqlGeomColumnTypeThread( QString connectionNa
qRegisterMetaType<QgsMssqlLayerProperty>( "QgsMssqlLayerProperty" );
}
void QgsMssqlGeomColumnTypeThread::addGeometryColumn( QgsMssqlLayerProperty layerProperty )
void QgsMssqlGeomColumnTypeThread::addGeometryColumn( const QgsMssqlLayerProperty& layerProperty )
{
layerProperties << layerProperty;
}

View File

@ -55,7 +55,7 @@ class QgsMssqlGeomColumnTypeThread : public QThread
{
Q_OBJECT
public:
QgsMssqlGeomColumnTypeThread( QString connectionName, bool useEstimatedMetadata );
QgsMssqlGeomColumnTypeThread( const QString& connectionName, bool useEstimatedMetadata );
// These functions get the layer types and pass that information out
// by emitting the setLayerType() signal.
@ -65,7 +65,7 @@ class QgsMssqlGeomColumnTypeThread : public QThread
void setLayerType( QgsMssqlLayerProperty layerProperty );
public slots:
void addGeometryColumn( QgsMssqlLayerProperty layerProperty );
void addGeometryColumn( const QgsMssqlLayerProperty& layerProperty );
void stop();
private:
@ -92,7 +92,7 @@ class QgsMssqlSourceSelect : public QDialog, private Ui::QgsDbSourceSelectBase
public:
//! static function to delete a connection
static void deleteConnection( QString key );
static void deleteConnection( const QString& key );
//! Constructor
QgsMssqlSourceSelect( QWidget *parent = 0, Qt::WindowFlags fl = QgisGui::ModalDialogFlags, bool managerMode = false, bool embeddedMode = false );
@ -137,7 +137,7 @@ class QgsMssqlSourceSelect : public QDialog, private Ui::QgsDbSourceSelectBase
void setSql( const QModelIndex& index );
//! Store the selected database
void on_cmbConnections_activated( int );
void setLayerType( QgsMssqlLayerProperty layerProperty );
void setLayerType( const QgsMssqlLayerProperty& layerProperty );
void on_mTablesTreeView_clicked( const QModelIndex &index );
void on_mTablesTreeView_doubleClicked( const QModelIndex &index );
//!Sets a new regular expression to the model
@ -158,14 +158,14 @@ class QgsMssqlSourceSelect : public QDialog, private Ui::QgsDbSourceSelectBase
bool mEmbeddedMode;
// queue another query for the thread
void addSearchGeometryColumn( QString connectionName, QgsMssqlLayerProperty layerProperty, bool estimateMetadata );
void addSearchGeometryColumn( const QString& connectionName, const QgsMssqlLayerProperty& layerProperty, bool estimateMetadata );
// Set the position of the database connection list to the last
// used one.
void setConnectionListPosition();
// Combine the schema, table and column data into a single string
// useful for display to the user
QString fullDescription( QString schema, QString table, QString column, QString type );
QString fullDescription( const QString& schema, const QString& table, const QString& column, const QString& type );
// The column labels
QStringList mColumnLabels;
// Our thread for doing long running queries

View File

@ -32,7 +32,7 @@ inline QString qgsConnectionPool_ConnectionToName( QgsOgrConn* c )
return c->path;
}
inline void qgsConnectionPool_ConnectionCreate( QString connInfo, QgsOgrConn*& c )
inline void qgsConnectionPool_ConnectionCreate( const QString& connInfo, QgsOgrConn*& c )
{
c = new QgsOgrConn;
c->ds = OGROpen( connInfo.toUtf8().constData(), false, NULL );
@ -61,7 +61,7 @@ class QgsOgrConnPoolGroup : public QObject, public QgsConnectionPoolGroup<QgsOgr
Q_OBJECT
public:
explicit QgsOgrConnPoolGroup( QString name ) : QgsConnectionPoolGroup<QgsOgrConn*>( name ), mRefCount( 0 ) { initTimer( this ); }
explicit QgsOgrConnPoolGroup( const QString& name ) : QgsConnectionPoolGroup<QgsOgrConn*>( name ), mRefCount( 0 ) { initTimer( this ); }
void ref() { ++mRefCount; }
bool unref()
{

View File

@ -32,7 +32,7 @@ QGISEXTERN QStringList wildcards();
QgsOgrLayerItem::QgsOgrLayerItem( QgsDataItem* parent,
QString name, QString path, QString uri, LayerType layerType )
const QString& name, const QString& path, const QString& uri, LayerType layerType )
: QgsLayerItem( parent, name, path, uri, layerType, "ogr" )
{
mToolTip = uri;
@ -64,7 +64,7 @@ QgsLayerItem::Capability QgsOgrLayerItem::capabilities()
return mCapabilities & SetCrs ? SetCrs : NoCapabilities;
}
bool QgsOgrLayerItem::setCrs( QgsCoordinateReferenceSystem crs )
bool QgsOgrLayerItem::setCrs( const QgsCoordinateReferenceSystem& crs )
{
if ( !( mCapabilities & SetCrs ) )
return false;
@ -179,7 +179,7 @@ static QgsOgrLayerItem* dataItemForLayer( QgsDataItem* parentItem, QString name,
// ----
QgsOgrDataCollectionItem::QgsOgrDataCollectionItem( QgsDataItem* parent, QString name, QString path )
QgsOgrDataCollectionItem::QgsOgrDataCollectionItem( QgsDataItem* parent, const QString& name, const QString& path )
: QgsDataCollectionItem( parent, name, path )
{
}

View File

@ -23,10 +23,10 @@ class QgsOgrLayerItem : public QgsLayerItem
{
Q_OBJECT
public:
QgsOgrLayerItem( QgsDataItem* parent, QString name, QString path, QString uri, LayerType layerType );
QgsOgrLayerItem( QgsDataItem* parent, const QString& name, const QString& path, const QString& uri, LayerType layerType );
~QgsOgrLayerItem();
bool setCrs( QgsCoordinateReferenceSystem crs ) override;
bool setCrs( const QgsCoordinateReferenceSystem& crs ) override;
Capability capabilities() override;
QString layerName() const override;
};
@ -35,7 +35,7 @@ class QgsOgrDataCollectionItem : public QgsDataCollectionItem
{
Q_OBJECT
public:
QgsOgrDataCollectionItem( QgsDataItem* parent, QString name, QString path );
QgsOgrDataCollectionItem( QgsDataItem* parent, const QString& name, const QString& path );
~QgsOgrDataCollectionItem();
QVector<QgsDataItem*> createChildren() override;

View File

@ -481,7 +481,7 @@ QgsAbstractFeatureSource* QgsOgrProvider::featureSource() const
return new QgsOgrFeatureSource( this );
}
bool QgsOgrProvider::setSubsetString( QString theSQL, bool updateFeatureCount )
bool QgsOgrProvider::setSubsetString( const QString& theSQL, bool updateFeatureCount )
{
QgsCPLErrorHandler handler;
@ -593,7 +593,7 @@ QString QgsOgrProvider::ogrWkbGeometryTypeName( OGRwkbGeometryType type ) const
return geom;
}
OGRwkbGeometryType QgsOgrProvider::ogrWkbGeometryTypeFromName( QString typeName ) const
OGRwkbGeometryType QgsOgrProvider::ogrWkbGeometryTypeFromName( const QString& typeName ) const
{
if ( typeName == "Point" ) return wkbPoint;
else if ( typeName == "LineString" ) return wkbLineString;
@ -1613,7 +1613,7 @@ static QString createFileFilter_( QString const &longName, QString const &glob )
} // createFileFilter_
QString createFilters( QString type )
QString createFilters( const QString& type )
{
/** Database drivers available*/
static QString myDatabaseDrivers;
@ -2436,7 +2436,7 @@ QVariant QgsOgrProvider::maximumValue( int index )
return value;
}
QByteArray QgsOgrProvider::quotedIdentifier( QByteArray field )
QByteArray QgsOgrProvider::quotedIdentifier( const QByteArray& field )
{
return QgsOgrUtils::quotedIdentifier( field, ogrDriverName );
}

View File

@ -97,7 +97,7 @@ class QgsOgrProvider : public QgsVectorDataProvider
virtual bool supportsSubsetString() override { return true; }
/** Mutator for sql where clause used to limit dataset size */
virtual bool setSubsetString( QString theSQL, bool updateFeatureCount = true ) override;
virtual bool setSubsetString( const QString& theSQL, bool updateFeatureCount = true ) override;
/**
* Get feature type.
@ -261,7 +261,7 @@ class QgsOgrProvider : public QgsVectorDataProvider
QTextCodec* textEncoding() { return mEncoding; }
QByteArray quotedIdentifier( QByteArray field );
QByteArray quotedIdentifier( const QByteArray& field );
/**
* A forced reload invalidates the underlying connection.
@ -289,7 +289,7 @@ class QgsOgrProvider : public QgsVectorDataProvider
private:
unsigned char *getGeometryPointer( OGRFeatureH fet );
QString ogrWkbGeometryTypeName( OGRwkbGeometryType type ) const;
OGRwkbGeometryType ogrWkbGeometryTypeFromName( QString typeName ) const;
OGRwkbGeometryType ogrWkbGeometryTypeFromName( const QString& typeName ) const;
QgsFields mAttributeFields;
OGRDataSourceH ogrDataSource;
void *extent_;

View File

@ -1935,7 +1935,7 @@ int QgsOracleProvider::capabilities() const
return mEnabledCapabilities;
}
bool QgsOracleProvider::setSubsetString( QString theSQL, bool updateFeatureCount )
bool QgsOracleProvider::setSubsetString( const QString& theSQL, bool updateFeatureCount )
{
QString prevWhere = mSqlWhereClause;

View File

@ -228,7 +228,7 @@ class QgsOracleProvider : public QgsVectorDataProvider
QString subsetString();
/** Mutator for sql where clause used to limit dataset size */
bool setSubsetString( QString theSQL, bool updateFeatureCount = true );
bool setSubsetString( const QString& theSQL, bool updateFeatureCount = true );
virtual bool supportsSubsetString() { return true; }

View File

@ -25,7 +25,7 @@
#include <QFileInfo>
// ---------------------------------------------------------------------------
QgsOWSConnectionItem::QgsOWSConnectionItem( QgsDataItem* parent, QString name, QString path )
QgsOWSConnectionItem::QgsOWSConnectionItem( QgsDataItem* parent, const QString& name, const QString& path )
: QgsDataCollectionItem( parent, name, path )
{
mIconName = "mIconConnect.png";
@ -110,7 +110,7 @@ QVector<QgsDataItem*> QgsOWSConnectionItem::createChildren()
}
// reset path recursively
void QgsOWSConnectionItem::replacePath( QgsDataItem* item, QString before, QString after )
void QgsOWSConnectionItem::replacePath( QgsDataItem* item, const QString& before, const QString& after )
{
item->setPath( item->path().replace( before, after ) );
Q_FOREACH ( QgsDataItem* subItem, item->children() )
@ -170,7 +170,7 @@ void QgsOWSConnectionItem::deleteConnection()
// ---------------------------------------------------------------------------
QgsOWSRootItem::QgsOWSRootItem( QgsDataItem* parent, QString name, QString path )
QgsOWSRootItem::QgsOWSRootItem( QgsDataItem* parent, const QString& name, const QString& path )
: QgsDataCollectionItem( parent, name, path )
{
mCapabilities |= Fast;
@ -257,7 +257,7 @@ QGISEXTERN int dataCapabilities()
return QgsDataProvider::Net;
}
QGISEXTERN QgsDataItem * dataItem( QString thePath, QgsDataItem* parentItem )
QGISEXTERN QgsDataItem * dataItem( const QString& thePath, QgsDataItem* parentItem )
{
if ( thePath.isEmpty() )
{

View File

@ -21,7 +21,7 @@ class QgsOWSConnectionItem : public QgsDataCollectionItem
{
Q_OBJECT
public:
QgsOWSConnectionItem( QgsDataItem* parent, QString name, QString path );
QgsOWSConnectionItem( QgsDataItem* parent, const QString& name, const QString& path );
~QgsOWSConnectionItem();
QVector<QgsDataItem*> createChildren() override;
@ -34,14 +34,14 @@ class QgsOWSConnectionItem : public QgsDataCollectionItem
void deleteConnection();
private:
void replacePath( QgsDataItem* item, QString before, QString after );
void replacePath( QgsDataItem* item, const QString& before, const QString& after );
};
class QgsOWSRootItem : public QgsDataCollectionItem
{
Q_OBJECT
public:
QgsOWSRootItem( QgsDataItem* parent, QString name, QString path );
QgsOWSRootItem( QgsDataItem* parent, const QString& name, const QString& path );
~QgsOWSRootItem();
QVector<QgsDataItem*> createChildren() override;

View File

@ -21,7 +21,7 @@ email : jef at norbit dot de
#include <QMetaType>
#include <climits>
QgsGeomColumnTypeThread::QgsGeomColumnTypeThread( QString name, bool useEstimatedMetaData, bool allowGeometrylessTables )
QgsGeomColumnTypeThread::QgsGeomColumnTypeThread( const QString& name, bool useEstimatedMetaData, bool allowGeometrylessTables )
: QThread()
, mConn( 0 )
, mName( name )

View File

@ -28,7 +28,7 @@ class QgsGeomColumnTypeThread : public QThread
{
Q_OBJECT
public:
QgsGeomColumnTypeThread( QString connName, bool useEstimatedMetaData, bool allowGeometrylessTables );
QgsGeomColumnTypeThread( const QString& connName, bool useEstimatedMetaData, bool allowGeometrylessTables );
// These functions get the layer types and pass that information out
// by emitting the setLayerType() signal.

View File

@ -135,7 +135,7 @@ QMap<QString, QgsPostgresConn *> QgsPostgresConn::sConnectionsRO;
QMap<QString, QgsPostgresConn *> QgsPostgresConn::sConnectionsRW;
const int QgsPostgresConn::sGeomTypeSelectLimit = 100;
QgsPostgresConn *QgsPostgresConn::connectDb( QString conninfo, bool readonly, bool shared, bool transaction )
QgsPostgresConn *QgsPostgresConn::connectDb( const QString& conninfo, bool readonly, bool shared, bool transaction )
{
QMap<QString, QgsPostgresConn *> &connections =
readonly ? QgsPostgresConn::sConnectionsRO : QgsPostgresConn::sConnectionsRW;
@ -174,7 +174,7 @@ static void noticeProcessor( void *arg, const char *message )
QgsMessageLog::logMessage( QObject::tr( "NOTICE: %1" ).arg( msg ), QObject::tr( "PostGIS" ) );
}
QgsPostgresConn::QgsPostgresConn( QString conninfo, bool readOnly, bool shared, bool transaction )
QgsPostgresConn::QgsPostgresConn( const QString& conninfo, bool readOnly, bool shared, bool transaction )
: mRef( 1 )
, mOpenCursors( 0 )
, mConnInfo( conninfo )
@ -356,7 +356,7 @@ void QgsPostgresConn::addColumnInfo( QgsPostgresLayerProperty& layerProperty, co
}
bool QgsPostgresConn::getTableInfo( bool searchGeometryColumnsOnly, bool searchPublicOnly, bool allowGeometrylessTables, const QString schema )
bool QgsPostgresConn::getTableInfo( bool searchGeometryColumnsOnly, bool searchPublicOnly, bool allowGeometrylessTables, const QString& schema )
{
int nColumns = 0;
int foundInTables = 0;
@ -725,7 +725,7 @@ bool QgsPostgresConn::getTableInfo( bool searchGeometryColumnsOnly, bool searchP
return true;
}
bool QgsPostgresConn::supportedLayers( QVector<QgsPostgresLayerProperty> &layers, bool searchGeometryColumnsOnly, bool searchPublicOnly, bool allowGeometrylessTables, const QString schema )
bool QgsPostgresConn::supportedLayers( QVector<QgsPostgresLayerProperty> &layers, bool searchGeometryColumnsOnly, bool searchPublicOnly, bool allowGeometrylessTables, const QString& schema )
{
// Get the list of supported tables
if ( !getTableInfo( searchGeometryColumnsOnly, searchPublicOnly, allowGeometrylessTables, schema ) )
@ -901,7 +901,7 @@ QString QgsPostgresConn::quotedIdentifier( QString ident )
return ident;
}
QString QgsPostgresConn::quotedValue( QVariant value )
QString QgsPostgresConn::quotedValue( const QVariant& value )
{
if ( value.isNull() )
return "NULL";
@ -927,7 +927,7 @@ QString QgsPostgresConn::quotedValue( QVariant value )
}
}
PGresult *QgsPostgresConn::PQexec( QString query, bool logError )
PGresult *QgsPostgresConn::PQexec( const QString& query, bool logError )
{
if ( PQstatus() != CONNECTION_OK )
{
@ -979,7 +979,7 @@ PGresult *QgsPostgresConn::PQexec( QString query, bool logError )
return res;
}
bool QgsPostgresConn::openCursor( QString cursorName, QString sql )
bool QgsPostgresConn::openCursor( const QString& cursorName, const QString& sql )
{
if ( mOpenCursors++ == 0 && !mTransaction )
{
@ -994,7 +994,7 @@ bool QgsPostgresConn::openCursor( QString cursorName, QString sql )
arg( cursorName, !mTransaction ? "" : QString( " WITH HOLD" ), sql ) );
}
bool QgsPostgresConn::closeCursor( QString cursorName )
bool QgsPostgresConn::closeCursor( const QString& cursorName )
{
if ( !PQexecNR( QString( "CLOSE %1" ).arg( cursorName ) ) )
return false;
@ -1013,7 +1013,7 @@ QString QgsPostgresConn::uniqueCursorName()
return QString( "qgis_%1" ).arg( ++mNextCursorId );
}
bool QgsPostgresConn::PQexecNR( QString query, bool retry )
bool QgsPostgresConn::PQexecNR( const QString& query, bool retry )
{
QgsPostgresResult res( PQexec( query, false ) );
@ -1074,12 +1074,12 @@ PGresult *QgsPostgresConn::PQgetResult()
return ::PQgetResult( mConn );
}
PGresult *QgsPostgresConn::PQprepare( QString stmtName, QString query, int nParams, const Oid *paramTypes )
PGresult *QgsPostgresConn::PQprepare( const QString& stmtName, const QString& query, int nParams, const Oid *paramTypes )
{
return ::PQprepare( mConn, stmtName.toUtf8(), query.toUtf8(), nParams, paramTypes );
}
PGresult *QgsPostgresConn::PQexecPrepared( QString stmtName, const QStringList &params )
PGresult *QgsPostgresConn::PQexecPrepared( const QString& stmtName, const QStringList &params )
{
const char **param = new const char *[ params.size()];
QList<QByteArray> qparam;
@ -1121,7 +1121,7 @@ QString QgsPostgresConn::PQerrorMessage()
return QString::fromUtf8( ::PQerrorMessage( mConn ) );
}
int QgsPostgresConn::PQsendQuery( QString query )
int QgsPostgresConn::PQsendQuery( const QString& query )
{
Q_ASSERT( mConn );
return ::PQsendQuery( mConn, query.toUtf8() );
@ -1525,7 +1525,7 @@ int QgsPostgresConn::postgisWkbTypeDim( QGis::WkbType wkbType )
return dim;
}
QGis::WkbType QgsPostgresConn::wkbTypeFromPostgis( QString type )
QGis::WkbType QgsPostgresConn::wkbTypeFromPostgis( const QString& type )
{
// Polyhedral surfaces and TIN are stored in PostGIS as geometry collections
// of Polygons and Triangles.
@ -1614,13 +1614,13 @@ QString QgsPostgresConn::selectedConnection()
return settings.value( "/PostgreSQL/connections/selected" ).toString();
}
void QgsPostgresConn::setSelectedConnection( QString name )
void QgsPostgresConn::setSelectedConnection( const QString& name )
{
QSettings settings;
return settings.setValue( "/PostgreSQL/connections/selected", name );
}
QgsDataSourceURI QgsPostgresConn::connUri( QString theConnName )
QgsDataSourceURI QgsPostgresConn::connUri( const QString& theConnName )
{
QgsDebugMsg( "theConnName = " + theConnName );
@ -1685,33 +1685,33 @@ QgsDataSourceURI QgsPostgresConn::connUri( QString theConnName )
return uri;
}
bool QgsPostgresConn::publicSchemaOnly( QString theConnName )
bool QgsPostgresConn::publicSchemaOnly( const QString& theConnName )
{
QSettings settings;
return settings.value( "/PostgreSQL/connections/" + theConnName + "/publicOnly", false ).toBool();
}
bool QgsPostgresConn::geometryColumnsOnly( QString theConnName )
bool QgsPostgresConn::geometryColumnsOnly( const QString& theConnName )
{
QSettings settings;
return settings.value( "/PostgreSQL/connections/" + theConnName + "/geometryColumnsOnly", false ).toBool();
}
bool QgsPostgresConn::dontResolveType( QString theConnName )
bool QgsPostgresConn::dontResolveType( const QString& theConnName )
{
QSettings settings;
return settings.value( "/PostgreSQL/connections/" + theConnName + "/dontResolveType", false ).toBool();
}
bool QgsPostgresConn::allowGeometrylessTables( QString theConnName )
bool QgsPostgresConn::allowGeometrylessTables( const QString& theConnName )
{
QSettings settings;
return settings.value( "/PostgreSQL/connections/" + theConnName + "/allowGeometrylessTables", false ).toBool();
}
void QgsPostgresConn::deleteConnection( QString theConnName )
void QgsPostgresConn::deleteConnection( const QString& theConnName )
{
QSettings settings;

View File

@ -182,7 +182,7 @@ class QgsPostgresConn : public QObject
Q_OBJECT
public:
static QgsPostgresConn *connectDb( QString connInfo, bool readOnly, bool shared = true, bool transaction = false );
static QgsPostgresConn *connectDb( const QString& connInfo, bool readOnly, bool shared = true, bool transaction = false );
void ref() { ++mRef; }
void unref();
@ -218,11 +218,11 @@ class QgsPostgresConn : public QObject
int pgVersion() { return mPostgresqlVersion; }
//! run a query and free result buffer
bool PQexecNR( QString query, bool retry = true );
bool PQexecNR( const QString& query, bool retry = true );
//! cursor handling
bool openCursor( QString cursorName, QString declare );
bool closeCursor( QString cursorName );
bool openCursor( const QString& cursorName, const QString& declare );
bool closeCursor( const QString& cursorName );
QString uniqueCursorName();
@ -235,14 +235,14 @@ class QgsPostgresConn : public QObject
//
// run a query and check for errors
PGresult *PQexec( QString query, bool logError = true );
PGresult *PQexec( const QString& query, bool logError = true );
void PQfinish();
QString PQerrorMessage();
int PQsendQuery( QString query );
int PQsendQuery( const QString& query );
int PQstatus();
PGresult *PQgetResult();
PGresult *PQprepare( QString stmtName, QString query, int nParams, const Oid *paramTypes );
PGresult *PQexecPrepared( QString stmtName, const QStringList &params );
PGresult *PQprepare( const QString& stmtName, const QString& query, int nParams, const Oid *paramTypes );
PGresult *PQexecPrepared( const QString& stmtName, const QStringList &params );
bool begin();
bool commit();
@ -258,7 +258,7 @@ class QgsPostgresConn : public QObject
/** Quote a value for placement in a SQL string.
*/
static QString quotedValue( QVariant value );
static QString quotedValue( const QVariant& value );
/** Get the list of supported layers
* @param layers list to store layers in
@ -273,7 +273,7 @@ class QgsPostgresConn : public QObject
bool searchGeometryColumnsOnly = true,
bool searchPublicOnly = true,
bool allowGeometrylessTables = false,
const QString schema = QString() );
const QString& schema = QString() );
/** Get the list of database schemas
* @param schemas list to store schemas in
@ -293,7 +293,7 @@ class QgsPostgresConn : public QObject
* @returns true if tables were successfully queried
*/
bool getTableInfo( bool searchGeometryColumnsOnly, bool searchPublicOnly, bool allowGeometrylessTables,
const QString schema = QString() );
const QString& schema = QString() );
qint64 getBinaryInt( QgsPostgresResult &queryResult, int row, int col );
@ -305,7 +305,7 @@ class QgsPostgresConn : public QObject
static QString displayStringForWkbType( QGis::WkbType wkbType );
static QString displayStringForGeomType( QgsPostgresGeometryColumnType geomType );
static QGis::WkbType wkbTypeFromPostgis( QString dbType );
static QGis::WkbType wkbTypeFromPostgis( const QString& dbType );
static QString postgisWkbTypeName( QGis::WkbType wkbType );
static int postgisWkbTypeDim( QGis::WkbType wkbType );
@ -318,20 +318,20 @@ class QgsPostgresConn : public QObject
static QStringList connectionList();
static QString selectedConnection();
static void setSelectedConnection( QString theConnName );
static QgsDataSourceURI connUri( QString theConnName );
static bool publicSchemaOnly( QString theConnName );
static bool geometryColumnsOnly( QString theConnName );
static bool dontResolveType( QString theConnName );
static bool allowGeometrylessTables( QString theConnName );
static void deleteConnection( QString theConnName );
static void setSelectedConnection( const QString& theConnName );
static QgsDataSourceURI connUri( const QString& theConnName );
static bool publicSchemaOnly( const QString& theConnName );
static bool geometryColumnsOnly( const QString& theConnName );
static bool dontResolveType( const QString& theConnName );
static bool allowGeometrylessTables( const QString& theConnName );
static void deleteConnection( const QString& theConnName );
/** A connection needs to be locked when it uses transactions, see QgsPostgresConn::{begin,commit,rollback} */
void lock() { mLock.lock(); }
void unlock() { mLock.unlock(); }
private:
QgsPostgresConn( QString conninfo, bool readOnly, bool shared, bool transaction );
QgsPostgresConn( const QString& conninfo, bool readOnly, bool shared, bool transaction );
~QgsPostgresConn();
int mRef;

View File

@ -25,7 +25,7 @@ inline QString qgsConnectionPool_ConnectionToName( QgsPostgresConn* c )
return c->connInfo();
}
inline void qgsConnectionPool_ConnectionCreate( QString connInfo, QgsPostgresConn*& c )
inline void qgsConnectionPool_ConnectionCreate( const QString& connInfo, QgsPostgresConn*& c )
{
c = QgsPostgresConn::connectDb( connInfo, true, false );
}
@ -52,7 +52,7 @@ class QgsPostgresConnPoolGroup : public QObject, public QgsConnectionPoolGroup<Q
Q_OBJECT
public:
explicit QgsPostgresConnPoolGroup( QString name ) : QgsConnectionPoolGroup<QgsPostgresConn*>( name ) { initTimer( this ); }
explicit QgsPostgresConnPoolGroup( const QString& name ) : QgsConnectionPoolGroup<QgsPostgresConn*>( name ) { initTimer( this ); }
protected slots:
void handleConnectionExpired() { onConnectionExpired(); }

View File

@ -34,7 +34,7 @@ QGISEXTERN bool deleteSchema( const QString& schema, const QgsDataSourceURI& uri
// ---------------------------------------------------------------------------
QgsPGConnectionItem::QgsPGConnectionItem( QgsDataItem* parent, QString name, QString path )
QgsPGConnectionItem::QgsPGConnectionItem( QgsDataItem* parent, const QString& name, const QString& path )
: QgsDataCollectionItem( parent, name, path )
{
mIconName = "mIconConnect.png";
@ -191,7 +191,7 @@ bool QgsPGConnectionItem::handleDrop( const QMimeData * data, Qt::DropAction )
return handleDrop( data, QString::null );
}
bool QgsPGConnectionItem::handleDrop( const QMimeData * data, QString toSchema )
bool QgsPGConnectionItem::handleDrop( const QMimeData * data, const QString& toSchema )
{
if ( !QgsMimeDataUtils::isUriList( data ) )
return false;
@ -272,7 +272,7 @@ bool QgsPGConnectionItem::handleDrop( const QMimeData * data, QString toSchema )
}
// ---------------------------------------------------------------------------
QgsPGLayerItem::QgsPGLayerItem( QgsDataItem* parent, QString name, QString path, QgsLayerItem::LayerType layerType, QgsPostgresLayerProperty layerProperty )
QgsPGLayerItem::QgsPGLayerItem( QgsDataItem* parent, const QString& name, const QString& path, QgsLayerItem::LayerType layerType, const QgsPostgresLayerProperty& layerProperty )
: QgsLayerItem( parent, name, path, QString(), layerType, "postgres" )
, mLayerProperty( layerProperty )
{
@ -449,7 +449,7 @@ QString QgsPGLayerItem::createUri()
}
// ---------------------------------------------------------------------------
QgsPGSchemaItem::QgsPGSchemaItem( QgsDataItem* parent, QString connectionName, QString name, QString path )
QgsPGSchemaItem::QgsPGSchemaItem( QgsDataItem* parent, const QString& connectionName, const QString& name, const QString& path )
: QgsDataCollectionItem( parent, name, path )
, mConnectionName( connectionName )
{
@ -645,7 +645,7 @@ void QgsPGSchemaItem::renameSchema()
mParent->refresh();
}
QgsPGLayerItem *QgsPGSchemaItem::createLayer( QgsPostgresLayerProperty layerProperty )
QgsPGLayerItem *QgsPGSchemaItem::createLayer( const QgsPostgresLayerProperty& layerProperty )
{
//QgsDebugMsg( "schemaName = " + layerProperty.schemaName + " tableName = " + layerProperty.tableName + " geometryColName = " + layerProperty.geometryColName );
QGis::WkbType wkbType = layerProperty.types[0];
@ -691,7 +691,7 @@ bool QgsPGSchemaItem::handleDrop( const QMimeData * data, Qt::DropAction )
}
// ---------------------------------------------------------------------------
QgsPGRootItem::QgsPGRootItem( QgsDataItem* parent, QString name, QString path )
QgsPGRootItem::QgsPGRootItem( QgsDataItem* parent, const QString& name, const QString& path )
: QgsDataCollectionItem( parent, name, path )
{
mCapabilities |= Fast;

View File

@ -33,7 +33,7 @@ class QgsPGRootItem : public QgsDataCollectionItem
{
Q_OBJECT
public:
QgsPGRootItem( QgsDataItem* parent, QString name, QString path );
QgsPGRootItem( QgsDataItem* parent, const QString& name, const QString& path );
~QgsPGRootItem();
QVector<QgsDataItem*> createChildren() override;
@ -53,7 +53,7 @@ class QgsPGConnectionItem : public QgsDataCollectionItem
{
Q_OBJECT
public:
QgsPGConnectionItem( QgsDataItem* parent, QString name, QString path );
QgsPGConnectionItem( QgsDataItem* parent, const QString& name, const QString& path );
~QgsPGConnectionItem();
QVector<QgsDataItem*> createChildren() override;
@ -63,7 +63,7 @@ class QgsPGConnectionItem : public QgsDataCollectionItem
virtual bool acceptDrop() override { return true; }
virtual bool handleDrop( const QMimeData * data, Qt::DropAction action ) override;
bool handleDrop( const QMimeData * data, QString toSchema );
bool handleDrop( const QMimeData * data, const QString& toSchema );
signals:
void addGeometryColumn( QgsPostgresLayerProperty );
@ -80,7 +80,7 @@ class QgsPGSchemaItem : public QgsDataCollectionItem
{
Q_OBJECT
public:
QgsPGSchemaItem( QgsDataItem* parent, QString connectionName, QString name, QString path );
QgsPGSchemaItem( QgsDataItem* parent, const QString& connectionName, const QString& name, const QString& path );
~QgsPGSchemaItem();
QVector<QgsDataItem*> createChildren() override;
@ -94,7 +94,7 @@ class QgsPGSchemaItem : public QgsDataCollectionItem
void renameSchema();
private:
QgsPGLayerItem * createLayer( QgsPostgresLayerProperty layerProperty );
QgsPGLayerItem * createLayer( const QgsPostgresLayerProperty& layerProperty );
QString mConnectionName;
};
@ -104,7 +104,7 @@ class QgsPGLayerItem : public QgsLayerItem
Q_OBJECT
public:
QgsPGLayerItem( QgsDataItem* parent, QString name, QString path, QgsLayerItem::LayerType layerType, QgsPostgresLayerProperty layerProperties );
QgsPGLayerItem( QgsDataItem* parent, const QString& name, const QString& path, QgsLayerItem::LayerType layerType, const QgsPostgresLayerProperty& layerProperties );
~QgsPGLayerItem();
QString createUri();

View File

@ -547,7 +547,7 @@ QString QgsPostgresUtils::whereClause( QgsFeatureId featureId, const QgsFields&
return whereClause;
}
QString QgsPostgresUtils::whereClause( QgsFeatureIds featureIds, const QgsFields& fields, QgsPostgresConn* conn, QgsPostgresPrimaryKeyType pkType, const QList<int>& pkAttrs, QSharedPointer<QgsPostgresSharedData> sharedData )
QString QgsPostgresUtils::whereClause( const QgsFeatureIds& featureIds, const QgsFields& fields, QgsPostgresConn* conn, QgsPostgresPrimaryKeyType pkType, const QList<int>& pkAttrs, QSharedPointer<QgsPostgresSharedData> sharedData )
{
QStringList whereClauses;
Q_FOREACH ( const QgsFeatureId featureId, featureIds )
@ -1342,7 +1342,7 @@ void QgsPostgresProvider::determinePrimaryKeyFromUriKeyColumn()
}
}
bool QgsPostgresProvider::uniqueData( QString quotedColNames )
bool QgsPostgresProvider::uniqueData( const QString& quotedColNames )
{
// Check to see if the given columns contain unique data
QString sql = QString( "SELECT count(distinct (%1))=count((%1)) FROM %2%3" )
@ -1574,7 +1574,7 @@ QVariant QgsPostgresProvider::defaultValue( int fieldId )
return mDefaultValues.value( fieldId, QString::null );
}
QString QgsPostgresProvider::paramValue( QString fieldValue, const QString &defaultValue ) const
QString QgsPostgresProvider::paramValue( const QString& fieldValue, const QString &defaultValue ) const
{
if ( fieldValue.isNull() )
return QString::null;
@ -2461,7 +2461,7 @@ int QgsPostgresProvider::capabilities() const
return mEnabledCapabilities;
}
bool QgsPostgresProvider::setSubsetString( QString theSQL, bool updateFeatureCount )
bool QgsPostgresProvider::setSubsetString( const QString& theSQL, bool updateFeatureCount )
{
QString prevWhere = mSqlWhereClause;
@ -3426,7 +3426,7 @@ QGISEXTERN int dataCapabilities()
return QgsDataProvider::Database;
}
QGISEXTERN QgsDataItem *dataItem( QString thePath, QgsDataItem *parentItem )
QGISEXTERN QgsDataItem *dataItem( const QString& thePath, QgsDataItem *parentItem )
{
Q_UNUSED( thePath );
return new QgsPGRootItem( parentItem, "PostGIS", "pg:" );
@ -3813,7 +3813,7 @@ QGISEXTERN int listStyles( const QString &uri, QStringList &ids, QStringList &na
return numberOfRelatedStyles;
}
QGISEXTERN QString getStyleById( const QString& uri, QString styleId, QString& errCause )
QGISEXTERN QString getStyleById( const QString& uri, const QString& styleId, QString& errCause )
{
QgsDataSourceURI dsUri( uri );

View File

@ -231,7 +231,7 @@ class QgsPostgresProvider : public QgsVectorDataProvider
QString subsetString() override;
/** Mutator for sql where clause used to limit dataset size */
bool setSubsetString( QString theSQL, bool updateFeatureCount = true ) override;
bool setSubsetString( const QString& theSQL, bool updateFeatureCount = true ) override;
virtual bool supportsSubsetString() override { return true; }
@ -457,14 +457,14 @@ class QgsPostgresProvider : public QgsVectorDataProvider
};
// A function that determines if the given columns contain unique entries
bool uniqueData( QString quotedColNames );
bool uniqueData( const QString& quotedColNames );
int mEnabledCapabilities;
void appendGeomParam( const QgsGeometry *geom, QStringList &param ) const;
void appendPkParams( QgsFeatureId fid, QStringList &param ) const;
QString paramValue( QString fieldvalue, const QString &defaultValue ) const;
QString paramValue( const QString& fieldvalue, const QString &defaultValue ) const;
QgsPostgresConn *mConnectionRO; //! read-only database connection (initially)
QgsPostgresConn *mConnectionRW; //! read-write database connection (on update)
@ -474,8 +474,8 @@ class QgsPostgresProvider : public QgsVectorDataProvider
void disconnectDb();
static QString quotedIdentifier( QString ident ) { return QgsPostgresConn::quotedIdentifier( ident ); }
static QString quotedValue( QVariant value ) { return QgsPostgresConn::quotedValue( value ); }
static QString quotedIdentifier( const QString& ident ) { return QgsPostgresConn::quotedIdentifier( ident ); }
static QString quotedValue( const QVariant& value ) { return QgsPostgresConn::quotedValue( value ); }
friend class QgsPostgresFeatureSource;
@ -498,7 +498,7 @@ class QgsPostgresUtils
const QList<int>& pkAttrs,
QSharedPointer<QgsPostgresSharedData> sharedData );
static QString whereClause( QgsFeatureIds featureIds,
static QString whereClause( const QgsFeatureIds& featureIds,
const QgsFields& fields,
QgsPostgresConn* conn,
QgsPostgresPrimaryKeyType pkType,

View File

@ -32,7 +32,7 @@ QStringList QgsSpatiaLiteConnection::connectionList()
return settings.childGroups();
}
void QgsSpatiaLiteConnection::deleteConnection( QString name )
void QgsSpatiaLiteConnection::deleteConnection( const QString& name )
{
QSettings settings;
QString key = "/SpatiaLite/connections/" + name;
@ -40,7 +40,7 @@ void QgsSpatiaLiteConnection::deleteConnection( QString name )
settings.remove( key );
}
QString QgsSpatiaLiteConnection::connectionPath( QString name )
QString QgsSpatiaLiteConnection::connectionPath( const QString& name )
{
QSettings settings;
return settings.value( "/SpatiaLite/connections/" + name + "/sqlitepath" ).toString();
@ -48,7 +48,7 @@ QString QgsSpatiaLiteConnection::connectionPath( QString name )
// -------
QgsSpatiaLiteConnection::QgsSpatiaLiteConnection( QString name )
QgsSpatiaLiteConnection::QgsSpatiaLiteConnection( const QString& name )
{
// "name" can be either a saved connection or a path to database
@ -135,7 +135,7 @@ bool QgsSpatiaLiteConnection::updateStatistics()
#endif
}
sqlite3 *QgsSpatiaLiteConnection::openSpatiaLiteDb( QString path )
sqlite3 *QgsSpatiaLiteConnection::openSpatiaLiteDb( const QString& path )
{
sqlite3 *handle = NULL;
int ret;
@ -646,7 +646,7 @@ bool QgsSpatiaLiteConnection::isRasterlite1Datasource( sqlite3 * handle, const c
return exists;
}
bool QgsSpatiaLiteConnection::isDeclaredHidden( sqlite3 * handle, QString table, QString geom )
bool QgsSpatiaLiteConnection::isDeclaredHidden( sqlite3 * handle, const QString& table, const QString& geom )
{
int ret;
int i;

View File

@ -30,17 +30,17 @@ class QgsSpatiaLiteConnection : public QObject
Q_OBJECT
public:
/** Construct a connection. Name can be either stored connection name or a path to the database file */
explicit QgsSpatiaLiteConnection( QString name );
explicit QgsSpatiaLiteConnection( const QString& name );
QString path() { return mPath; }
static QStringList connectionList();
static void deleteConnection( QString name );
static QString connectionPath( QString name );
static void deleteConnection( const QString& name );
static QString connectionPath( const QString& name );
typedef struct TableEntry
{
TableEntry( QString _tableName, QString _column, QString _type )
TableEntry( const QString& _tableName, const QString& _column, const QString& _type )
: tableName( _tableName ), column( _column ), type( _type ) {}
QString tableName;
QString column;
@ -76,7 +76,7 @@ class QgsSpatiaLiteConnection : public QObject
protected:
// SpatiaLite DB open / close
sqlite3 *openSpatiaLiteDb( QString path );
sqlite3 *openSpatiaLiteDb( const QString& path );
void closeSpatiaLiteDb( sqlite3 * handle );
/** Checks if geometry_columns and spatial_ref_sys exist and have expected layout*/
@ -113,7 +113,7 @@ class QgsSpatiaLiteConnection : public QObject
bool checkVirtsGeometryColumns( sqlite3 * handle );
/** Checks if this layer has been declared HIDDEN*/
bool isDeclaredHidden( sqlite3 * handle, QString table, QString geom );
bool isDeclaredHidden( sqlite3 * handle, const QString& table, const QString& geom );
/** Checks if this layer is a RasterLite-1 datasource*/
bool isRasterlite1Datasource( sqlite3 * handle, const char * table );

View File

@ -24,7 +24,7 @@ inline QString qgsConnectionPool_ConnectionToName( QgsSqliteHandle* c )
return c->dbPath();
}
inline void qgsConnectionPool_ConnectionCreate( QString connInfo, QgsSqliteHandle*& c )
inline void qgsConnectionPool_ConnectionCreate( const QString& connInfo, QgsSqliteHandle*& c )
{
c = QgsSqliteHandle::openDb( connInfo, false );
}
@ -51,7 +51,7 @@ class QgsSpatiaLiteConnPoolGroup : public QObject, public QgsConnectionPoolGroup
Q_OBJECT
public:
explicit QgsSpatiaLiteConnPoolGroup( QString name ) : QgsConnectionPoolGroup<QgsSqliteHandle*>( name ) { initTimer( this ); }
explicit QgsSpatiaLiteConnPoolGroup( const QString& name ) : QgsConnectionPoolGroup<QgsSqliteHandle*>( name ) { initTimer( this ); }
protected slots:
void handleConnectionExpired() { onConnectionExpired(); }

View File

@ -29,7 +29,7 @@
QGISEXTERN bool deleteLayer( const QString& dbPath, const QString& tableName, QString& errCause );
QgsSLLayerItem::QgsSLLayerItem( QgsDataItem* parent, QString name, QString path, QString uri, LayerType layerType )
QgsSLLayerItem::QgsSLLayerItem( QgsDataItem* parent, const QString& name, const QString& path, const QString& uri, LayerType layerType )
: QgsLayerItem( parent, name, path, uri, layerType, "spatialite" )
{
setState( Populated ); // no children are expected
@ -69,7 +69,7 @@ void QgsSLLayerItem::deleteLayer()
// ------
QgsSLConnectionItem::QgsSLConnectionItem( QgsDataItem* parent, QString name, QString path )
QgsSLConnectionItem::QgsSLConnectionItem( QgsDataItem* parent, const QString& name, const QString& path )
: QgsDataCollectionItem( parent, name, path )
{
mDbPath = QgsSpatiaLiteConnection::connectionPath( name );
@ -80,7 +80,7 @@ QgsSLConnectionItem::~QgsSLConnectionItem()
{
}
static QgsLayerItem::LayerType _layerTypeFromDb( QString dbType )
static QgsLayerItem::LayerType _layerTypeFromDb( const QString& dbType )
{
if ( dbType == "POINT" || dbType == "MULTIPOINT" )
{
@ -254,7 +254,7 @@ bool QgsSLConnectionItem::handleDrop( const QMimeData * data, Qt::DropAction )
// ---------------------------------------------------------------------------
QgsSLRootItem::QgsSLRootItem( QgsDataItem* parent, QString name, QString path )
QgsSLRootItem::QgsSLRootItem( QgsDataItem* parent, const QString& name, const QString& path )
: QgsDataCollectionItem( parent, name, path )
{
mCapabilities |= Fast;
@ -354,7 +354,7 @@ QGISEXTERN int dataCapabilities()
return QgsDataProvider::Database;
}
QGISEXTERN QgsDataItem * dataItem( QString thePath, QgsDataItem* parentItem )
QGISEXTERN QgsDataItem * dataItem( const QString& thePath, QgsDataItem* parentItem )
{
Q_UNUSED( thePath );
return new QgsSLRootItem( parentItem, "SpatiaLite", "spatialite:" );

View File

@ -21,7 +21,7 @@ class QgsSLLayerItem : public QgsLayerItem
{
Q_OBJECT
public:
QgsSLLayerItem( QgsDataItem* parent, QString name, QString path, QString uri, LayerType layerType );
QgsSLLayerItem( QgsDataItem* parent, const QString& name, const QString& path, const QString& uri, LayerType layerType );
QList<QAction*> actions() override;
@ -33,7 +33,7 @@ class QgsSLConnectionItem : public QgsDataCollectionItem
{
Q_OBJECT
public:
QgsSLConnectionItem( QgsDataItem* parent, QString name, QString path );
QgsSLConnectionItem( QgsDataItem* parent, const QString& name, const QString& path );
~QgsSLConnectionItem();
QVector<QgsDataItem*> createChildren() override;
@ -56,7 +56,7 @@ class QgsSLRootItem : public QgsDataCollectionItem
{
Q_OBJECT
public:
QgsSLRootItem( QgsDataItem* parent, QString name, QString path );
QgsSLRootItem( QgsDataItem* parent, const QString& name, const QString& path );
~QgsSLRootItem();
QVector<QgsDataItem*> createChildren() override;

View File

@ -141,7 +141,7 @@ bool QgsSpatiaLiteFeatureIterator::close()
////
bool QgsSpatiaLiteFeatureIterator::prepareStatement( QString whereClause )
bool QgsSpatiaLiteFeatureIterator::prepareStatement( const QString& whereClause )
{
if ( !mHandle )
return false;

View File

@ -73,7 +73,7 @@ class QgsSpatiaLiteFeatureIterator : public QgsAbstractFeatureIteratorFromSource
QString whereClauseFid();
QString whereClauseFids();
QString mbr( const QgsRectangle& rect );
bool prepareStatement( QString whereClause );
bool prepareStatement( const QString& whereClause );
QString quotedPrimaryKey();
bool getFeature( sqlite3_stmt *stmt, QgsFeature &feature );
QString fieldName( const QgsField& fld );

View File

@ -3166,7 +3166,7 @@ QString QgsSpatiaLiteProvider::subsetString()
return mSubsetString;
}
bool QgsSpatiaLiteProvider::setSubsetString( QString theSQL, bool updateFeatureCount )
bool QgsSpatiaLiteProvider::setSubsetString( const QString& theSQL, bool updateFeatureCount )
{
QString prevSubsetString = mSubsetString;
mSubsetString = theSQL;
@ -5519,7 +5519,7 @@ QGISEXTERN int listStyles( const QString &uri, QStringList &ids, QStringList &na
return numberOfRelatedStyles;
}
QGISEXTERN QString getStyleById( const QString& uri, QString styleId, QString& errCause )
QGISEXTERN QString getStyleById( const QString& uri, const QString& styleId, QString& errCause )
{
QgsSqliteHandle *handle;
sqlite3 *sqliteHandle = NULL;

View File

@ -94,7 +94,7 @@ class QgsSpatiaLiteProvider: public QgsVectorDataProvider
virtual QString subsetString() override;
/** Mutator for sql where clause used to limit dataset size */
virtual bool setSubsetString( QString theSQL, bool updateFeatureCount = true ) override;
virtual bool setSubsetString( const QString& theSQL, bool updateFeatureCount = true ) override;
virtual bool supportsSubsetString() override { return true; }

View File

@ -233,7 +233,7 @@ void QgsSpatiaLiteSourceSelect::on_mSearchModeComboBox_currentIndexChanged( cons
on_mSearchTableEdit_textChanged( mSearchTableEdit->text() );
}
void QgsSpatiaLiteSourceSelect::setLayerType( QString table, QString column, QString type )
void QgsSpatiaLiteSourceSelect::setLayerType( const QString& table, const QString& column, const QString& type )
{
mTableModel.setGeometryTypesForTable( table, column, type );
mTablesTreeView->sortByColumn( 0, Qt::AscendingOrder );
@ -530,7 +530,7 @@ void QgsSpatiaLiteSourceSelect::setSql( const QModelIndex &index )
delete vlayer;
}
QString QgsSpatiaLiteSourceSelect::fullDescription( QString table, QString column, QString type )
QString QgsSpatiaLiteSourceSelect::fullDescription( const QString& table, const QString& column, const QString& type )
{
QString full_desc = "";
full_desc += table + "\" (" + column + ") " + type;

View File

@ -87,7 +87,7 @@ class QgsSpatiaLiteSourceSelect: public QDialog, private Ui::QgsDbSourceSelectBa
void on_cbxAllowGeometrylessTables_stateChanged( int );
void setSql( const QModelIndex& index );
void on_cmbConnections_activated( int );
void setLayerType( QString table, QString column, QString type );
void setLayerType( const QString& table, const QString& column, const QString& type );
void on_mTablesTreeView_clicked( const QModelIndex &index );
void on_mTablesTreeView_doubleClicked( const QModelIndex &index );
//!Sets a new regular expression to the model
@ -116,7 +116,7 @@ class QgsSpatiaLiteSourceSelect: public QDialog, private Ui::QgsDbSourceSelectBa
void setConnectionListPosition();
// Combine the table and column data into a single string
// useful for display to the user
QString fullDescription( QString table, QString column, QString type );
QString fullDescription( const QString& table, const QString& column, const QString& type );
// The column labels
QStringList mColumnLabels;
QString mSqlitePath;

View File

@ -34,7 +34,7 @@ QgsSpatiaLiteTableModel::~QgsSpatiaLiteTableModel()
}
void QgsSpatiaLiteTableModel::addTableEntry( QString type, QString tableName, QString geometryColName, QString sql )
void QgsSpatiaLiteTableModel::addTableEntry( const QString& type, const QString& tableName, const QString& geometryColName, const QString& sql )
{
//is there already a root item ?
QStandardItem *dbItem;

View File

@ -29,7 +29,7 @@ class QgsSpatiaLiteTableModel: public QStandardItemModel
QgsSpatiaLiteTableModel();
~QgsSpatiaLiteTableModel();
/** Adds entry for one database table to the model*/
void addTableEntry( QString type, QString tableName, QString geometryColName, QString sql );
void addTableEntry( const QString& type, const QString& tableName, const QString& geometryColName, const QString& sql );
/** Sets an sql statement that belongs to a cell specified by a model index*/
void setSql( const QModelIndex& index, const QString& sql );
/** Sets one or more geometry types to a row. In case of several types, additional rows are inserted.

View File

@ -209,7 +209,7 @@ void QgsWcsCapabilities::clear()
mCapabilities = QgsWcsCapabilitiesProperty();
}
QString QgsWcsCapabilities::getCapabilitiesUrl( const QString version ) const
QString QgsWcsCapabilities::getCapabilitiesUrl( const QString& version ) const
{
QString url = prepareUri( mUri.param( "url" ) ) + "SERVICE=WCS&REQUEST=GetCapabilities";
@ -266,7 +266,7 @@ bool QgsWcsCapabilities::retrieveServerCapabilities()
return false;
}
bool QgsWcsCapabilities::retrieveServerCapabilities( QString preferredVersion )
bool QgsWcsCapabilities::retrieveServerCapabilities( const QString& preferredVersion )
{
clear();

View File

@ -129,7 +129,7 @@ class QgsWcsCapabilities : public QObject
/** \brief Returns the GetCoverage full url
* \param version optional version, e.g. 1.0.0 or 1.1.0 */
QString getCapabilitiesUrl( const QString version ) const;
QString getCapabilitiesUrl( const QString& version ) const;
/** \brief Returns the GetCoverage full url using current version */
QString getCapabilitiesUrl() const;
@ -247,7 +247,7 @@ class QgsWcsCapabilities : public QObject
*
* TODO: Make network-timeout tolerant
*/
bool retrieveServerCapabilities( QString preferredVersion );
bool retrieveServerCapabilities( const QString& preferredVersion );
/** Retrieve the best WCS version supported by server and QGIS */
bool retrieveServerCapabilities();

View File

@ -24,7 +24,7 @@
#include <QFileInfo>
#include <QSettings>
QgsWCSConnectionItem::QgsWCSConnectionItem( QgsDataItem* parent, QString name, QString path, QString uri )
QgsWCSConnectionItem::QgsWCSConnectionItem( QgsDataItem* parent, const QString& name, const QString& path, const QString& uri )
: QgsDataCollectionItem( parent, name, path )
, mUri( uri )
{
@ -119,7 +119,7 @@ void QgsWCSConnectionItem::deleteConnection()
// ---------------------------------------------------------------------------
QgsWCSLayerItem::QgsWCSLayerItem( QgsDataItem* parent, QString name, QString path, const QgsWcsCapabilitiesProperty& capabilitiesProperty, QgsDataSourceURI dataSourceUri, const QgsWcsCoverageSummary& coverageSummary )
QgsWCSLayerItem::QgsWCSLayerItem( QgsDataItem* parent, const QString& name, const QString& path, const QgsWcsCapabilitiesProperty& capabilitiesProperty, const QgsDataSourceURI& dataSourceUri, const QgsWcsCoverageSummary& coverageSummary )
: QgsLayerItem( parent, name, path, QString(), QgsLayerItem::Raster, "wcs" )
, mCapabilities( capabilitiesProperty )
, mDataSourceUri( dataSourceUri )
@ -217,7 +217,7 @@ QString QgsWCSLayerItem::createUri()
// ---------------------------------------------------------------------------
QgsWCSRootItem::QgsWCSRootItem( QgsDataItem* parent, QString name, QString path )
QgsWCSRootItem::QgsWCSRootItem( QgsDataItem* parent, const QString& name, const QString& path )
: QgsDataCollectionItem( parent, name, path )
{
mCapabilities |= Fast;
@ -286,7 +286,7 @@ QGISEXTERN int dataCapabilities()
return QgsDataProvider::Net;
}
QGISEXTERN QgsDataItem * dataItem( QString thePath, QgsDataItem* parentItem )
QGISEXTERN QgsDataItem * dataItem( const QString& thePath, QgsDataItem* parentItem )
{
QgsDebugMsg( "thePath = " + thePath );
if ( thePath.isEmpty() )

View File

@ -23,7 +23,7 @@ class QgsWCSConnectionItem : public QgsDataCollectionItem
{
Q_OBJECT
public:
QgsWCSConnectionItem( QgsDataItem* parent, QString name, QString path, QString uri );
QgsWCSConnectionItem( QgsDataItem* parent, const QString& name, const QString& path, const QString& uri );
~QgsWCSConnectionItem();
QVector<QgsDataItem*> createChildren() override;
@ -48,8 +48,8 @@ class QgsWCSLayerItem : public QgsLayerItem
{
Q_OBJECT
public:
QgsWCSLayerItem( QgsDataItem* parent, QString name, QString path,
const QgsWcsCapabilitiesProperty& capabilitiesProperty, QgsDataSourceURI dataSourceUri, const QgsWcsCoverageSummary& coverageSummary );
QgsWCSLayerItem( QgsDataItem* parent, const QString& name, const QString& path,
const QgsWcsCapabilitiesProperty& capabilitiesProperty, const QgsDataSourceURI& dataSourceUri, const QgsWcsCoverageSummary& coverageSummary );
~QgsWCSLayerItem();
QString createUri();
@ -63,7 +63,7 @@ class QgsWCSRootItem : public QgsDataCollectionItem
{
Q_OBJECT
public:
QgsWCSRootItem( QgsDataItem* parent, QString name, QString path );
QgsWCSRootItem( QgsDataItem* parent, const QString& name, const QString& path );
~QgsWCSRootItem();
QVector<QgsDataItem*> createChildren() override;

View File

@ -384,7 +384,7 @@ QgsWcsProvider::QgsWcsProvider( QString const &uri )
QgsDebugMsg( "Constructed ok, provider valid." );
}
bool QgsWcsProvider::parseUri( QString uriString )
bool QgsWcsProvider::parseUri( const QString& uriString )
{
QgsDebugMsg( "uriString = " + uriString );
@ -509,7 +509,7 @@ void QgsWcsProvider::setCoverageCrs( QString const & crs )
}
}
void QgsWcsProvider::setQueryItem( QUrl &url, QString item, QString value )
void QgsWcsProvider::setQueryItem( QUrl &url, const QString& item, const QString& value )
{
url.removeQueryItem( item );
url.addQueryItem( item, value );
@ -1575,7 +1575,7 @@ void QgsWcsProvider::reloadData()
clearCache();
}
QString QgsWcsProvider::nodeAttribute( const QDomElement &e, QString name, QString defValue )
QString QgsWcsProvider::nodeAttribute( const QDomElement &e, const QString& name, const QString& defValue )
{
if ( e.hasAttribute( name ) )
return e.attribute( name );

View File

@ -217,7 +217,7 @@ class QgsWcsProvider : public QgsRasterDataProvider, QgsGdalProviderBase
void showMessageBox( const QString& title, const QString& text );
// case insensitive attribute value lookup
static QString nodeAttribute( const QDomElement &e, QString name, QString defValue = QString::null );
static QString nodeAttribute( const QDomElement &e, const QString& name, const QString& defValue = QString::null );
//! parse the WCS ServiceException XML element
static void parseServiceException( QDomElement const &e, const QString& wcsVersion, QString& errorTitle, QString& errorText );
@ -238,7 +238,7 @@ class QgsWcsProvider : public QgsRasterDataProvider, QgsGdalProviderBase
*
*/
bool parseUri( QString uri );
bool parseUri( const QString& uri );
/**
* \brief Prepare the URI so that we can later simply append param=value
@ -250,7 +250,7 @@ class QgsWcsProvider : public QgsRasterDataProvider, QgsGdalProviderBase
QString coverageMetadata( const QgsWcsCoverageSummary& c );
//! remove query item and replace it with a new value
void setQueryItem( QUrl &url, QString key, QString value );
void setQueryItem( QUrl &url, const QString& key, const QString& value );
//! Release cache resources
void clearCache();

View File

@ -27,7 +27,7 @@
static const QString WFS_NAMESPACE = "http://www.opengis.net/wfs";
QgsWFSCapabilities::QgsWFSCapabilities( QString theUri )
QgsWFSCapabilities::QgsWFSCapabilities( const QString& theUri )
: mCapabilitiesReply( 0 )
, mErrorCode( QgsWFSCapabilities::NoError )
{
@ -81,7 +81,7 @@ QString QgsWFSCapabilities::uriDescribeFeatureType( const QString& typeName ) co
return mBaseUrl + "SERVICE=WFS&REQUEST=DescribeFeatureType&VERSION=1.0.0&TYPENAME=" + typeName;
}
QString QgsWFSCapabilities::uriGetFeature( QString typeName, QString crsString, QString filter, QgsRectangle bBox ) const
QString QgsWFSCapabilities::uriGetFeature( const QString& typeName, QString crsString, QString filter, const QgsRectangle& bBox ) const
{
//get CRS
if ( !crsString.isEmpty() )

View File

@ -28,7 +28,7 @@ class QgsWFSCapabilities : public QObject
Q_OBJECT
public:
//explicit QgsWFSCapabilities( QString connName, QObject *parent = 0 );
explicit QgsWFSCapabilities( QString theUri );
explicit QgsWFSCapabilities( const QString& theUri );
//! Append ? or & if necessary
QString prepareUri( QString uri );
@ -41,10 +41,10 @@ class QgsWFSCapabilities : public QObject
QString uriDescribeFeatureType( const QString& typeName ) const;
//! URI to get features
//! @param filter can be an OGC filter xml or a QGIS expression (containing =,!=, <,>,<=, >=, AND, OR, NOT )
QString uriGetFeature( QString typeName,
QString uriGetFeature( const QString& typeName,
QString crs = QString(),
QString filter = QString(),
QgsRectangle bBox = QgsRectangle() ) const;
const QgsRectangle& bBox = QgsRectangle() ) const;
//! start network connection to get capabilities
void requestCapabilities();

View File

@ -24,7 +24,7 @@
#include <QCoreApplication>
QgsWFSLayerItem::QgsWFSLayerItem( QgsDataItem* parent, QString name, QgsDataSourceURI uri, QString featureType, QString title, QString crsString )
QgsWFSLayerItem::QgsWFSLayerItem( QgsDataItem* parent, const QString& name, const QgsDataSourceURI& uri, const QString& featureType, const QString& title, const QString& crsString )
: QgsLayerItem( parent, title, parent->path() + "/" + name, QString(), QgsLayerItem::Vector, "WFS" )
{
mUri = QgsWFSCapabilities( uri.encodedUri() ).uriGetFeature( featureType, crsString );
@ -38,7 +38,7 @@ QgsWFSLayerItem::~QgsWFSLayerItem()
////
QgsWFSConnectionItem::QgsWFSConnectionItem( QgsDataItem* parent, QString name, QString path, QString uri )
QgsWFSConnectionItem::QgsWFSConnectionItem( QgsDataItem* parent, const QString& name, const QString& path, const QString& uri )
: QgsDataCollectionItem( parent, name, path )
, mUri( uri )
, mCapabilities( NULL )
@ -136,7 +136,7 @@ void QgsWFSConnectionItem::deleteConnection()
//////
QgsWFSRootItem::QgsWFSRootItem( QgsDataItem* parent, QString name, QString path )
QgsWFSRootItem::QgsWFSRootItem( QgsDataItem* parent, const QString& name, const QString& path )
: QgsDataCollectionItem( parent, name, path )
{
mCapabilities |= Fast;
@ -208,7 +208,7 @@ QGISEXTERN int dataCapabilities()
return QgsDataProvider::Net;
}
QGISEXTERN QgsDataItem * dataItem( QString thePath, QgsDataItem* parentItem )
QGISEXTERN QgsDataItem * dataItem( const QString& thePath, QgsDataItem* parentItem )
{
QgsDebugMsg( "thePath = " + thePath );
if ( thePath.isEmpty() )

View File

@ -23,7 +23,7 @@ class QgsWFSRootItem : public QgsDataCollectionItem
{
Q_OBJECT
public:
QgsWFSRootItem( QgsDataItem* parent, QString name, QString path );
QgsWFSRootItem( QgsDataItem* parent, const QString& name, const QString& path );
~QgsWFSRootItem();
QVector<QgsDataItem*> createChildren() override;
@ -43,7 +43,7 @@ class QgsWFSConnectionItem : public QgsDataCollectionItem
{
Q_OBJECT
public:
QgsWFSConnectionItem( QgsDataItem* parent, QString name, QString path, QString uri );
QgsWFSConnectionItem( QgsDataItem* parent, const QString& name, const QString& path, const QString& uri );
~QgsWFSConnectionItem();
QVector<QgsDataItem*> createChildren() override;
@ -68,7 +68,7 @@ class QgsWFSConnectionItem : public QgsDataCollectionItem
class QgsWFSLayerItem : public QgsLayerItem
{
public:
QgsWFSLayerItem( QgsDataItem* parent, QString name, QgsDataSourceURI uri, QString featureType, QString title, QString crsString );
QgsWFSLayerItem( QgsDataItem* parent, const QString& name, const QgsDataSourceURI& uri, const QString& featureType, const QString& title, const QString& crsString );
~QgsWFSLayerItem();
};

View File

@ -1242,7 +1242,7 @@ int QgsWFSProvider::getFeaturesFromGML2( const QDomElement& wfsCollectionElement
return 0;
}
int QgsWFSProvider::readGML2Coordinates( std::list<QgsPoint>& coords, const QDomElement elem ) const
int QgsWFSProvider::readGML2Coordinates( std::list<QgsPoint>& coords, const QDomElement& elem ) const
{
QString coordSeparator = ",";
QString tupelSeparator = " ";
@ -1653,7 +1653,7 @@ bool QgsWFSProvider::initGetRenderedOnly( const QgsRectangle &rect )
}
#endif
QGis::WkbType QgsWFSProvider::geomTypeFromPropertyType( QString attName, QString propType )
QGis::WkbType QgsWFSProvider::geomTypeFromPropertyType( const QString& attName, const QString& propType )
{
Q_UNUSED( attName );
const QStringList geomTypes = ( QStringList()

View File

@ -246,7 +246,7 @@ class QgsWFSProvider : public QgsVectorDataProvider
@param coords list where the found coordinates are appended
@param elem the <gml:coordinates> element
@return 0 in case of success*/
int readGML2Coordinates( std::list<QgsPoint>& coords, const QDomElement elem ) const;
int readGML2Coordinates( std::list<QgsPoint>& coords, const QDomElement& elem ) const;
/** Tries to create a QgsCoordinateReferenceSystem object and assign it to mSourceCRS. Returns 0 in case of success*/
int setCRSFromGML2( const QDomElement& wfsCollectionElement );
@ -285,7 +285,7 @@ class QgsWFSProvider : public QgsVectorDataProvider
bool initGetRenderedOnly( const QgsRectangle &rect );
#endif
/** Converts DescribeFeatureType schema geometry property type to WKBType*/
QGis::WkbType geomTypeFromPropertyType( QString attName, QString propType );
QGis::WkbType geomTypeFromPropertyType( const QString& attName, const QString& propType );
void deleteData();
};

View File

@ -562,7 +562,7 @@ void QgsWFSSourceSelect::buildQueryButtonClicked()
buildQuery( treeView->selectionModel()->currentIndex() );
}
void QgsWFSSourceSelect::filterChanged( QString text )
void QgsWFSSourceSelect::filterChanged( const QString& text )
{
QgsDebugMsg( "WFS FeatureType filter changed to :" + text );
QRegExp::PatternSyntax mySyntax = QRegExp::PatternSyntax( QRegExp::RegExp );

Some files were not shown because too many files have changed in this diff Show More