Skip to content

Commit 850171c

Browse files
committed
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 {}
1 parent 9021bb4 commit 850171c

File tree

134 files changed

+50
-313
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

134 files changed

+50
-313
lines changed

src/analysis/interpolation/HalfEdge.h

+1-6
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ class ANALYSIS_EXPORT HalfEdge
3838
//! Default constructor. Values for mDual, mNext, mPoint are set to -10 which means that they are undefined
3939
HalfEdge();
4040
HalfEdge( int dual, int next, int point, bool mbreak, bool forced );
41-
~HalfEdge();
41+
4242
//! Returns the number of the dual HalfEdge
4343
int getDual() const;
4444
//! Returns the number of the next HalfEdge
@@ -71,11 +71,6 @@ inline HalfEdge::HalfEdge( int dual, int next, int point, bool mbreak, bool forc
7171

7272
}
7373

74-
inline HalfEdge::~HalfEdge()
75-
{
76-
77-
}
78-
7974
inline int HalfEdge::getDual() const
8075
{
8176
return mDual;

src/analysis/interpolation/Point3D.h

-6
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,6 @@ class ANALYSIS_EXPORT Point3D
3535
//! Constructor with the x-, y- and z-coordinate as arguments
3636
Point3D( double x, double y, double z );
3737
Point3D( const Point3D& p );
38-
~Point3D();
3938
Point3D& operator=( const Point3D& p );
4039
bool operator==( const Point3D& p ) const;
4140
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 )
7675

7776
}
7877

79-
inline Point3D::~Point3D()
80-
{
81-
82-
}
83-
8478
inline double Point3D::getX() const
8579
{
8680
return mX;

src/analysis/interpolation/TriangleInterpolator.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
class ANALYSIS_EXPORT TriangleInterpolator
2626
{
2727
public:
28-
virtual ~TriangleInterpolator() {}
28+
virtual ~TriangleInterpolator() = default;
2929
//! Calculates the normal vector and assigns it to vec
3030
virtual bool calcNormVec( double x, double y, Vector3D* result ) = 0;
3131
//! Performs a linear interpolation in a triangle and assigns the x-,y- and z-coordinates to point

src/analysis/interpolation/Vector3D.h

-6
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,6 @@ class ANALYSIS_EXPORT Vector3D
4343
//! Copy constructor
4444
Vector3D( const Vector3D& v );
4545

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

8483
}
8584

86-
inline Vector3D::~Vector3D()
87-
{
88-
89-
}
90-
9185
//-------------------------------------------setter and getters-------------------------------
9286

9387
inline double Vector3D::getX() const

src/analysis/interpolation/qgsidwinterpolator.cpp

-5
Original file line numberDiff line numberDiff line change
@@ -29,11 +29,6 @@ QgsIDWInterpolator::QgsIDWInterpolator(): QgsInterpolator( QList<LayerData>() ),
2929

3030
}
3131

32-
QgsIDWInterpolator::~QgsIDWInterpolator()
33-
{
34-
35-
}
36-
3732
int QgsIDWInterpolator::interpolatePoint( double x, double y, double& result )
3833
{
3934
if ( !mDataIsCached )

src/analysis/interpolation/qgsidwinterpolator.h

-1
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@ class ANALYSIS_EXPORT QgsIDWInterpolator: public QgsInterpolator
2727
{
2828
public:
2929
QgsIDWInterpolator( const QList<LayerData>& layerData );
30-
~QgsIDWInterpolator();
3130

3231
/** Calculates interpolation value for map coordinates x, y
3332
@param x x-coordinate (in map units)

src/analysis/network/qgsnetworkstrategy.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ class ANALYSIS_EXPORT QgsNetworkStrategy
3939
*/
4040
QgsNetworkStrategy() {}
4141

42-
virtual ~QgsNetworkStrategy() {}
42+
virtual ~QgsNetworkStrategy() = default;
4343

4444
/**
4545
* Returns list of the source layer attributes needed for cost calculation.

src/analysis/raster/qgsalignraster.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,7 @@ class ANALYSIS_EXPORT QgsAlignRaster
147147
//! @return false if the execution should be cancelled, true otherwise
148148
virtual bool progress( double complete ) = 0;
149149

150-
virtual ~ProgressHandler() {}
150+
virtual ~ProgressHandler() = default;
151151
};
152152

153153
//! Assign a progress handler instance. Does not take ownership. nullptr can be passed.

src/analysis/raster/qgsaspectfilter.cpp

-5
Original file line numberDiff line numberDiff line change
@@ -23,11 +23,6 @@ QgsAspectFilter::QgsAspectFilter( const QString& inputFile, const QString& outpu
2323

2424
}
2525

26-
QgsAspectFilter::~QgsAspectFilter()
27-
{
28-
29-
}
30-
3126
float QgsAspectFilter::processNineCellWindow(
3227
float* x11, float* x21, float* x31,
3328
float* x12, float* x22, float* x32,

src/analysis/raster/qgsaspectfilter.h

-1
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@ class ANALYSIS_EXPORT QgsAspectFilter: public QgsDerivativeFilter
2626
{
2727
public:
2828
QgsAspectFilter( const QString& inputFile, const QString& outputFile, const QString& outputFormat );
29-
~QgsAspectFilter();
3029

3130
/** Calculates output value from nine input values. The input values and the output value can be equal to the
3231
nodata value if not present or outside of the border. Must be implemented by subclasses*/

src/analysis/raster/qgshillshadefilter.cpp

-4
Original file line numberDiff line numberDiff line change
@@ -25,10 +25,6 @@ QgsHillshadeFilter::QgsHillshadeFilter( const QString& inputFile, const QString&
2525
{
2626
}
2727

28-
QgsHillshadeFilter::~QgsHillshadeFilter()
29-
{
30-
}
31-
3228
float QgsHillshadeFilter::processNineCellWindow( float* x11, float* x21, float* x31,
3329
float* x12, float* x22, float* x32,
3430
float* x13, float* x23, float* x33 )

src/analysis/raster/qgshillshadefilter.h

-1
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@ class ANALYSIS_EXPORT QgsHillshadeFilter: public QgsDerivativeFilter
2828
public:
2929
QgsHillshadeFilter( const QString& inputFile, const QString& outputFile, const QString& outputFormat, double lightAzimuth = 300,
3030
double lightAngle = 40 );
31-
~QgsHillshadeFilter();
3231

3332
/** Calculates output value from nine input values. The input values and the output value can be equal to the
3433
nodata value if not present or outside of the border. Must be implemented by subclasses*/

src/analysis/vector/qgsgeometrysnapper.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ class QgsSnapIndex
122122
class SnapItem
123123
{
124124
public:
125-
virtual ~SnapItem() {}
125+
virtual ~SnapItem() = default;
126126
SnapType type;
127127
virtual QgsPointV2 getSnapPoint( const QgsPointV2& p ) const = 0;
128128

src/app/dwg/libdxfrw/drw_entities.h

-2
Original file line numberDiff line numberDiff line change
@@ -1237,8 +1237,6 @@ class DRW_Dimension : public DRW_Entity
12371237
{
12381238
}
12391239

1240-
virtual ~DRW_Dimension() {}
1241-
12421240
virtual void applyExtrusion() {}
12431241

12441242
protected:

src/app/dwg/libdxfrw/intern/drw_dbg.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ class print_none
3333
virtual void printHL( int c, int s, int h ) {( void )c;( void )s;( void )h;}
3434
virtual void printPT( double x, double y, double z ) {( void )x;( void )y;( void )z;}
3535
print_none() {}
36-
virtual ~print_none() {}
36+
virtual ~print_none() = default;
3737
};
3838

3939
class print_debug : public print_none

src/app/dwg/libdxfrw/intern/drw_textcodec.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ class DRW_Converter
3636
table = t;
3737
cpLenght = l;
3838
}
39-
virtual ~DRW_Converter() {}
39+
virtual ~DRW_Converter() = default;
4040
virtual std::string fromUtf8( std::string *s ) {return *s;}
4141
virtual std::string toUtf8( std::string *s );
4242
std::string encodeText( std::string stmp );

src/app/dwg/libdxfrw/intern/dwgbuffer.h

+1-3
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ class dwgBasicStream
2525
protected:
2626
dwgBasicStream() {}
2727
public:
28-
virtual ~dwgBasicStream() {}
28+
virtual ~dwgBasicStream() = default;
2929
virtual bool read( duint8* s, duint64 n ) = 0;
3030
virtual duint64 size() = 0;
3131
virtual duint64 getPos() = 0;
@@ -44,7 +44,6 @@ class dwgFileStream: public dwgBasicStream
4444
sz = stream->tellg();
4545
stream->seekg( 0, std::ios_base::beg );
4646
}
47-
virtual ~dwgFileStream() {}
4847
virtual bool read( duint8* s, duint64 n );
4948
virtual duint64 size() {return sz;}
5049
virtual duint64 getPos() {return stream->tellg();}
@@ -66,7 +65,6 @@ class dwgCharStream: public dwgBasicStream
6665
pos = 0;
6766
isOk = true;
6867
}
69-
virtual ~dwgCharStream() {}
7068
virtual bool read( duint8* s, duint64 n );
7169
virtual duint64 size() {return sz;}
7270
virtual duint64 getPos() {return pos;}

src/app/dwg/libdxfrw/intern/dwgreader.h

+2-2
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ class dwgPageInfo
6969
, uSize( 0 )
7070
{
7171
}
72-
~dwgPageInfo() {}
72+
7373
duint64 Id;
7474
duint64 address; //in file stream, for rd18, rd21
7575
duint64 size; //in file stream, for rd18, rd21
@@ -101,7 +101,7 @@ class dwgSectionInfo
101101
, address( 0 )
102102
{
103103
}
104-
~dwgSectionInfo() {}
104+
105105
dint32 Id; //section Id, 2000- rd15 rd18
106106
std::string name; //section name rd18
107107
duint32 compressed;//is compressed? 1=no, 2=yes rd18, rd21(encoding)

src/app/dwg/libdxfrw/intern/dwgreader15.h

-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@ class dwgReader15 : public dwgReader
2323
{
2424
public:
2525
dwgReader15( std::ifstream *stream, dwgR *p ): dwgReader( stream, p ) { }
26-
virtual ~dwgReader15() {}
2726
bool readMetaData();
2827
bool readFileHeader();
2928
bool readDwgHeader( DRW_Header& hdr );

src/app/dwg/libdxfrw/intern/dwgreader24.h

-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@ class dwgReader24 : public dwgReader18
2323
{
2424
public:
2525
dwgReader24( std::ifstream *stream, dwgR *p ): dwgReader18( stream, p ) { }
26-
virtual ~dwgReader24() {}
2726
bool readFileHeader();
2827
bool readDwgHeader( DRW_Header& hdr );
2928
bool readDwgClasses();

src/app/dwg/libdxfrw/intern/dwgreader27.h

-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@ class dwgReader27 : public dwgReader18
2323
{
2424
public:
2525
dwgReader27( std::ifstream *stream, dwgR *p ): dwgReader18( stream, p ) { }
26-
virtual ~dwgReader27() {}
2726
bool readFileHeader();
2827
bool readDwgHeader( DRW_Header& hdr );
2928
bool readDwgClasses();

src/app/dwg/libdxfrw/intern/dwgutil.h

+1-4
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ class dwgRSCodec
2424
{
2525
public:
2626
dwgRSCodec() {}
27-
~dwgRSCodec() {}
27+
2828
static void decode239I( duint8 *in, duint8 *out, duint32 blk );
2929
static void decode251I( duint8 *in, duint8 *out, duint32 blk );
3030
};
@@ -41,8 +41,6 @@ class dwgCompressor
4141
, rpos( 0 )
4242
{}
4343

44-
~dwgCompressor() {}
45-
4644
void decompress18( duint8 *cbuf, duint8 *dbuf, duint32 csize, duint32 dsize );
4745
static void decrypt18Hdr( duint8 *buf, duint32 size, duint32 offset );
4846
// static void decrypt18Data(duint8 *buf, duint32 size, duint32 offset);
@@ -96,7 +94,6 @@ class secEnum
9694
};
9795

9896
secEnum() {}
99-
~secEnum() {}
10097

10198
static DWGSection getEnum( std::string nameSec );
10299
};

src/app/dwg/libdxfrw/intern/dxfreader.h

+1-3
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ class dxfReader
3838
filestr = stream;
3939
type = INVALID;
4040
}
41-
virtual ~dxfReader() {}
41+
virtual ~dxfReader() = default;
4242
bool readRec( int *code );
4343

4444
std::string getString() {return strData;}
@@ -81,7 +81,6 @@ class dxfReaderBinary : public dxfReader
8181
explicit dxfReaderBinary( std::ifstream *stream )
8282
: dxfReader( stream, false )
8383
{}
84-
virtual ~dxfReaderBinary() {}
8584
virtual bool readCode( int *code );
8685
virtual bool readString( std::string *text );
8786
virtual bool readString();
@@ -98,7 +97,6 @@ class dxfReaderAscii : public dxfReader
9897
explicit dxfReaderAscii( std::ifstream *stream )
9998
: dxfReader( stream, true )
10099
{}
101-
virtual ~dxfReaderAscii() {}
102100
virtual bool readCode( int *code );
103101
virtual bool readString( std::string *text );
104102
virtual bool readString();

src/app/dwg/libdxfrw/intern/dxfwriter.h

+1-3
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ class dxfWriter
2222
: filestr( stream )
2323
// , count( 0 )
2424
{}
25-
virtual ~dxfWriter() {}
25+
virtual ~dxfWriter() = default;
2626
virtual bool writeString( int code, std::string text ) = 0;
2727
bool writeUtf8String( int code, std::string text );
2828
bool writeUtf8Caps( int code, std::string text );
@@ -47,7 +47,6 @@ class dxfWriterBinary : public dxfWriter
4747
explicit dxfWriterBinary( std::ofstream *stream )
4848
: dxfWriter( stream )
4949
{}
50-
virtual ~dxfWriterBinary() {}
5150
virtual bool writeString( int code, std::string text );
5251
virtual bool writeInt16( int code, int data );
5352
virtual bool writeInt32( int code, int data );
@@ -60,7 +59,6 @@ class dxfWriterAscii : public dxfWriter
6059
{
6160
public:
6261
explicit dxfWriterAscii( std::ofstream *stream );
63-
virtual ~dxfWriterAscii() {}
6462
virtual bool writeString( int code, std::string text );
6563
virtual bool writeInt16( int code, int data );
6664
virtual bool writeInt32( int code, int data );

src/app/qgsattributeactiondialog.h

-2
Original file line numberDiff line numberDiff line change
@@ -49,8 +49,6 @@ class APP_EXPORT QgsAttributeActionDialog: public QWidget, private Ui::QgsAttrib
4949
QgsAttributeActionDialog( const QgsActionManager& actions,
5050
QWidget* parent = nullptr );
5151

52-
~QgsAttributeActionDialog() {}
53-
5452
void init( const QgsActionManager& action , const QgsAttributeTableConfig& attributeTableConfig );
5553

5654
QList<QgsAction> actions() const;

src/app/qgsdecorationcopyright.cpp

-3
Original file line numberDiff line numberDiff line change
@@ -54,9 +54,6 @@ QgsDecorationCopyright::QgsDecorationCopyright( QObject* parent )
5454
projectRead();
5555
}
5656

57-
QgsDecorationCopyright::~QgsDecorationCopyright()
58-
{}
59-
6057
void QgsDecorationCopyright::projectRead()
6158
{
6259
QgsDecorationItem::projectRead();

src/app/qgsdecorationcopyright.h

-2
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,6 @@ class APP_EXPORT QgsDecorationCopyright : public QgsDecorationItem
3737
//! Constructor
3838
QgsDecorationCopyright( QObject* parent = nullptr );
3939

40-
virtual ~QgsDecorationCopyright();
41-
4240
public slots:
4341
//! set values on the gui when a project is read or the gui first loaded
4442
void projectRead() override;

src/core/auth/qgsauthconfig.h

-2
Original file line numberDiff line numberDiff line change
@@ -299,8 +299,6 @@ class CORE_EXPORT QgsAuthConfigSslServer
299299
//! Construct a default SSL server configuration
300300
QgsAuthConfigSslServer();
301301

302-
~QgsAuthConfigSslServer() {}
303-
304302
//! Server certificate object
305303
const QSslCertificate sslCertificate() const { return mSslCert; }
306304
//! Set server certificate object

src/core/auth/qgsauthmethod.h

-2
Original file line numberDiff line numberDiff line change
@@ -53,8 +53,6 @@ class CORE_EXPORT QgsAuthMethod : public QObject
5353
};
5454
Q_DECLARE_FLAGS( Expansions, Expansion )
5555

56-
virtual ~QgsAuthMethod() {}
57-
5856
//! A non-translated short name representing the auth method
5957
virtual QString key() const = 0;
6058

src/core/effects/qgspainteffectregistry.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ class CORE_EXPORT QgsPaintEffectAbstractMetadata
4343
*/
4444
QgsPaintEffectAbstractMetadata( const QString& name, const QString& visibleName );
4545

46-
virtual ~QgsPaintEffectAbstractMetadata() {}
46+
virtual ~QgsPaintEffectAbstractMetadata() = default;
4747

4848
/** Returns the unique string representing the paint effect class
4949
* @returns unique string

src/core/geometry/qgsabstractgeometry.cpp

-4
Original file line numberDiff line numberDiff line change
@@ -27,10 +27,6 @@ QgsAbstractGeometry::QgsAbstractGeometry(): mWkbType( QgsWkbTypes::Unknown )
2727
{
2828
}
2929

30-
QgsAbstractGeometry::~QgsAbstractGeometry()
31-
{
32-
}
33-
3430
QgsAbstractGeometry::QgsAbstractGeometry( const QgsAbstractGeometry& geom )
3531
{
3632
mWkbType = geom.mWkbType;

0 commit comments

Comments
 (0)