Skip to content
Permalink
Browse files

Swap QSharedPointer to std::shared_ptr

  • Loading branch information
nyalldawson committed Feb 7, 2017
1 parent aed6c73 commit 337dabea4e6e1d29e552dcc9e6c5d42af4edd619
Showing with 64 additions and 87 deletions.
  1. +0 −1 src/app/qgsmaptoolselect.cpp
  2. +2 −1 src/core/qgsaction.h
  3. +5 −5 src/core/qgsexpression.cpp
  4. +2 −2 src/core/qgsexpressionprivate.h
  5. +0 −1 src/core/qgsmaphittest.cpp
  6. +3 −3 src/core/qgsvectorlayerjoininfo.h
  7. +0 −1 src/core/symbology-ng/qgscategorizedsymbolrenderer.h
  8. +0 −1 src/core/symbology-ng/qgsgraduatedsymbolrenderer.h
  9. +0 −1 src/core/symbology-ng/qgsheatmaprenderer.h
  10. +0 −1 src/core/symbology-ng/qgsinvertedpolygonrenderer.h
  11. +0 −1 src/core/symbology-ng/qgssinglesymbolrenderer.h
  12. +2 −2 src/gui/editorwidgets/core/qgseditorwidgetautoconf.cpp
  13. +2 −2 src/gui/editorwidgets/core/qgseditorwidgetautoconf.h
  14. +0 −1 src/gui/qgsdatadefinedbutton.h
  15. +2 −2 src/gui/qgsfieldexpressionwidget.cpp
  16. +2 −2 src/gui/qgsfieldexpressionwidget.h
  17. +0 −1 src/gui/qgspropertyoverridebutton.h
  18. +0 −1 src/gui/symbology-ng/qgssymbolselectordialog.h
  19. +0 −1 src/gui/symbology-ng/qgssymbolslistwidget.cpp
  20. +1 −2 src/providers/postgres/qgspostgresfeatureiterator.h
  21. +2 −2 src/providers/postgres/qgspostgresprovider.cpp
  22. +4 −4 src/providers/postgres/qgspostgresprovider.h
  23. +3 −2 src/providers/wfs/qgswfsfeatureiterator.h
  24. +3 −3 src/providers/wfs/qgswfsprovider.cpp
  25. +1 −1 src/providers/wfs/qgswfsprovider.h
  26. +0 −1 src/server/qgsserver.cpp
  27. +3 −3 src/server/services/wfs/qgswfsgetfeature.cpp
  28. +1 −1 src/server/services/wfs/qgswfstransaction.cpp
  29. +9 −9 tests/src/core/testqgscolorscheme.cpp
  30. +7 −7 tests/src/core/testqgscolorschemeregistry.cpp
  31. +1 −1 tests/src/core/testqgsdatadefined.cpp
  32. +2 −2 tests/src/core/testqgsdistancearea.cpp
  33. +0 −1 tests/src/core/testqgsexpression.cpp
  34. +0 −1 tests/src/core/testqgsfeature.cpp
  35. +0 −1 tests/src/core/testqgsfield.cpp
  36. +0 −1 tests/src/core/testqgsfields.cpp
  37. +0 −1 tests/src/core/testqgsfontutils.cpp
  38. +0 −1 tests/src/core/testqgsgraduatedsymbolrenderer.cpp
  39. +3 −3 tests/src/core/testqgsogcutils.cpp
  40. +0 −1 tests/src/core/testqgsogrutils.cpp
  41. +0 −1 tests/src/core/testqgspallabeling.cpp
  42. +0 −1 tests/src/core/testqgsprocessing.cpp
  43. +1 −1 tests/src/core/testqgsrulebasedrenderer.cpp
  44. +0 −1 tests/src/core/testqgsstatisticalsummary.cpp
  45. +0 −1 tests/src/core/testqgstaskmanager.cpp
  46. +3 −4 tests/src/gui/testqgsrubberband.cpp
@@ -26,7 +26,6 @@
#include <QMouseEvent>
#include <QRect>
#include <QColor>
#include <QScopedPointer>


QgsMapToolSelect::QgsMapToolSelect( QgsMapCanvas* canvas )
@@ -24,6 +24,7 @@
#include <QUuid>

#include "qgsexpressioncontext.h"
#include <memory>

class QgsExpressionContextScope;

@@ -189,7 +190,7 @@ class CORE_EXPORT QgsAction
QString mCommand;
bool mCaptureOutput = false;
QSet<QString> mActionScopes;
mutable QSharedPointer<QAction> mAction;
mutable std::shared_ptr<QAction> mAction;
QUuid mId;
};

@@ -4325,11 +4325,11 @@ bool QgsExpression::needsGeometry() const

void QgsExpression::initGeomCalculator()
{
if ( d->mCalc.data() )
if ( d->mCalc.get() )
return;

// Use planimetric as default
d->mCalc = QSharedPointer<QgsDistanceArea>( new QgsDistanceArea() );
d->mCalc = std::shared_ptr<QgsDistanceArea>( new QgsDistanceArea() );
d->mCalc->setEllipsoidalMode( false );
}

@@ -4349,9 +4349,9 @@ void QgsExpression::setGeomCalculator( const QgsDistanceArea *calc )
{
detach();
if ( calc )
d->mCalc = QSharedPointer<QgsDistanceArea>( new QgsDistanceArea( *calc ) );
d->mCalc = std::shared_ptr<QgsDistanceArea>( new QgsDistanceArea( *calc ) );
else
d->mCalc.clear();
d->mCalc.reset();
}

bool QgsExpression::prepare( const QgsExpressionContext *context )
@@ -4424,7 +4424,7 @@ QString QgsExpression::dump() const

QgsDistanceArea* QgsExpression::geomCalculator()
{
return d->mCalc.data();
return d->mCalc.get();
}

QgsUnitTypes::DistanceUnit QgsExpression::distanceUnits() const
@@ -18,7 +18,7 @@
#define QGSEXPRESSIONPRIVATE_H

#include <QString>
#include <QSharedPointer>
#include <memory>

#include "qgsexpression.h"
#include "qgsdistancearea.h"
@@ -67,7 +67,7 @@ class QgsExpressionPrivate

QString mExp;

QSharedPointer<QgsDistanceArea> mCalc;
std::shared_ptr<QgsDistanceArea> mCalc;
QgsUnitTypes::DistanceUnit mDistanceUnit;
QgsUnitTypes::AreaUnit mAreaUnit;
};
@@ -12,7 +12,6 @@
* (at your option) any later version. *
* *
***************************************************************************/
#include <QScopedPointer>

#include "qgsmaphittest.h"

@@ -66,11 +66,11 @@ class CORE_EXPORT QgsVectorLayerJoinInfo

/** Set subset of fields to be used from joined layer. Takes ownership of the passed pointer. Null pointer tells to use all fields.
@note added in 2.6 */
void setJoinFieldNamesSubset( QStringList* fieldNamesSubset ) { mJoinFieldsSubset = QSharedPointer<QStringList>( fieldNamesSubset ); }
void setJoinFieldNamesSubset( QStringList* fieldNamesSubset ) { mJoinFieldsSubset = std::shared_ptr<QStringList>( fieldNamesSubset ); }

/** Get subset of fields to be used from joined layer. All fields will be used if null is returned.
@note added in 2.6 */
QStringList* joinFieldNamesSubset() const { return mJoinFieldsSubset.data(); }
QStringList* joinFieldNamesSubset() const { return mJoinFieldsSubset.get(); }

protected:
//! Join field in the target layer
@@ -89,7 +89,7 @@ class CORE_EXPORT QgsVectorLayerJoinInfo
bool mMemoryCache;

//! Subset of fields to use from joined layer. null = use all fields
QSharedPointer<QStringList> mJoinFieldsSubset;
std::shared_ptr<QStringList> mJoinFieldsSubset;

// caching support

@@ -22,7 +22,6 @@
#include "qgscolorramp.h"

#include <QHash>
#include <QScopedPointer>

class QgsVectorLayer;

@@ -19,7 +19,6 @@
#include "qgssymbol.h"
#include "qgsrenderer.h"
#include "qgsexpression.h"
#include <QScopedPointer>
#include <QRegExp>

/** \ingroup core
@@ -21,7 +21,6 @@
#include "qgssymbol.h"
#include "qgsexpression.h"
#include "qgsgeometry.h"
#include <QScopedPointer>

class QgsColorRamp;

@@ -21,7 +21,6 @@
#include "qgsexpression.h"
#include "qgsfeature.h"
#include "qgsgeometry.h"
#include <QScopedPointer>

/** \ingroup core
* QgsInvertedPolygonRenderer is a polygon-only feature renderer used to
@@ -20,7 +20,6 @@
#include "qgsrenderer.h"
#include "qgssymbol.h"
#include "qgsexpression.h"
#include <QScopedPointer>

/** \ingroup core
* \class QgsSingleSymbolRenderer
@@ -104,7 +104,7 @@ QgsEditorWidgetSetup QgsEditorWidgetAutoConf::editorWidgetSetup( const QgsVector
}

int bestScore = 0;
Q_FOREACH ( QSharedPointer<QgsEditorWidgetAutoConfPlugin> cur, plugins )
Q_FOREACH ( std::shared_ptr<QgsEditorWidgetAutoConfPlugin> cur, plugins )
{
int score = 0;
const QgsEditorWidgetSetup curResult = cur->editorWidgetSetup( vl, fieldName, score );
@@ -121,6 +121,6 @@ QgsEditorWidgetSetup QgsEditorWidgetAutoConf::editorWidgetSetup( const QgsVector

void QgsEditorWidgetAutoConf::registerPlugin( QgsEditorWidgetAutoConfPlugin* plugin )
{
plugins.append( QSharedPointer<QgsEditorWidgetAutoConfPlugin>( plugin ) );
plugins.append( std::shared_ptr<QgsEditorWidgetAutoConfPlugin>( plugin ) );
}
///@endcond
@@ -16,8 +16,8 @@
#define QGSEDITORWIDGETAUTOCONF_H

#include <QList>
#include <QSharedPointer>
#include "qgis_gui.h"
#include <memory>

class QgsVectorLayer;
class QgsEditorWidgetSetup;
@@ -85,7 +85,7 @@ class GUI_EXPORT QgsEditorWidgetAutoConf
void registerPlugin( QgsEditorWidgetAutoConfPlugin* plugin );

private:
QList<QSharedPointer<QgsEditorWidgetAutoConfPlugin> > plugins;
QList<std::shared_ptr<QgsEditorWidgetAutoConfPlugin> > plugins;
};
///@endcond

@@ -20,7 +20,6 @@
#include <QMap>
#include <QPointer>
#include <QToolButton>
#include <QScopedPointer>
#include "qgsexpressioncontextgenerator.h"
#include "qgsproperty.h"
#include "qgis_gui.h"
@@ -97,7 +97,7 @@ void QgsFieldExpressionWidget::setLeftHandButtonStyle( bool isLeft )

void QgsFieldExpressionWidget::setGeomCalculator( const QgsDistanceArea &da )
{
mDa = QSharedPointer<const QgsDistanceArea>( new QgsDistanceArea( da ) );
mDa = std::shared_ptr<const QgsDistanceArea>( new QgsDistanceArea( da ) );
}

QString QgsFieldExpressionWidget::currentText() const
@@ -211,7 +211,7 @@ void QgsFieldExpressionWidget::editExpression()
QgsExpressionContext context = mExpressionContextGenerator ? mExpressionContextGenerator->createExpressionContext() : mExpressionContext;

QgsExpressionBuilderDialog dlg( vl, currentExpression, this, QStringLiteral( "generic" ), context );
if ( !mDa.isNull() )
if ( mDa )
{
dlg.setGeomCalculator( *mDa );
}
@@ -16,11 +16,11 @@
#ifndef QGSFIELDEXPRESSIONWIDGET_H
#define QGSFIELDEXPRESSIONWIDGET_H

#include <QSharedPointer>
#include <QWidget>
#include <QToolButton>
#include <QComboBox>
#include <QColor>
#include <memory>

#include "qgsdistancearea.h"
#include "qgsfieldproxymodel.h"
@@ -193,7 +193,7 @@ class GUI_EXPORT QgsFieldExpressionWidget : public QWidget
QToolButton* mButton;
QgsFieldProxyModel* mFieldProxyModel;
QString mExpressionDialogTitle;
QSharedPointer<const QgsDistanceArea> mDa;
std::shared_ptr<const QgsDistanceArea> mDa;
QgsExpressionContext mExpressionContext;
const QgsExpressionContextGenerator* mExpressionContextGenerator;
QString mBackupExpression;
@@ -21,7 +21,6 @@
#include <QMap>
#include <QPointer>
#include <QToolButton>
#include <QScopedPointer>
#include "qgsproperty.h"
#include "qgspropertycollection.h"
#include "qgsexpressioncontext.h"
@@ -25,7 +25,6 @@
#include "qgsproperty.h"

#include <QStandardItemModel>
#include <QScopedPointer>
#include <QDialogButtonBox>
#include "qgis_gui.h"

@@ -41,7 +41,6 @@
#include <QMessageBox>
#include <QMenu>
#include <QPushButton>
#include <QScopedPointer>


QgsSymbolsListWidget::QgsSymbolsListWidget( QgsSymbol* symbol, QgsStyle* style, QMenu* menu, QWidget* parent, const QgsVectorLayer * layer )
@@ -18,7 +18,6 @@
#include "qgsfeatureiterator.h"

#include <QQueue>
#include <QSharedPointer>

#include "qgspostgresprovider.h"

@@ -53,7 +52,7 @@ class QgsPostgresFeatureSource : public QgsAbstractFeatureSource
QString mQuery;
// TODO: loadFields()

QSharedPointer<QgsPostgresSharedData> mShared;
std::shared_ptr<QgsPostgresSharedData> mShared;

/* The transaction connection (if any) gets refed/unrefed when creating/
* destroying the QgsPostgresFeatureSource, to ensure that the transaction
@@ -467,7 +467,7 @@ QString QgsPostgresProvider::whereClause( QgsFeatureId featureId ) const
}


QString QgsPostgresUtils::whereClause( QgsFeatureId featureId, const QgsFields& fields, QgsPostgresConn* conn, QgsPostgresPrimaryKeyType pkType, const QList<int>& pkAttrs, QSharedPointer<QgsPostgresSharedData> sharedData )
QString QgsPostgresUtils::whereClause( QgsFeatureId featureId, const QgsFields& fields, QgsPostgresConn* conn, QgsPostgresPrimaryKeyType pkType, const QList<int>& pkAttrs, std::shared_ptr<QgsPostgresSharedData> sharedData )
{
QString whereClause;

@@ -532,7 +532,7 @@ QString QgsPostgresUtils::whereClause( QgsFeatureId featureId, const QgsFields&
return whereClause;
}

QString QgsPostgresUtils::whereClause( const 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, std::shared_ptr<QgsPostgresSharedData> sharedData )
{
switch ( pkType )
{
@@ -23,7 +23,7 @@
#include "qgsvectorlayerimport.h"
#include "qgspostgresconn.h"
#include "qgsfields.h"
#include <QSharedPointer>
#include <memory>

class QgsFeature;
class QgsField;
@@ -337,7 +337,7 @@ class QgsPostgresProvider : public QgsVectorDataProvider
QString mDetectedSrid; //! Spatial reference detected in the database
QString mRequestedSrid; //! Spatial reference requested in the uri

QSharedPointer<QgsPostgresSharedData> mShared; //!< Mutable data shared between provider and feature sources
std::shared_ptr<QgsPostgresSharedData> mShared; //!< Mutable data shared between provider and feature sources

bool getGeometryDetails();

@@ -419,14 +419,14 @@ class QgsPostgresUtils
QgsPostgresConn* conn,
QgsPostgresPrimaryKeyType pkType,
const QList<int>& pkAttrs,
QSharedPointer<QgsPostgresSharedData> sharedData );
std::shared_ptr<QgsPostgresSharedData> sharedData );

static QString whereClause( const QgsFeatureIds& featureIds,
const QgsFields& fields,
QgsPostgresConn* conn,
QgsPostgresPrimaryKeyType pkType,
const QList<int>& pkAttrs,
QSharedPointer<QgsPostgresSharedData> sharedData );
std::shared_ptr<QgsPostgresSharedData> sharedData );

static QString andWhereClauses( const QString& c1, const QString& c2 );

@@ -22,6 +22,7 @@
#include "qgsgml.h"
#include "qgsspatialindex.h"

#include <memory>
#include <QProgressDialog>
#include <QPushButton>

@@ -217,7 +218,7 @@ class QgsWFSFeatureIterator : public QObject,
//! Copies feature attributes / geometry from srcFeature to dstFeature
void copyFeature( const QgsFeature& srcFeature, QgsFeature& dstFeature );

QSharedPointer<QgsWFSSharedData> mShared; //!< Mutable data shared between provider and feature sources
std::shared_ptr<QgsWFSSharedData> mShared; //!< Mutable data shared between provider and feature sources

//! Subset of attributes (relatives to mShared->mFields) to fetch. Only valid if ( mRequest.flags() & QgsFeatureRequest::SubsetOfAttributes )
QgsAttributeList mSubSetAttributes;
@@ -256,7 +257,7 @@ class QgsWFSFeatureSource : public QgsAbstractFeatureSource

protected:

QSharedPointer<QgsWFSSharedData> mShared; //!< Mutable data shared between provider and feature sources
std::shared_ptr<QgsWFSSharedData> mShared; //!< Mutable data shared between provider and feature sources

friend class QgsWFSFeatureIterator;
};
@@ -59,8 +59,8 @@ QgsWFSProvider::QgsWFSProvider( const QString& uri, const QgsWfsCapabilities::Ca
, mCapabilities( 0 )
{
mShared->mCaps = caps;
connect( mShared.data(), SIGNAL( raiseError( const QString& ) ), this, SLOT( pushErrorSlot( const QString& ) ) );
connect( mShared.data(), SIGNAL( extentUpdated() ), this, SIGNAL( fullExtentCalculated() ) );
connect( mShared.get(), SIGNAL( raiseError( const QString& ) ), this, SLOT( pushErrorSlot( const QString& ) ) );
connect( mShared.get(), SIGNAL( extentUpdated() ), this, SIGNAL( fullExtentCalculated() ) );

if ( uri.isEmpty() )
{
@@ -120,7 +120,7 @@ QgsWFSProvider::QgsWFSProvider( const QString& uri, const QgsWfsCapabilities::Ca
//Failed to detect feature type from describeFeatureType -> get first feature from layer to detect type
if ( mWKBType == QgsWkbTypes::Unknown )
{
QgsWFSFeatureDownloader downloader( mShared.data() );
QgsWFSFeatureDownloader downloader( mShared.get() );
connect( &downloader, SIGNAL( featureReceived( QVector<QgsWFSFeatureGmlIdPair> ) ),
this, SLOT( featureReceivedAnalyzeOneFeature( QVector<QgsWFSFeatureGmlIdPair> ) ) );
downloader.run( false, /* serialize features */
@@ -122,7 +122,7 @@ class QgsWFSProvider : public QgsVectorDataProvider

private:
//! Mutable data shared between provider and feature sources
QSharedPointer<QgsWFSSharedData> mShared;
std::shared_ptr<QgsWFSSharedData> mShared;

friend class QgsWFSFeatureSource;

@@ -46,7 +46,6 @@
#include <QImage>
#include <QSettings>
#include <QDateTime>
#include <QScopedPointer>

// TODO: remove, it's only needed by a single debug message
#include <fcgi_stdio.h>

0 comments on commit 337dabe

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