Skip to content

Commit

Permalink
Fix classes which violate the rule-of-three
Browse files Browse the repository at this point in the history
(identified using clazy analyser)
  • Loading branch information
nyalldawson committed Oct 24, 2016
1 parent 12a7bb3 commit 3272964
Show file tree
Hide file tree
Showing 18 changed files with 64 additions and 9 deletions.
1 change: 1 addition & 0 deletions python/core/raster/qgsrasterprojector.sip
Expand Up @@ -58,4 +58,5 @@ class QgsRasterProjector : QgsRasterInterface
static bool extentSize( const QgsCoordinateTransform& ct,
const QgsRectangle& theSrcExtent, int theSrcXSize, int theSrcYSize,
QgsRectangle& theDestExtent, int& theDestXSize, int& theDestYSize );

};
4 changes: 4 additions & 0 deletions python/gui/layertree/qgslayertreeembeddedwidgetregistry.sip
Expand Up @@ -69,4 +69,8 @@ class QgsLayerTreeEmbeddedWidgetRegistry
protected:
//! Protected constructor - use instance() to access the registry.
QgsLayerTreeEmbeddedWidgetRegistry();

private:

QgsLayerTreeEmbeddedWidgetRegistry( const QgsLayerTreeEmbeddedWidgetRegistry& other );
};
8 changes: 4 additions & 4 deletions src/analysis/openstreetmap/qgsosmdatabase.h
Expand Up @@ -129,7 +129,7 @@ class ANALYSIS_EXPORT QgsOSMDatabase
* Encapsulate iteration over table of nodes/
* @note not available in Python bindings
*/
class ANALYSIS_EXPORT QgsOSMNodeIterator
class ANALYSIS_EXPORT QgsOSMNodeIterator // clazy:exclude=rule-of-three
{
public:
~QgsOSMNodeIterator();
Expand All @@ -145,6 +145,7 @@ class ANALYSIS_EXPORT QgsOSMNodeIterator
sqlite3_stmt* mStmt;

friend class QgsOSMDatabase;

};


Expand All @@ -153,7 +154,7 @@ class ANALYSIS_EXPORT QgsOSMNodeIterator
* Encapsulate iteration over table of ways
* @note not available in Python bindings
*/
class ANALYSIS_EXPORT QgsOSMWayIterator
class ANALYSIS_EXPORT QgsOSMWayIterator // clazy:exclude=rule-of-three
{
public:
~QgsOSMWayIterator();
Expand All @@ -168,9 +169,8 @@ class ANALYSIS_EXPORT QgsOSMWayIterator

sqlite3_stmt* mStmt;

private:

friend class QgsOSMDatabase;

};


Expand Down
6 changes: 6 additions & 0 deletions src/core/pal/pal.h
Expand Up @@ -322,6 +322,12 @@ namespace pal
* @return maximum # of iteration
*/
int getMaxIt();

private:

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

};

} // end namespace pal
Expand Down
2 changes: 2 additions & 0 deletions src/core/pal/palstat.h
Expand Up @@ -96,6 +96,8 @@ namespace pal
int *layersNbLabelledObjects; // [nbLayers]

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

} // end namespace pal
Expand Down
3 changes: 3 additions & 0 deletions src/core/pal/problem.h
Expand Up @@ -175,6 +175,9 @@ namespace pal

private:

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

/**
* How many layers are labelled ?
*/
Expand Down
5 changes: 5 additions & 0 deletions src/core/pal/rtree.hpp
Expand Up @@ -444,6 +444,11 @@ namespace pal
ASSERT( m_file );
return fread( static_cast< void* >( a_array ), sizeof( TYPE ) * a_count, 1, m_file );
}

private:

RTFileStream( const RTFileStream& other );
RTFileStream& operator=( const RTFileStream& other );
};


Expand Down
2 changes: 1 addition & 1 deletion src/core/qgis.h
Expand Up @@ -135,7 +135,7 @@ class CORE_EXPORT Qgis
* @note not available in Python bindings
*/
// based on Boojum's code from http://stackoverflow.com/questions/3556687/prevent-firing-signals-in-qt
template<class Object> class QgsSignalBlocker
template<class Object> class QgsSignalBlocker // clazy:exclude=rule-of-three
{
public:

Expand Down
6 changes: 6 additions & 0 deletions src/core/qgsconnectionpool.h
Expand Up @@ -213,6 +213,12 @@ class QgsConnectionPoolGroup
QMutex connMutex;
QSemaphore sem;
QTimer* expirationTimer;

private:

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

};


Expand Down
3 changes: 3 additions & 0 deletions src/core/qgsgml.h
Expand Up @@ -131,6 +131,9 @@ class CORE_EXPORT QgsGmlStreamingParser

private:

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

enum ParseMode
{
none,
Expand Down
2 changes: 1 addition & 1 deletion src/core/qgslogger.h
Expand Up @@ -112,7 +112,7 @@ class CORE_EXPORT QgsLogger

/** \ingroup core
*/
class QgsScopeLogger
class QgsScopeLogger // clazy:exclude=rule-of-three
{
public:
QgsScopeLogger( const char* file, const char* func, int line )
Expand Down
3 changes: 3 additions & 0 deletions src/core/raster/qgsrasterprojector.h
Expand Up @@ -134,6 +134,9 @@ class ProjectorData
int srcCols() const { return mSrcCols; }

private:
ProjectorData( const ProjectorData& other );
ProjectorData& operator=( const ProjectorData& other );

/** \brief get destination point for _current_ destination position */
void destPointOnCPMatrix( int theRow, int theCol, double *theX, double *theY );

Expand Down
6 changes: 6 additions & 0 deletions src/core/simplify/effectivearea.h
Expand Up @@ -90,6 +90,12 @@ struct EFFECTIVE_AREAS
QgsPointSequence inpts;
areanode *initial_arealist;
double *res_arealist;

private:

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

};

void ptarray_calc_areas( EFFECTIVE_AREAS *ea, int avoid_collaps, int set_area, double trshld );
Expand Down
5 changes: 5 additions & 0 deletions src/gui/layertree/qgslayertreeembeddedwidgetregistry.h
Expand Up @@ -87,6 +87,11 @@ class GUI_EXPORT QgsLayerTreeEmbeddedWidgetRegistry

//! storage of all the providers
QMap<QString, QgsLayerTreeEmbeddedWidgetProvider*> mProviders;

private:

QgsLayerTreeEmbeddedWidgetRegistry( const QgsLayerTreeEmbeddedWidgetRegistry& other );
QgsLayerTreeEmbeddedWidgetRegistry& operator=( const QgsLayerTreeEmbeddedWidgetRegistry& other );
};


Expand Down
2 changes: 1 addition & 1 deletion src/gui/symbology-ng/qgssymbolwidgetcontext.h
Expand Up @@ -27,7 +27,7 @@ class QgsMapCanvas;
*
* \note added in QGIS 3.0
*/
class GUI_EXPORT QgsSymbolWidgetContext
class GUI_EXPORT QgsSymbolWidgetContext // clazy:exclude=rule-of-three
{
public:

Expand Down
9 changes: 7 additions & 2 deletions src/providers/ogr/qgsogrprovider.cpp
Expand Up @@ -83,6 +83,11 @@ class QgsCPLErrorHandler
{
CPLPopErrorHandler();
}
private:
QgsCPLErrorHandler( const QgsCPLErrorHandler& other );
QgsCPLErrorHandler& operator=( const QgsCPLErrorHandler& other );
};
Expand Down Expand Up @@ -1974,7 +1979,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;
Expand Down Expand Up @@ -2904,7 +2909,7 @@ QVariant QgsOgrProvider::maximumValue( int index ) const
return value;
}

QByteArray QgsOgrProvider::quotedIdentifier( QByteArray field ) const
QByteArray QgsOgrProvider::quotedIdentifier( const QByteArray& field ) const
{
return QgsOgrProviderUtils::quotedIdentifier( field, ogrDriverName );
}
Expand Down
2 changes: 2 additions & 0 deletions src/providers/spatialite/qgsspatialiteprovider.h
Expand Up @@ -244,6 +244,8 @@ class QgsSpatiaLiteProvider: public QgsVectorDataProvider

private:
char *errMsg;

SLException& operator=( const SLException& other );
};

/**
Expand Down
4 changes: 4 additions & 0 deletions src/providers/virtual/qgsvirtuallayersqlitemodule.cpp
Expand Up @@ -163,6 +163,10 @@ struct VTable
QgsFields fields() const { return mFields; }

private:

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

// connection
sqlite3* mSql;

Expand Down

0 comments on commit 3272964

Please sign in to comment.