Skip to content
Permalink
Browse files

Use c++11 '= delete' instead of private copy declarations

Switches the use of private copy constructors/copy assignment
operators to instead use public "=delete" declarations.
This results in clearer compile-time errors if these deleted
functions are used, vs obscure link-time errors.
  • Loading branch information
nyalldawson committed Jan 1, 2017
1 parent 8ebc73b commit 6579c4ced6c1ecf004c6776398af4a55d6b7cea7
Showing with 181 additions and 179 deletions.
  1. +3 −2 src/analysis/openstreetmap/qgsosmdatabase.h
  2. +3 −3 src/analysis/raster/qgsalignraster.h
  3. +3 −2 src/analysis/raster/qgsrastercalcnode.h
  4. +3 −2 src/analysis/raster/qgsrelief.h
  5. +3 −4 src/app/nodetool/qgsvertexentry.h
  6. +3 −5 src/app/qgisapp.h
  7. +3 −6 src/app/qgisappinterface.h
  8. +3 −2 src/app/qgsidentifyresultsdialog.h
  9. +3 −3 src/core/effects/qgspainteffectregistry.h
  10. +3 −5 src/core/gps/qgsgpsconnectionregistry.h
  11. +3 −3 src/core/pal/feature.h
  12. +3 −8 src/core/pal/pal.h
  13. +3 −5 src/core/pal/palstat.h
  14. +3 −2 src/core/pal/priorityqueue.h
  15. +3 −3 src/core/pal/problem.h
  16. +3 −5 src/core/qgsconnectionpool.h
  17. +4 −2 src/core/qgscrscache.h
  18. +3 −2 src/core/qgsdataitemproviderregistry.h
  19. +3 −3 src/core/qgsexpression.h
  20. +3 −3 src/core/qgsgml.h
  21. +3 −4 src/core/qgslabelingengine.h
  22. +3 −2 src/core/qgslabelsearchtree.h
  23. +2 −4 src/core/qgslocalec.h
  24. +3 −6 src/core/qgsmaplayer.h
  25. +3 −2 src/core/qgspallabeling.h
  26. +3 −4 src/core/qgspluginlayerregistry.h
  27. +3 −4 src/core/qgsrulebasedlabeling.h
  28. +4 −2 src/core/qgstransaction.h
  29. +3 −3 src/core/qgsvectorfilewriter.h
  30. +3 −7 src/core/qgsvectorlayer.h
  31. +3 −4 src/core/qgsvectorlayerimport.h
  32. +2 −1 src/core/raster/qgscontrastenhancement.h
  33. +4 −2 src/core/raster/qgsmultibandcolorrenderer.h
  34. +4 −2 src/core/raster/qgspalettedrasterrenderer.h
  35. +2 −1 src/core/raster/qgsrasterpipe.h
  36. +3 −2 src/core/raster/qgsrasterprojector.h
  37. +3 −4 src/core/raster/qgsrasterrenderer.h
  38. +3 −2 src/core/raster/qgsrastershader.h
  39. +3 −2 src/core/raster/qgssinglebandcolordatarenderer.h
  40. +4 −2 src/core/raster/qgssinglebandgrayrenderer.h
  41. +4 −2 src/core/raster/qgssinglebandpseudocolorrenderer.h
  42. +3 −4 src/core/simplify/effectivearea.h
  43. +3 −4 src/core/symbology-ng/qgscptcityarchive.h
  44. +5 −4 src/core/symbology-ng/qgsheatmaprenderer.h
  45. +5 −4 src/core/symbology-ng/qgsinvertedpolygonrenderer.h
  46. +3 −2 src/core/symbology-ng/qgsrendererregistry.h
  47. +3 −3 src/core/symbology-ng/qgsrulebasedrenderer.h
  48. +3 −4 src/core/symbology-ng/qgssvgcache.h
  49. +3 −2 src/core/symbology-ng/qgssymbollayerregistry.h
  50. +3 −4 src/gui/layertree/qgslayertreeembeddedwidgetregistry.h
  51. +3 −2 src/gui/qgsmapcanvassnapper.h
  52. +3 −2 src/plugins/geometry_checker/checks/qgsgeometrycheck.h
  53. +3 −2 src/plugins/spatialquery/qgsspatialquery.h
  54. +3 −2 src/providers/grass/qgsgrassrasterprovider.h
  55. +2 −1 src/providers/spatialite/qgsspatialiteprovider.h
  56. +4 −3 src/server/qgsowsserver.h
  57. +3 −2 src/server/qgswcsprojectparser.h
  58. +3 −2 src/server/qgswfsprojectparser.h
@@ -49,6 +49,9 @@ class ANALYSIS_EXPORT QgsOSMDatabase
explicit QgsOSMDatabase( const QString& dbFileName = QString() );
~QgsOSMDatabase();

QgsOSMDatabase( const QgsOSMDatabase& rh ) = delete;
QgsOSMDatabase& operator=( const QgsOSMDatabase& rh ) = delete;

void setFileName( const QString& dbFileName ) { mDbFileName = dbFileName; }
QString filename() const { return mDbFileName; }
bool isOpen() const;
@@ -120,8 +123,6 @@ class ANALYSIS_EXPORT QgsOSMDatabase
sqlite3_stmt* mStmtWayNodePoints;
sqlite3_stmt* mStmtWayTags;

QgsOSMDatabase( const QgsOSMDatabase& rh );
QgsOSMDatabase& operator=( const QgsOSMDatabase& rh );
};


@@ -49,6 +49,9 @@ class ANALYSIS_EXPORT QgsAlignRaster
RasterInfo( const QString& layerpath );
~RasterInfo();

RasterInfo( const RasterInfo& rh ) = delete;
RasterInfo& operator=( const RasterInfo& rh ) = delete;

//! Check whether the given path is a valid raster
bool isValid() const { return nullptr != mDataset; }

@@ -87,9 +90,6 @@ class ANALYSIS_EXPORT QgsAlignRaster

private:

RasterInfo( const RasterInfo& rh );
RasterInfo& operator=( const RasterInfo& rh );

friend class QgsAlignRaster;
};

@@ -76,6 +76,9 @@ class ANALYSIS_EXPORT QgsRasterCalcNode
QgsRasterCalcNode( const QString& rasterName );
~QgsRasterCalcNode();

QgsRasterCalcNode( const QgsRasterCalcNode& rh ) = delete;
QgsRasterCalcNode& operator=( const QgsRasterCalcNode& rh ) = delete;

Type type() const { return mType; }

//set left node
@@ -103,8 +106,6 @@ class ANALYSIS_EXPORT QgsRasterCalcNode
QgsRasterMatrix* mMatrix;
Operator mOperator;

QgsRasterCalcNode( const QgsRasterCalcNode& rh );
QgsRasterCalcNode& operator=( const QgsRasterCalcNode& rh );
};


@@ -45,6 +45,9 @@ class ANALYSIS_EXPORT QgsRelief
QgsRelief( const QString& inputFile, const QString& outputFile, const QString& outputFormat );
~QgsRelief();

QgsRelief( const QgsRelief& rh ) = delete;
QgsRelief& operator=( const QgsRelief& rh ) = delete;

/** Starts the calculation, reads from mInputFile and stores the result in mOutputFile
@param p progress dialog that receives update and that is checked for abort. 0 if no progress bar is needed.
@return 0 in case of success*/
@@ -122,8 +125,6 @@ class ANALYSIS_EXPORT QgsRelief
*/
bool calculateRegression( const QList< QPair < int, double > >& input, double& a, double& b );

QgsRelief( const QgsRelief& rh );
QgsRelief& operator=( const QgsRelief& rh );
};

#endif // QGSRELIEF_H
@@ -43,6 +43,9 @@ class QgsVertexEntry
int penWidth = 2 );
~QgsVertexEntry();

QgsVertexEntry( const QgsVertexEntry& rh ) = delete;
QgsVertexEntry& operator=( const QgsVertexEntry& rh ) = delete;

const QgsPointV2& point() const { return mPoint; }
QgsPoint pointV1() const { return QgsPoint( mPoint.x(), mPoint.y() ); }
QgsVertexId vertexId() const { return mVertexId; }
@@ -52,10 +55,6 @@ class QgsVertexEntry

void setSelected( bool selected = true );

private:

QgsVertexEntry( const QgsVertexEntry& rh );
QgsVertexEntry& operator=( const QgsVertexEntry& rh );
};

#endif
@@ -154,6 +154,9 @@ class APP_EXPORT QgisApp : public QMainWindow, private Ui::MainWindow

~QgisApp();

QgisApp( QgisApp const & ) = delete;
QgisApp & operator=( QgisApp const & ) = delete;

/**
* Add a vector layer to the canvas, returns pointer to it
*/
@@ -1509,11 +1512,6 @@ class APP_EXPORT QgisApp : public QMainWindow, private Ui::MainWindow
//! Configure layer tree view according to the user options from QSettings
void setupLayerTreeViewFromSettings();

/// QgisApp aren't copyable
QgisApp( QgisApp const & );
/// QgisApp aren't copyable
QgisApp & operator=( QgisApp const & );

void readSettings();
void writeSettings();
void createActions();
@@ -45,6 +45,9 @@ class APP_EXPORT QgisAppInterface : public QgisInterface
QgisAppInterface( QgisApp *qgisapp );
~QgisAppInterface();

QgisAppInterface( QgisAppInterface const & ) = delete;
QgisAppInterface & operator=( QgisAppInterface const & ) = delete;

QgsPluginManagerInterface* pluginManagerInterface() override;

QgsLayerTreeView* layerTreeView() override;
@@ -524,12 +527,6 @@ class APP_EXPORT QgisAppInterface : public QgisInterface

private:

/// QgisInterface aren't copied
QgisAppInterface( QgisAppInterface const & );

/// QgisInterface aren't copied
QgisAppInterface & operator=( QgisAppInterface const & );

//! Pointer to the QgisApp object
QgisApp *qgis;

@@ -110,11 +110,12 @@ class APP_EXPORT QgsIdentifyPlotCurve
QwtPlot* plot, const QString &title = QString(), QColor color = QColor() );
~QgsIdentifyPlotCurve();

QgsIdentifyPlotCurve( const QgsIdentifyPlotCurve& rh ) = delete;
QgsIdentifyPlotCurve& operator=( const QgsIdentifyPlotCurve& rh ) = delete;

private:
QwtPlotCurve* mPlotCurve;

QgsIdentifyPlotCurve( const QgsIdentifyPlotCurve& rh );
QgsIdentifyPlotCurve& operator=( const QgsIdentifyPlotCurve& rh );
};

class APP_EXPORT QgsIdentifyResultsDialog: public QDialog, private Ui::QgsIdentifyResultsBase
@@ -161,6 +161,9 @@ class CORE_EXPORT QgsPaintEffectRegistry
QgsPaintEffectRegistry();
~QgsPaintEffectRegistry();

QgsPaintEffectRegistry( const QgsPaintEffectRegistry& rh ) = delete;
QgsPaintEffectRegistry& operator=( const QgsPaintEffectRegistry& rh ) = delete;

/** Returns the metadata for a specific effect.
* @param name unique string name for paint effect class
* @returns paint effect metadata if found, otherwise nullptr
@@ -212,9 +215,6 @@ class CORE_EXPORT QgsPaintEffectRegistry

private:

QgsPaintEffectRegistry( const QgsPaintEffectRegistry& rh );
QgsPaintEffectRegistry& operator=( const QgsPaintEffectRegistry& rh );

QMap<QString, QgsPaintEffectAbstractMetadata*> mMetadata;
};

@@ -34,22 +34,20 @@ class CORE_EXPORT QgsGPSConnectionRegistry
{
public:
QgsGPSConnectionRegistry();

~QgsGPSConnectionRegistry();

QgsGPSConnectionRegistry( const QgsGPSConnectionRegistry& rh ) = delete;
QgsGPSConnectionRegistry& operator=( const QgsGPSConnectionRegistry& rh ) = delete;

//! Inserts a connection into the registry. The connection is owned by the registry class until it is unregistered again
void registerConnection( QgsGPSConnection* c );
//! Unregisters connection. The registry does no longer own the connection
void unregisterConnection( QgsGPSConnection* c );

QList< QgsGPSConnection *> connectionList() const;


private:

QgsGPSConnectionRegistry( const QgsGPSConnectionRegistry& rh );
QgsGPSConnectionRegistry& operator=( const QgsGPSConnectionRegistry& rh );

QSet<QgsGPSConnection*> mConnections;
};

@@ -66,15 +66,15 @@ namespace pal
}
~LabelInfo() { delete [] char_info; }

LabelInfo( const LabelInfo& rh ) = delete;
LabelInfo& operator=( const LabelInfo& rh ) = delete;

double max_char_angle_inside;
double max_char_angle_outside;
double label_height;
int char_num;
CharacterInfo* char_info;
private:

LabelInfo( const LabelInfo& rh );
LabelInfo& operator=( const LabelInfo& rh );
};

class LabelPosition;
@@ -94,11 +94,11 @@ namespace pal
*/
Pal();

/**
* \brief delete an instance
*/
~Pal();

Pal( const Pal& other ) = delete;
Pal& operator=( const Pal& other ) = delete;

/**
* \brief add a new layer
*
@@ -324,11 +324,6 @@ namespace pal
*/
int getMaxIt();

private:

Pal( const Pal& other );
Pal& operator=( const Pal& other );

};

} // end namespace pal
@@ -49,11 +49,10 @@ namespace pal

public:

/**
* \brief delete stats
*/
~PalStat();

PalStat( const PalStat& other ) = delete;
PalStat& operator=( const PalStat& other ) = delete;

/**
* \brief the number of object in problem
@@ -96,8 +95,7 @@ namespace pal
int *layersNbLabelledObjects; // [nbLayers]

PalStat();
PalStat( const PalStat& other );
PalStat& operator=( const PalStat& other );

};

} // end namespace pal
@@ -58,6 +58,9 @@ namespace pal
PriorityQueue( int n, int maxId, bool min );
~PriorityQueue();

PriorityQueue( const PriorityQueue & ) = delete;
PriorityQueue &operator=( const PriorityQueue & ) = delete;

void print();

int getSize();
@@ -81,8 +84,6 @@ namespace pal

int getId( int key );
private:
PriorityQueue( const PriorityQueue & );
PriorityQueue &operator=( const PriorityQueue & );

int size;
int maxsize;
@@ -112,6 +112,9 @@ namespace pal

~Problem();

Problem( const Problem& other ) = delete;
Problem& operator=( const Problem& other ) = delete;

/** Adds a candidate label position to the problem.
* @param position label candidate position. Ownership is transferred to Problem.
* @note added in QGIS 2.12
@@ -178,9 +181,6 @@ namespace pal

private:

Problem( const Problem& other );
Problem& operator=( const Problem& other );

/**
* How many layers are labelled ?
*/
@@ -78,6 +78,9 @@ class QgsConnectionPoolGroup
}
}

QgsConnectionPoolGroup( const QgsConnectionPoolGroup& other ) = delete;
QgsConnectionPoolGroup& operator=( const QgsConnectionPoolGroup& other ) = delete;

T acquire()
{
// we are going to acquire a resource - if no resource is available, we will block here
@@ -214,11 +217,6 @@ class QgsConnectionPoolGroup
QSemaphore sem;
QTimer* expirationTimer;

private:

QgsConnectionPoolGroup( const QgsConnectionPoolGroup& other );
QgsConnectionPoolGroup& operator=( const QgsConnectionPoolGroup& other );

};


@@ -32,6 +32,9 @@ class CORE_EXPORT QgsCoordinateTransformCache
public:
static QgsCoordinateTransformCache* instance();

QgsCoordinateTransformCache( const QgsCoordinateTransformCache& rh ) = delete;
QgsCoordinateTransformCache& operator=( const QgsCoordinateTransformCache& rh ) = delete;

/** Returns coordinate transformation. Cache keeps ownership
@param srcAuthId auth id string of source crs
@param destAuthId auth id string of dest crs
@@ -48,8 +51,7 @@ class CORE_EXPORT QgsCoordinateTransformCache
QMultiHash< QPair< QString, QString >, QgsCoordinateTransform > mTransforms; //same auth_id pairs might have different datum transformations

QgsCoordinateTransformCache();
QgsCoordinateTransformCache( const QgsCoordinateTransformCache& rh );
QgsCoordinateTransformCache& operator=( const QgsCoordinateTransformCache& rh );

};

#endif // QGSCRSCACHE_H
@@ -37,6 +37,9 @@ class CORE_EXPORT QgsDataItemProviderRegistry

~QgsDataItemProviderRegistry();

QgsDataItemProviderRegistry( const QgsDataItemProviderRegistry& rh ) = delete;
QgsDataItemProviderRegistry& operator=( const QgsDataItemProviderRegistry& rh ) = delete;

//! Get list of available providers
QList<QgsDataItemProvider*> providers() const { return mProviders; }

@@ -51,8 +54,6 @@ class CORE_EXPORT QgsDataItemProviderRegistry
//! available providers. this class owns the pointers
QList<QgsDataItemProvider*> mProviders;

QgsDataItemProviderRegistry( const QgsDataItemProviderRegistry& rh );
QgsDataItemProviderRegistry& operator=( const QgsDataItemProviderRegistry& rh );
};

#endif // QGSDATAITEMPROVIDERREGISTRY_H
@@ -1187,13 +1187,13 @@ class CORE_EXPORT QgsExpression
{}
~WhenThen() { delete mWhenExp; delete mThenExp; }

WhenThen( const WhenThen& rh ) = delete;
WhenThen& operator=( const WhenThen& rh ) = delete;

// protected:
Node* mWhenExp;
Node* mThenExp;

private:
WhenThen( const WhenThen& rh );
WhenThen& operator=( const WhenThen& rh );
};
typedef QList<WhenThen*> WhenThenList;

0 comments on commit 6579c4c

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