Skip to content
Permalink
Browse files

Optimise destructors (pt 1)

- Remove some non-base class empty destructors. These add no value
and it's better to let the compiler auto generate optimised versions
- use virtual ~Class = default instead of virtual ~Class {}
  • Loading branch information
nyalldawson committed Dec 30, 2016
1 parent 9021bb4 commit 850171cbb51654adf03a43d275b8c29c80cabf7f
Showing with 50 additions and 313 deletions.
  1. +1 −6 src/analysis/interpolation/HalfEdge.h
  2. +0 −6 src/analysis/interpolation/Point3D.h
  3. +1 −1 src/analysis/interpolation/TriangleInterpolator.h
  4. +0 −6 src/analysis/interpolation/Vector3D.h
  5. +0 −5 src/analysis/interpolation/qgsidwinterpolator.cpp
  6. +0 −1 src/analysis/interpolation/qgsidwinterpolator.h
  7. +1 −1 src/analysis/network/qgsnetworkstrategy.h
  8. +1 −1 src/analysis/raster/qgsalignraster.h
  9. +0 −5 src/analysis/raster/qgsaspectfilter.cpp
  10. +0 −1 src/analysis/raster/qgsaspectfilter.h
  11. +0 −4 src/analysis/raster/qgshillshadefilter.cpp
  12. +0 −1 src/analysis/raster/qgshillshadefilter.h
  13. +1 −1 src/analysis/vector/qgsgeometrysnapper.h
  14. +0 −2 src/app/dwg/libdxfrw/drw_entities.h
  15. +1 −1 src/app/dwg/libdxfrw/intern/drw_dbg.cpp
  16. +1 −1 src/app/dwg/libdxfrw/intern/drw_textcodec.h
  17. +1 −3 src/app/dwg/libdxfrw/intern/dwgbuffer.h
  18. +2 −2 src/app/dwg/libdxfrw/intern/dwgreader.h
  19. +0 −1 src/app/dwg/libdxfrw/intern/dwgreader15.h
  20. +0 −1 src/app/dwg/libdxfrw/intern/dwgreader24.h
  21. +0 −1 src/app/dwg/libdxfrw/intern/dwgreader27.h
  22. +1 −4 src/app/dwg/libdxfrw/intern/dwgutil.h
  23. +1 −3 src/app/dwg/libdxfrw/intern/dxfreader.h
  24. +1 −3 src/app/dwg/libdxfrw/intern/dxfwriter.h
  25. +0 −2 src/app/qgsattributeactiondialog.h
  26. +0 −3 src/app/qgsdecorationcopyright.cpp
  27. +0 −2 src/app/qgsdecorationcopyright.h
  28. +0 −2 src/core/auth/qgsauthconfig.h
  29. +0 −2 src/core/auth/qgsauthmethod.h
  30. +1 −1 src/core/effects/qgspainteffectregistry.h
  31. +0 −4 src/core/geometry/qgsabstractgeometry.cpp
  32. +1 −1 src/core/geometry/qgsabstractgeometry.h
  33. +0 −5 src/core/geometry/qgscircularstring.cpp
  34. +0 −1 src/core/geometry/qgscircularstring.h
  35. +0 −3 src/core/geometry/qgscurve.cpp
  36. +0 −1 src/core/geometry/qgscurve.h
  37. +1 −1 src/core/geometry/qgsgeometryengine.h
  38. +0 −3 src/core/geometry/qgslinestring.cpp
  39. +0 −1 src/core/geometry/qgslinestring.h
  40. +0 −2 src/core/pal/rtree.hpp
  41. +1 −7 src/core/qgsattributeeditorelement.h
  42. +1 −1 src/core/qgscolorramp.h
  43. +0 −3 src/core/qgscrscache.cpp
  44. +0 −2 src/core/qgscrscache.h
  45. +1 −1 src/core/qgsdataitemprovider.h
  46. +0 −6 src/core/qgsdataprovider.h
  47. +2 −4 src/core/qgsexpression.h
  48. +0 −2 src/core/qgsexpressioncontext.h
  49. +1 −1 src/core/qgsexpressioncontextgenerator.h
  50. +1 −2 src/core/qgsfeaturefilterprovider.h
  51. +0 −2 src/core/qgsfeedback.h
  52. +0 −4 src/core/qgsfield.cpp
  53. +1 −2 src/core/qgsfield.h
  54. +0 −5 src/core/qgsfields.cpp
  55. +1 −1 src/core/qgsfields.h
  56. +1 −1 src/core/qgslabelingengine.h
  57. +1 −1 src/core/qgsmaplayerrenderer.h
  58. +0 −2 src/core/qgsmaprendererjob.h
  59. +0 −1 src/core/qgsnetworkaccessmanager.cpp
  60. +0 −3 src/core/qgspointlocator.cpp
  61. +1 −1 src/core/qgspointlocator.h
  62. +0 −1 src/core/qgsprojectfiletransform.h
  63. +1 −1 src/core/qgsprojectversion.h
  64. +0 −3 src/core/qgsrenderchecker.h
  65. +2 −2 src/core/qgssqlstatement.h
  66. +0 −8 src/core/qgstextrenderer_p.h
  67. +1 −1 src/core/qgsvectorfilewriter.h
  68. +0 −5 src/core/qgsvectorlayertools.cpp
  69. +0 −2 src/core/qgsvectorlayertools.h
  70. +1 −1 src/core/raster/qgscontrastenhancementfunction.h
  71. +0 −3 src/core/raster/qgsrasterchecker.h
  72. +0 −4 src/core/raster/qgsrasterdataprovider.h
  73. +1 −1 src/core/raster/qgsrasterresampler.h
  74. +1 −1 src/core/raster/qgsrastershaderfunction.h
  75. +0 −2 src/core/symbology-ng/qgscategorizedsymbolrenderer.h
  76. +0 −1 src/core/symbology-ng/qgscptcityarchive.h
  77. +0 −2 src/core/symbology-ng/qgsgraduatedsymbolrenderer.h
  78. +1 −1 src/core/symbology-ng/qgsrendererregistry.h
  79. +1 −1 src/core/symbology-ng/qgssymbollayerregistry.h
  80. +0 −2 src/gui/attributetable/qgsfeaturelistview.h
  81. +1 −1 src/gui/attributetable/qgsfeaturemodel.h
  82. +1 −1 src/gui/auth/qgsauthmethodedit.h
  83. +0 −2 src/gui/editorwidgets/core/qgseditorconfigwidget.h
  84. +0 −1 src/gui/effects/qgspainteffectwidget.h
  85. +1 −1 src/gui/layertree/qgslayertreeembeddedwidgetregistry.h
  86. +1 −1 src/gui/layertree/qgslayertreeview.h
  87. +0 −2 src/gui/qgscollapsiblegroupbox.h
  88. +0 −3 src/gui/qgsfiledropedit.cpp
  89. +0 −1 src/gui/qgsfiledropedit.h
  90. +0 −2 src/gui/qgsgradientcolorrampdialog.h
  91. +0 −2 src/gui/raster/qgsrasterrendererwidget.h
  92. +0 −2 src/gui/symbology-ng/qgsgraduatedhistogramwidget.h
  93. +0 −3 src/gui/symbology-ng/qgsrendererwidget.h
  94. +0 −1 src/gui/symbology-ng/qgssymbollayerwidget.h
  95. +0 −1 src/plugins/geometry_checker/checks/qgsgeometrycheck.h
  96. +1 −1 src/plugins/geometry_checker/qgsgeometrycheckfactory.h
  97. +0 −2 src/plugins/georeferencer/qgsgeoreftransform.cpp
  98. +0 −1 src/plugins/grass/qgsgrassmoduleinput.h
  99. +1 −1 src/plugins/topology/topolError.h
  100. +0 −1 src/providers/arcgisrest/qgsafsprovider.h
  101. +0 −5 src/providers/gdal/qgsgdaldataitems.cpp
  102. +0 −1 src/providers/gdal/qgsgdaldataitems.h
  103. +1 −1 src/providers/gdal/qgsgdalprovider.h
  104. +1 −1 src/providers/gpx/gpsdata.h
  105. +0 −1 src/providers/grass/qgsgrassdatafile.h
  106. +0 −8 src/providers/grass/qgsgrassimport.cpp
  107. +0 −3 src/providers/grass/qgsgrassimport.h
  108. +0 −4 src/providers/grass/qgsgrassoptions.cpp
  109. +0 −1 src/providers/grass/qgsgrassoptions.h
  110. +1 −2 src/providers/grass/qgsgrassundocommand.h
  111. +0 −4 src/providers/grass/qgsgrassvector.cpp
  112. +0 −2 src/providers/grass/qgsgrassvector.h
  113. +0 −4 src/providers/grass/qgsgrassvectormap.cpp
  114. +0 −1 src/providers/grass/qgsgrassvectormap.h
  115. +0 −12 src/providers/mssql/qgsmssqldataitems.cpp
  116. +0 −3 src/providers/mssql/qgsmssqldataitems.h
  117. +0 −4 src/providers/mssql/qgsmssqlfeatureiterator.cpp
  118. +0 −1 src/providers/mssql/qgsmssqlfeatureiterator.h
  119. +0 −4 src/providers/mssql/qgsmssqltablemodel.cpp
  120. +0 −1 src/providers/mssql/qgsmssqltablemodel.h
  121. +1 −1 src/providers/postgres/qgspostgresprovider.h
  122. +0 −8 src/providers/spatialite/qgsspatialitedataitems.cpp
  123. +0 −2 src/providers/spatialite/qgsspatialitedataitems.h
  124. +0 −4 src/providers/spatialite/qgsspatialitefeatureiterator.cpp
  125. +0 −1 src/providers/spatialite/qgsspatialitefeatureiterator.h
  126. +0 −5 src/providers/spatialite/qgsspatialitetablemodel.cpp
  127. +0 −1 src/providers/spatialite/qgsspatialitetablemodel.h
  128. +1 −1 src/providers/virtual/qgsvirtuallayerprovider.h
  129. +1 −1 src/providers/wms/qgswmsprovider.h
  130. +1 −1 src/server/qgsowsserver.h
  131. +0 −2 tests/src/core/testqgscolorscheme.cpp
  132. +0 −2 tests/src/core/testqgscolorschemeregistry.cpp
  133. +0 −1 tests/src/core/testqgspainteffect.cpp
  134. +0 −1 tests/src/core/testqgspainteffectregistry.cpp
@@ -38,7 +38,7 @@ class ANALYSIS_EXPORT HalfEdge
//! Default constructor. Values for mDual, mNext, mPoint are set to -10 which means that they are undefined
HalfEdge();
HalfEdge( int dual, int next, int point, bool mbreak, bool forced );
~HalfEdge();

//! Returns the number of the dual HalfEdge
int getDual() const;
//! Returns the number of the next HalfEdge
@@ -71,11 +71,6 @@ inline HalfEdge::HalfEdge( int dual, int next, int point, bool mbreak, bool forc

}

inline HalfEdge::~HalfEdge()
{

}

inline int HalfEdge::getDual() const
{
return mDual;
@@ -35,7 +35,6 @@ class ANALYSIS_EXPORT Point3D
//! Constructor with the x-, y- and z-coordinate as arguments
Point3D( double x, double y, double z );
Point3D( const Point3D& p );
~Point3D();
Point3D& operator=( const Point3D& p );
bool operator==( const Point3D& p ) const;
bool operator!=( const Point3D& p ) const;
@@ -76,11 +75,6 @@ inline Point3D::Point3D( const Point3D& p ): mX( p.mX ), mY( p.mY ), mZ( p.mZ )

}

inline Point3D::~Point3D()
{

}

inline double Point3D::getX() const
{
return mX;
@@ -25,7 +25,7 @@
class ANALYSIS_EXPORT TriangleInterpolator
{
public:
virtual ~TriangleInterpolator() {}
virtual ~TriangleInterpolator() = default;
//! Calculates the normal vector and assigns it to vec
virtual bool calcNormVec( double x, double y, Vector3D* result ) = 0;
//! Performs a linear interpolation in a triangle and assigns the x-,y- and z-coordinates to point
@@ -43,7 +43,6 @@ class ANALYSIS_EXPORT Vector3D
//! Copy constructor
Vector3D( const Vector3D& v );

~Vector3D();
Vector3D& operator=( const Vector3D& v );
bool operator==( const Vector3D& v ) const;
bool operator!=( const Vector3D& v ) const;
@@ -83,11 +82,6 @@ inline Vector3D::Vector3D()

}

inline Vector3D::~Vector3D()
{

}

//-------------------------------------------setter and getters-------------------------------

inline double Vector3D::getX() const
@@ -29,11 +29,6 @@ QgsIDWInterpolator::QgsIDWInterpolator(): QgsInterpolator( QList<LayerData>() ),

}

QgsIDWInterpolator::~QgsIDWInterpolator()
{

}

int QgsIDWInterpolator::interpolatePoint( double x, double y, double& result )
{
if ( !mDataIsCached )
@@ -27,7 +27,6 @@ class ANALYSIS_EXPORT QgsIDWInterpolator: public QgsInterpolator
{
public:
QgsIDWInterpolator( const QList<LayerData>& layerData );
~QgsIDWInterpolator();

/** Calculates interpolation value for map coordinates x, y
@param x x-coordinate (in map units)
@@ -39,7 +39,7 @@ class ANALYSIS_EXPORT QgsNetworkStrategy
*/
QgsNetworkStrategy() {}

virtual ~QgsNetworkStrategy() {}
virtual ~QgsNetworkStrategy() = default;

/**
* Returns list of the source layer attributes needed for cost calculation.
@@ -147,7 +147,7 @@ class ANALYSIS_EXPORT QgsAlignRaster
//! @return false if the execution should be cancelled, true otherwise
virtual bool progress( double complete ) = 0;

virtual ~ProgressHandler() {}
virtual ~ProgressHandler() = default;
};

//! Assign a progress handler instance. Does not take ownership. nullptr can be passed.
@@ -23,11 +23,6 @@ QgsAspectFilter::QgsAspectFilter( const QString& inputFile, const QString& outpu

}

QgsAspectFilter::~QgsAspectFilter()
{

}

float QgsAspectFilter::processNineCellWindow(
float* x11, float* x21, float* x31,
float* x12, float* x22, float* x32,
@@ -26,7 +26,6 @@ class ANALYSIS_EXPORT QgsAspectFilter: public QgsDerivativeFilter
{
public:
QgsAspectFilter( const QString& inputFile, const QString& outputFile, const QString& outputFormat );
~QgsAspectFilter();

/** Calculates output value from nine input values. The input values and the output value can be equal to the
nodata value if not present or outside of the border. Must be implemented by subclasses*/
@@ -25,10 +25,6 @@ QgsHillshadeFilter::QgsHillshadeFilter( const QString& inputFile, const QString&
{
}

QgsHillshadeFilter::~QgsHillshadeFilter()
{
}

float QgsHillshadeFilter::processNineCellWindow( float* x11, float* x21, float* x31,
float* x12, float* x22, float* x32,
float* x13, float* x23, float* x33 )
@@ -28,7 +28,6 @@ class ANALYSIS_EXPORT QgsHillshadeFilter: public QgsDerivativeFilter
public:
QgsHillshadeFilter( const QString& inputFile, const QString& outputFile, const QString& outputFormat, double lightAzimuth = 300,
double lightAngle = 40 );
~QgsHillshadeFilter();

/** Calculates output value from nine input values. The input values and the output value can be equal to the
nodata value if not present or outside of the border. Must be implemented by subclasses*/
@@ -122,7 +122,7 @@ class QgsSnapIndex
class SnapItem
{
public:
virtual ~SnapItem() {}
virtual ~SnapItem() = default;
SnapType type;
virtual QgsPointV2 getSnapPoint( const QgsPointV2& p ) const = 0;

@@ -1237,8 +1237,6 @@ class DRW_Dimension : public DRW_Entity
{
}

virtual ~DRW_Dimension() {}

virtual void applyExtrusion() {}

protected:
@@ -33,7 +33,7 @@ class print_none
virtual void printHL( int c, int s, int h ) {( void )c;( void )s;( void )h;}
virtual void printPT( double x, double y, double z ) {( void )x;( void )y;( void )z;}
print_none() {}
virtual ~print_none() {}
virtual ~print_none() = default;
};

class print_debug : public print_none
@@ -36,7 +36,7 @@ class DRW_Converter
table = t;
cpLenght = l;
}
virtual ~DRW_Converter() {}
virtual ~DRW_Converter() = default;
virtual std::string fromUtf8( std::string *s ) {return *s;}
virtual std::string toUtf8( std::string *s );
std::string encodeText( std::string stmp );
@@ -25,7 +25,7 @@ class dwgBasicStream
protected:
dwgBasicStream() {}
public:
virtual ~dwgBasicStream() {}
virtual ~dwgBasicStream() = default;
virtual bool read( duint8* s, duint64 n ) = 0;
virtual duint64 size() = 0;
virtual duint64 getPos() = 0;
@@ -44,7 +44,6 @@ class dwgFileStream: public dwgBasicStream
sz = stream->tellg();
stream->seekg( 0, std::ios_base::beg );
}
virtual ~dwgFileStream() {}
virtual bool read( duint8* s, duint64 n );
virtual duint64 size() {return sz;}
virtual duint64 getPos() {return stream->tellg();}
@@ -66,7 +65,6 @@ class dwgCharStream: public dwgBasicStream
pos = 0;
isOk = true;
}
virtual ~dwgCharStream() {}
virtual bool read( duint8* s, duint64 n );
virtual duint64 size() {return sz;}
virtual duint64 getPos() {return pos;}
@@ -69,7 +69,7 @@ class dwgPageInfo
, uSize( 0 )
{
}
~dwgPageInfo() {}

duint64 Id;
duint64 address; //in file stream, for rd18, rd21
duint64 size; //in file stream, for rd18, rd21
@@ -101,7 +101,7 @@ class dwgSectionInfo
, address( 0 )
{
}
~dwgSectionInfo() {}

dint32 Id; //section Id, 2000- rd15 rd18
std::string name; //section name rd18
duint32 compressed;//is compressed? 1=no, 2=yes rd18, rd21(encoding)
@@ -23,7 +23,6 @@ class dwgReader15 : public dwgReader
{
public:
dwgReader15( std::ifstream *stream, dwgR *p ): dwgReader( stream, p ) { }
virtual ~dwgReader15() {}
bool readMetaData();
bool readFileHeader();
bool readDwgHeader( DRW_Header& hdr );
@@ -23,7 +23,6 @@ class dwgReader24 : public dwgReader18
{
public:
dwgReader24( std::ifstream *stream, dwgR *p ): dwgReader18( stream, p ) { }
virtual ~dwgReader24() {}
bool readFileHeader();
bool readDwgHeader( DRW_Header& hdr );
bool readDwgClasses();
@@ -23,7 +23,6 @@ class dwgReader27 : public dwgReader18
{
public:
dwgReader27( std::ifstream *stream, dwgR *p ): dwgReader18( stream, p ) { }
virtual ~dwgReader27() {}
bool readFileHeader();
bool readDwgHeader( DRW_Header& hdr );
bool readDwgClasses();
@@ -24,7 +24,7 @@ class dwgRSCodec
{
public:
dwgRSCodec() {}
~dwgRSCodec() {}

static void decode239I( duint8 *in, duint8 *out, duint32 blk );
static void decode251I( duint8 *in, duint8 *out, duint32 blk );
};
@@ -41,8 +41,6 @@ class dwgCompressor
, rpos( 0 )
{}

~dwgCompressor() {}

void decompress18( duint8 *cbuf, duint8 *dbuf, duint32 csize, duint32 dsize );
static void decrypt18Hdr( duint8 *buf, duint32 size, duint32 offset );
// static void decrypt18Data(duint8 *buf, duint32 size, duint32 offset);
@@ -96,7 +94,6 @@ class secEnum
};

secEnum() {}
~secEnum() {}

static DWGSection getEnum( std::string nameSec );
};
@@ -38,7 +38,7 @@ class dxfReader
filestr = stream;
type = INVALID;
}
virtual ~dxfReader() {}
virtual ~dxfReader() = default;
bool readRec( int *code );

std::string getString() {return strData;}
@@ -81,7 +81,6 @@ class dxfReaderBinary : public dxfReader
explicit dxfReaderBinary( std::ifstream *stream )
: dxfReader( stream, false )
{}
virtual ~dxfReaderBinary() {}
virtual bool readCode( int *code );
virtual bool readString( std::string *text );
virtual bool readString();
@@ -98,7 +97,6 @@ class dxfReaderAscii : public dxfReader
explicit dxfReaderAscii( std::ifstream *stream )
: dxfReader( stream, true )
{}
virtual ~dxfReaderAscii() {}
virtual bool readCode( int *code );
virtual bool readString( std::string *text );
virtual bool readString();
@@ -22,7 +22,7 @@ class dxfWriter
: filestr( stream )
// , count( 0 )
{}
virtual ~dxfWriter() {}
virtual ~dxfWriter() = default;
virtual bool writeString( int code, std::string text ) = 0;
bool writeUtf8String( int code, std::string text );
bool writeUtf8Caps( int code, std::string text );
@@ -47,7 +47,6 @@ class dxfWriterBinary : public dxfWriter
explicit dxfWriterBinary( std::ofstream *stream )
: dxfWriter( stream )
{}
virtual ~dxfWriterBinary() {}
virtual bool writeString( int code, std::string text );
virtual bool writeInt16( int code, int data );
virtual bool writeInt32( int code, int data );
@@ -60,7 +59,6 @@ class dxfWriterAscii : public dxfWriter
{
public:
explicit dxfWriterAscii( std::ofstream *stream );
virtual ~dxfWriterAscii() {}
virtual bool writeString( int code, std::string text );
virtual bool writeInt16( int code, int data );
virtual bool writeInt32( int code, int data );
@@ -49,8 +49,6 @@ class APP_EXPORT QgsAttributeActionDialog: public QWidget, private Ui::QgsAttrib
QgsAttributeActionDialog( const QgsActionManager& actions,
QWidget* parent = nullptr );

~QgsAttributeActionDialog() {}

void init( const QgsActionManager& action , const QgsAttributeTableConfig& attributeTableConfig );

QList<QgsAction> actions() const;
@@ -54,9 +54,6 @@ QgsDecorationCopyright::QgsDecorationCopyright( QObject* parent )
projectRead();
}

QgsDecorationCopyright::~QgsDecorationCopyright()
{}

void QgsDecorationCopyright::projectRead()
{
QgsDecorationItem::projectRead();
@@ -37,8 +37,6 @@ class APP_EXPORT QgsDecorationCopyright : public QgsDecorationItem
//! Constructor
QgsDecorationCopyright( QObject* parent = nullptr );

virtual ~QgsDecorationCopyright();

public slots:
//! set values on the gui when a project is read or the gui first loaded
void projectRead() override;
@@ -299,8 +299,6 @@ class CORE_EXPORT QgsAuthConfigSslServer
//! Construct a default SSL server configuration
QgsAuthConfigSslServer();

~QgsAuthConfigSslServer() {}

//! Server certificate object
const QSslCertificate sslCertificate() const { return mSslCert; }
//! Set server certificate object
@@ -53,8 +53,6 @@ class CORE_EXPORT QgsAuthMethod : public QObject
};
Q_DECLARE_FLAGS( Expansions, Expansion )

virtual ~QgsAuthMethod() {}

//! A non-translated short name representing the auth method
virtual QString key() const = 0;

@@ -43,7 +43,7 @@ class CORE_EXPORT QgsPaintEffectAbstractMetadata
*/
QgsPaintEffectAbstractMetadata( const QString& name, const QString& visibleName );

virtual ~QgsPaintEffectAbstractMetadata() {}
virtual ~QgsPaintEffectAbstractMetadata() = default;

/** Returns the unique string representing the paint effect class
* @returns unique string
@@ -27,10 +27,6 @@ QgsAbstractGeometry::QgsAbstractGeometry(): mWkbType( QgsWkbTypes::Unknown )
{
}

QgsAbstractGeometry::~QgsAbstractGeometry()
{
}

QgsAbstractGeometry::QgsAbstractGeometry( const QgsAbstractGeometry& geom )
{
mWkbType = geom.mWkbType;

0 comments on commit 850171c

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