From 36305cf987788b01c64dcd891584e11cf7c205c0 Mon Sep 17 00:00:00 2001 From: Krishty Date: Mon, 16 Jan 2023 21:47:11 +0100 Subject: [PATCH] Tidy Up Constructors and Destructors MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This commit does not add or remove c’tors or d’tors, so it is *not* ABI-breaking. If a c’tor/d’tor does nothing else than the default behavior, this commit replaces it with “= default”. If an initializer list entry does nothing else than the default behavior, this commit removes it. First and foremost, remove default c’tor calls of base classes (always called by the compiler if no other base c’tor is explicitly called) and c’tor calls of members with complex types (e.g. “std::vector”). In a few instances, user-defined copy c’tors / move c’tors / assignment operators / move assignment operators were replaced with “= default”, too. I only did this if I had a clear understanding of what’s going on. --- code/AssetLib/3DS/3DSHelper.h | 125 ++----------------- code/AssetLib/3MF/3MFTypes.h | 4 +- code/AssetLib/3MF/D3MFExporter.cpp | 2 +- code/AssetLib/AMF/AMFImporter.cpp | 6 +- code/AssetLib/AMF/AMFImporter_Node.hpp | 10 +- code/AssetLib/Blender/BlenderDNA.h | 4 +- code/AssetLib/Blender/BlenderModifier.h | 4 +- code/AssetLib/Blender/BlenderScene.h | 25 ++-- code/AssetLib/Blender/BlenderTessellator.cpp | 4 +- code/AssetLib/C4D/C4DImporter.cpp | 9 +- code/AssetLib/Collada/ColladaLoader.cpp | 9 -- code/AssetLib/DXF/DXFHelper.h | 4 +- code/AssetLib/FBX/FBXExportNode.h | 4 - code/AssetLib/FBX/FBXImporter.cpp | 5 +- code/AssetLib/Irr/IRRMeshLoader.cpp | 6 +- code/AssetLib/Irr/IRRShared.h | 4 +- code/AssetLib/M3D/M3DImporter.h | 2 +- code/AssetLib/OpenGEX/OpenGEXImporter.cpp | 1 - code/AssetLib/Ply/PlyParser.h | 20 +-- code/AssetLib/Q3BSP/Q3BSPFileData.h | 14 +-- code/AssetLib/Q3BSP/Q3BSPFileImporter.cpp | 2 +- code/AssetLib/SMD/SMDLoader.cpp | 1 - code/AssetLib/SMD/SMDLoader.h | 2 +- code/AssetLib/X/XFileHelper.h | 23 +--- code/AssetLib/X/XFileImporter.cpp | 4 +- code/AssetLib/X3D/X3DExporter.hpp | 12 +- code/AssetLib/X3D/X3DImporter_Node.hpp | 8 +- code/AssetLib/glTF/glTFAsset.h | 8 +- code/AssetLib/glTF/glTFImporter.cpp | 2 +- code/AssetLib/glTF2/glTF2Asset.h | 14 +-- code/AssetLib/glTF2/glTF2Importer.cpp | 3 - code/Common/FileSystemFilter.h | 4 +- include/assimp/IOStream.hpp | 4 +- include/assimp/IOStreamBuffer.h | 4 +- include/assimp/IOSystem.hpp | 5 +- include/assimp/LineSplitter.h | 5 +- include/assimp/MemoryIOWrapper.h | 3 +- include/assimp/Profiler.h | 4 +- include/assimp/ProgressHandler.hpp | 8 +- include/assimp/SceneCombiner.h | 8 +- 40 files changed, 63 insertions(+), 323 deletions(-) diff --git a/code/AssetLib/3DS/3DSHelper.h b/code/AssetLib/3DS/3DSHelper.h index dc1098035..06c36bfeb 100644 --- a/code/AssetLib/3DS/3DSHelper.h +++ b/code/AssetLib/3DS/3DSHelper.h @@ -322,7 +322,6 @@ struct Texture { //! Default constructor Texture() AI_NO_EXCEPT : mTextureBlend(0.0f), - mMapName(), mOffsetU(0.0), mOffsetV(0.0), mScaleU(1.0), @@ -334,51 +333,11 @@ struct Texture { mTextureBlend = get_qnan(); } - Texture(const Texture &other) : - mTextureBlend(other.mTextureBlend), - mMapName(other.mMapName), - mOffsetU(other.mOffsetU), - mOffsetV(other.mOffsetV), - mScaleU(other.mScaleU), - mScaleV(other.mScaleV), - mRotation(other.mRotation), - mMapMode(other.mMapMode), - bPrivate(other.bPrivate), - iUVSrc(other.iUVSrc) { - // empty - } + Texture(const Texture &other) = default; - Texture(Texture &&other) AI_NO_EXCEPT : mTextureBlend(other.mTextureBlend), - mMapName(std::move(other.mMapName)), - mOffsetU(other.mOffsetU), - mOffsetV(other.mOffsetV), - mScaleU(other.mScaleU), - mScaleV(other.mScaleV), - mRotation(other.mRotation), - mMapMode(other.mMapMode), - bPrivate(other.bPrivate), - iUVSrc(other.iUVSrc) { - // empty - } + Texture(Texture &&other) AI_NO_EXCEPT = default; - Texture &operator=(Texture &&other) AI_NO_EXCEPT { - if (this == &other) { - return *this; - } - - mTextureBlend = other.mTextureBlend; - mMapName = std::move(other.mMapName); - mOffsetU = other.mOffsetU; - mOffsetV = other.mOffsetV; - mScaleU = other.mScaleU; - mScaleV = other.mScaleV; - mRotation = other.mRotation; - mMapMode = other.mMapMode; - bPrivate = other.bPrivate; - iUVSrc = other.iUVSrc; - - return *this; - } + Texture &operator=(Texture &&other) AI_NO_EXCEPT = default; //! Specifies the blend factor for the texture ai_real mTextureBlend; @@ -436,83 +395,13 @@ struct Material { // empty } - Material(const Material &other) : - mName(other.mName), - mDiffuse(other.mDiffuse), - mSpecularExponent(other.mSpecularExponent), - mShininessStrength(other.mShininessStrength), - mSpecular(other.mSpecular), - mAmbient(other.mAmbient), - mShading(other.mShading), - mTransparency(other.mTransparency), - sTexDiffuse(other.sTexDiffuse), - sTexOpacity(other.sTexOpacity), - sTexSpecular(other.sTexSpecular), - sTexReflective(other.sTexReflective), - sTexBump(other.sTexBump), - sTexEmissive(other.sTexEmissive), - sTexShininess(other.sTexShininess), - mBumpHeight(other.mBumpHeight), - mEmissive(other.mEmissive), - sTexAmbient(other.sTexAmbient), - mTwoSided(other.mTwoSided) { - // empty - } + Material(const Material &other) = default; - //! Move constructor. This is explicitly written because MSVC doesn't support defaulting it - Material(Material &&other) AI_NO_EXCEPT : mName(std::move(other.mName)), - mDiffuse(other.mDiffuse), - mSpecularExponent(other.mSpecularExponent), - mShininessStrength(other.mShininessStrength), - mSpecular(other.mSpecular), - mAmbient(other.mAmbient), - mShading(other.mShading), - mTransparency(other.mTransparency), - sTexDiffuse(std::move(other.sTexDiffuse)), - sTexOpacity(std::move(other.sTexOpacity)), - sTexSpecular(std::move(other.sTexSpecular)), - sTexReflective(std::move(other.sTexReflective)), - sTexBump(std::move(other.sTexBump)), - sTexEmissive(std::move(other.sTexEmissive)), - sTexShininess(std::move(other.sTexShininess)), - mBumpHeight(other.mBumpHeight), - mEmissive(other.mEmissive), - sTexAmbient(std::move(other.sTexAmbient)), - mTwoSided(other.mTwoSided) { - // empty - } + Material(Material &&other) AI_NO_EXCEPT = default; - Material &operator=(Material &&other) AI_NO_EXCEPT { - if (this == &other) { - return *this; - } + Material &operator=(Material &&other) AI_NO_EXCEPT = default; - mName = std::move(other.mName); - mDiffuse = other.mDiffuse; - mSpecularExponent = other.mSpecularExponent; - mShininessStrength = other.mShininessStrength, - mSpecular = other.mSpecular; - mAmbient = other.mAmbient; - mShading = other.mShading; - mTransparency = other.mTransparency; - sTexDiffuse = std::move(other.sTexDiffuse); - sTexOpacity = std::move(other.sTexOpacity); - sTexSpecular = std::move(other.sTexSpecular); - sTexReflective = std::move(other.sTexReflective); - sTexBump = std::move(other.sTexBump); - sTexEmissive = std::move(other.sTexEmissive); - sTexShininess = std::move(other.sTexShininess); - mBumpHeight = other.mBumpHeight; - mEmissive = other.mEmissive; - sTexAmbient = std::move(other.sTexAmbient); - mTwoSided = other.mTwoSided; - - return *this; - } - - virtual ~Material() { - // empty - } + virtual ~Material() = default; //! Name of the material std::string mName; diff --git a/code/AssetLib/3MF/3MFTypes.h b/code/AssetLib/3MF/3MFTypes.h index 987cdf613..02238ceab 100644 --- a/code/AssetLib/3MF/3MFTypes.h +++ b/code/AssetLib/3MF/3MFTypes.h @@ -69,9 +69,7 @@ public: // empty } - virtual ~Resource() { - // empty - } + virtual ~Resource() = default; virtual ResourceType getType() const { return ResourceType::RT_Unknown; diff --git a/code/AssetLib/3MF/D3MFExporter.cpp b/code/AssetLib/3MF/D3MFExporter.cpp index 42cd991e6..4ba3bbf24 100644 --- a/code/AssetLib/3MF/D3MFExporter.cpp +++ b/code/AssetLib/3MF/D3MFExporter.cpp @@ -83,7 +83,7 @@ void ExportScene3MF(const char *pFile, IOSystem *pIOSystem, const aiScene *pScen namespace D3MF { D3MFExporter::D3MFExporter(const char *pFile, const aiScene *pScene) : - mArchiveName(pFile), m_zipArchive(nullptr), mScene(pScene), mModelOutput(), mRelOutput(), mContentOutput(), mBuildItems(), mRelations() { + mArchiveName(pFile), m_zipArchive(nullptr), mScene(pScene) { // empty } diff --git a/code/AssetLib/AMF/AMFImporter.cpp b/code/AssetLib/AMF/AMFImporter.cpp index b95fdf540..ff581b492 100644 --- a/code/AssetLib/AMF/AMFImporter.cpp +++ b/code/AssetLib/AMF/AMFImporter.cpp @@ -83,11 +83,7 @@ void AMFImporter::Clear() { AMFImporter::AMFImporter() AI_NO_EXCEPT : mNodeElement_Cur(nullptr), - mXmlParser(nullptr), - mUnit(), - mVersion(), - mMaterial_Converted(), - mTexture_Converted() { + mXmlParser(nullptr) { // empty } diff --git a/code/AssetLib/AMF/AMFImporter_Node.hpp b/code/AssetLib/AMF/AMFImporter_Node.hpp index c827533a6..dd27316d3 100644 --- a/code/AssetLib/AMF/AMFImporter_Node.hpp +++ b/code/AssetLib/AMF/AMFImporter_Node.hpp @@ -88,9 +88,7 @@ public: std::list Child; ///< Child elements. public: /// Destructor, virtual.. - virtual ~AMFNodeElementBase() { - // empty - } + virtual ~AMFNodeElementBase() = default; /// Disabled copy constructor and co. AMFNodeElementBase(const AMFNodeElementBase &pNodeElement) = delete; @@ -103,7 +101,7 @@ protected: /// \param [in] pType - element type. /// \param [in] pParent - parent element. AMFNodeElementBase(const EType pType, AMFNodeElementBase *pParent) : - Type(pType), ID(), Parent(pParent), Child() { + Type(pType), Parent(pParent) { // empty } }; // class IAMFImporter_NodeElement @@ -174,7 +172,7 @@ struct AMFColor : public AMFNodeElementBase { /// @brief Constructor. /// @param [in] pParent - pointer to parent node. AMFColor(AMFNodeElementBase *pParent) : - AMFNodeElementBase(ENET_Color, pParent), Composed(false), Color(), Profile() { + AMFNodeElementBase(ENET_Color, pParent), Composed(false), Color() { // empty } }; @@ -270,7 +268,7 @@ struct AMFTexMap : public AMFNodeElementBase { /// Constructor. /// \param [in] pParent - pointer to parent node. AMFTexMap(AMFNodeElementBase *pParent) : - AMFNodeElementBase(ENET_TexMap, pParent), TextureCoordinate{}, TextureID_R(), TextureID_G(), TextureID_B(), TextureID_A() { + AMFNodeElementBase(ENET_TexMap, pParent), TextureCoordinate{} { // empty } }; diff --git a/code/AssetLib/Blender/BlenderDNA.h b/code/AssetLib/Blender/BlenderDNA.h index dcae3198b..494dc4b34 100644 --- a/code/AssetLib/Blender/BlenderDNA.h +++ b/code/AssetLib/Blender/BlenderDNA.h @@ -106,9 +106,7 @@ struct ElemBase { // empty } - virtual ~ElemBase() { - // empty - } + virtual ~ElemBase() = default; /** Type name of the element. The type * string points is the `c_str` of the `name` attribute of the diff --git a/code/AssetLib/Blender/BlenderModifier.h b/code/AssetLib/Blender/BlenderModifier.h index 5af560caf..180a456a1 100644 --- a/code/AssetLib/Blender/BlenderModifier.h +++ b/code/AssetLib/Blender/BlenderModifier.h @@ -62,9 +62,7 @@ public: /** * The class destructor, virtual. */ - virtual ~BlenderModifier() { - // empty - } + virtual ~BlenderModifier() = default; // -------------------- /** diff --git a/code/AssetLib/Blender/BlenderScene.h b/code/AssetLib/Blender/BlenderScene.h index 436e47061..ba7ded909 100644 --- a/code/AssetLib/Blender/BlenderScene.h +++ b/code/AssetLib/Blender/BlenderScene.h @@ -182,7 +182,7 @@ struct MVert : ElemBase { int bweight; MVert() : - ElemBase(), flag(0), mat_nr(0), bweight(0) {} + flag(0), mat_nr(0), bweight(0) {} }; // ------------------------------------------------------------------------------- @@ -417,7 +417,6 @@ struct CustomDataLayer : ElemBase { std::shared_ptr data; // must be converted to real type according type member CustomDataLayer() : - ElemBase(), type(0), offset(0), flag(0), @@ -729,7 +728,7 @@ struct Object : ElemBase { ListBase modifiers; Object() : - ElemBase(), type(Type_EMPTY), parent(nullptr), track(), proxy(), proxy_from(), data() { + type(Type_EMPTY), parent(nullptr) { // empty } }; @@ -741,8 +740,7 @@ struct Base : ElemBase { std::shared_ptr object WARN; Base() : - ElemBase(), prev(nullptr), next(), object() { - // empty + prev(nullptr) { // empty } }; @@ -758,10 +756,7 @@ struct Scene : ElemBase { ListBase base; - Scene() : - ElemBase(), camera(), world(), basact(), master_collection() { - // empty - } + Scene() = default; }; // ------------------------------------------------------------------------------- @@ -791,10 +786,7 @@ struct Image : ElemBase { short gen_x, gen_y, gen_type; - Image() : - ElemBase() { - // empty - } + Image() = default; }; // ------------------------------------------------------------------------------- @@ -884,7 +876,7 @@ struct Tex : ElemBase { //char use_nodes; Tex() : - ElemBase(), imaflag(ImageFlags_INTERPOL), type(Type_CLOUDS), ima() { + imaflag(ImageFlags_INTERPOL), type(Type_CLOUDS) { // empty } }; @@ -976,10 +968,7 @@ struct MTex : ElemBase { //float shadowfac; //float zenupfac, zendownfac, blendfac; - MTex() : - ElemBase() { - // empty - } + MTex() = default; }; } // namespace Blender diff --git a/code/AssetLib/Blender/BlenderTessellator.cpp b/code/AssetLib/Blender/BlenderTessellator.cpp index d3ef5ae5e..40117a974 100644 --- a/code/AssetLib/Blender/BlenderTessellator.cpp +++ b/code/AssetLib/Blender/BlenderTessellator.cpp @@ -81,9 +81,7 @@ BlenderTessellatorGL::BlenderTessellatorGL( BlenderBMeshConverter& converter ): } // ------------------------------------------------------------------------------------------------ -BlenderTessellatorGL::~BlenderTessellatorGL( ) -{ -} +BlenderTessellatorGL::~BlenderTessellatorGL() = default; // ------------------------------------------------------------------------------------------------ void BlenderTessellatorGL::Tessellate( const MLoop* polyLoop, int vertexCount, const std::vector< MVert >& vertices ) diff --git a/code/AssetLib/C4D/C4DImporter.cpp b/code/AssetLib/C4D/C4DImporter.cpp index 06d7a3412..9a3a72667 100644 --- a/code/AssetLib/C4D/C4DImporter.cpp +++ b/code/AssetLib/C4D/C4DImporter.cpp @@ -106,15 +106,10 @@ static const aiImporterDesc desc = { // ------------------------------------------------------------------------------------------------ -C4DImporter::C4DImporter() -: BaseImporter() { - // empty -} +C4DImporter::C4DImporter() = default; // ------------------------------------------------------------------------------------------------ -C4DImporter::~C4DImporter() { - // empty -} +C4DImporter::~C4DImporter() = default; // ------------------------------------------------------------------------------------------------ bool C4DImporter::CanRead( const std::string& pFile, IOSystem* /*pIOHandler*/, bool /*checkSig*/) const { diff --git a/code/AssetLib/Collada/ColladaLoader.cpp b/code/AssetLib/Collada/ColladaLoader.cpp index 2d578aff3..1280fd0d1 100644 --- a/code/AssetLib/Collada/ColladaLoader.cpp +++ b/code/AssetLib/Collada/ColladaLoader.cpp @@ -92,15 +92,6 @@ inline void AddNodeMetaData(aiNode *node, const std::string &key, const T &value // ------------------------------------------------------------------------------------------------ // Constructor to be privately used by Importer ColladaLoader::ColladaLoader() : - mFileName(), - mMeshIndexByID(), - mMaterialIndexByName(), - mMeshes(), - newMats(), - mCameras(), - mLights(), - mTextures(), - mAnims(), noSkeletonMesh(false), removeEmptyBones(false), ignoreUpDirection(false), diff --git a/code/AssetLib/DXF/DXFHelper.h b/code/AssetLib/DXF/DXFHelper.h index e50c471d2..4d7893cc4 100644 --- a/code/AssetLib/DXF/DXFHelper.h +++ b/code/AssetLib/DXF/DXFHelper.h @@ -65,7 +65,6 @@ public: LineReader(StreamReaderLE& reader) : splitter(reader,false,true) , groupcode( 0 ) - , value() , end() { // empty } @@ -186,8 +185,7 @@ struct InsertBlock { InsertBlock() : pos() , scale(1.f,1.f,1.f) - , angle() - , name() { + , angle() { // empty } diff --git a/code/AssetLib/FBX/FBXExportNode.h b/code/AssetLib/FBX/FBXExportNode.h index 62c06e16b..99644b216 100644 --- a/code/AssetLib/FBX/FBXExportNode.h +++ b/code/AssetLib/FBX/FBXExportNode.h @@ -77,8 +77,6 @@ public: // constructors /// The class constructor with the name. Node(const std::string& n) : name(n) - , properties() - , children() , force_has_children( false ) { // empty } @@ -87,8 +85,6 @@ public: // constructors template Node(const std::string& n, More&&... more) : name(n) - , properties() - , children() , force_has_children(false) { AddProperties(std::forward(more)...); } diff --git a/code/AssetLib/FBX/FBXImporter.cpp b/code/AssetLib/FBX/FBXImporter.cpp index 7ff194905..6a727c3d7 100644 --- a/code/AssetLib/FBX/FBXImporter.cpp +++ b/code/AssetLib/FBX/FBXImporter.cpp @@ -90,10 +90,7 @@ static const aiImporterDesc desc = { // ------------------------------------------------------------------------------------------------ // Constructor to be privately used by #Importer -FBXImporter::FBXImporter() : - mSettings() { - // empty -} +FBXImporter::FBXImporter() = default; // ------------------------------------------------------------------------------------------------ // Returns whether the class can handle the format of the given file. diff --git a/code/AssetLib/Irr/IRRMeshLoader.cpp b/code/AssetLib/Irr/IRRMeshLoader.cpp index 9b4faec83..52fb82ff9 100644 --- a/code/AssetLib/Irr/IRRMeshLoader.cpp +++ b/code/AssetLib/Irr/IRRMeshLoader.cpp @@ -71,11 +71,7 @@ static const aiImporterDesc desc = { // ------------------------------------------------------------------------------------------------ // Constructor to be privately used by Importer -IRRMeshImporter::IRRMeshImporter() : - BaseImporter(), - IrrlichtBase() { - // empty -} +IRRMeshImporter::IRRMeshImporter() = default; // ------------------------------------------------------------------------------------------------ // Destructor, private as well diff --git a/code/AssetLib/Irr/IRRShared.h b/code/AssetLib/Irr/IRRShared.h index 90e212d65..ee1309e14 100644 --- a/code/AssetLib/Irr/IRRShared.h +++ b/code/AssetLib/Irr/IRRShared.h @@ -63,9 +63,7 @@ protected: // empty } - ~IrrlichtBase() { - // empty - } + ~IrrlichtBase() = default; /** @brief Data structure for a simple name-value property */ diff --git a/code/AssetLib/M3D/M3DImporter.h b/code/AssetLib/M3D/M3DImporter.h index 5d3fcaa7b..9ca8f9211 100644 --- a/code/AssetLib/M3D/M3DImporter.h +++ b/code/AssetLib/M3D/M3DImporter.h @@ -65,7 +65,7 @@ class M3DImporter : public BaseImporter { public: /// \brief Default constructor M3DImporter(); - ~M3DImporter() override {} + ~M3DImporter() override = default; /// \brief Returns whether the class can handle the format of the given file. /// \remark See BaseImporter::CanRead() for details. diff --git a/code/AssetLib/OpenGEX/OpenGEXImporter.cpp b/code/AssetLib/OpenGEX/OpenGEXImporter.cpp index 2883f9612..1bd981656 100644 --- a/code/AssetLib/OpenGEX/OpenGEXImporter.cpp +++ b/code/AssetLib/OpenGEX/OpenGEXImporter.cpp @@ -261,7 +261,6 @@ OpenGEXImporter::RefInfo::RefInfo(aiNode *node, Type type, std::vector alProperties; @@ -386,10 +381,7 @@ class ElementInstanceList public: //! Default constructor - ElementInstanceList() AI_NO_EXCEPT - : alInstances() { - // empty - } + ElementInstanceList() AI_NO_EXCEPT = default; //! List of all element instances std::vector< ElementInstance > alInstances; @@ -413,11 +405,7 @@ class DOM public: //! Default constructor - DOM() AI_NO_EXCEPT - : alElements() - , alElementData() { - - } + DOM() AI_NO_EXCEPT = default; //! Contains all elements of the file format diff --git a/code/AssetLib/Q3BSP/Q3BSPFileData.h b/code/AssetLib/Q3BSP/Q3BSPFileData.h index 8ccee0b0a..086cf7842 100644 --- a/code/AssetLib/Q3BSP/Q3BSPFileData.h +++ b/code/AssetLib/Q3BSP/Q3BSPFileData.h @@ -169,19 +169,7 @@ struct Q3BSPModel { std::vector m_EntityData; std::string m_ModelName; - Q3BSPModel() : - m_Data(), - m_Lumps(), - m_Vertices(), - m_Faces(), - m_Indices(), - m_Textures(), - m_Lightmaps(), - m_EntityData(), - m_ModelName() - { - // empty - } + Q3BSPModel() = default; ~Q3BSPModel() { for ( unsigned int i=0; i mMeshes; Node() AI_NO_EXCEPT - : mName(), - mTrafoMatrix(), - mParent(nullptr), - mChildren(), - mMeshes() { + : mTrafoMatrix(), + mParent(nullptr) { // empty } explicit Node(Node *pParent) : - mName(), mTrafoMatrix(), mParent(pParent), mChildren(), mMeshes() { + mTrafoMatrix(), mParent(pParent) { // empty } @@ -211,8 +198,6 @@ struct Scene { Scene() AI_NO_EXCEPT : mRootNode(nullptr), - mGlobalMeshes(), - mGlobalMaterials(), mAnimTicksPerSecond(0) { // empty } diff --git a/code/AssetLib/X/XFileImporter.cpp b/code/AssetLib/X/XFileImporter.cpp index 8bd5d9e88..32865e8a8 100644 --- a/code/AssetLib/X/XFileImporter.cpp +++ b/code/AssetLib/X/XFileImporter.cpp @@ -75,9 +75,7 @@ static const aiImporterDesc desc = { // ------------------------------------------------------------------------------------------------ // Constructor to be privately used by Importer -XFileImporter::XFileImporter() : mBuffer() { - // empty -} +XFileImporter::XFileImporter() = default; // ------------------------------------------------------------------------------------------------ // Returns whether the class can handle the format of the given file. diff --git a/code/AssetLib/X3D/X3DExporter.hpp b/code/AssetLib/X3D/X3DExporter.hpp index 7a87821b4..e77aa6877 100644 --- a/code/AssetLib/X3D/X3DExporter.hpp +++ b/code/AssetLib/X3D/X3DExporter.hpp @@ -52,22 +52,14 @@ class X3DExporter { struct SAttribute { const std::string Name; const std::string Value; - SAttribute() : - Name(), - Value() { - // empty - } + SAttribute() = default; SAttribute(const std::string &name, const std::string &value) : Name(name), Value(value) { // empty } - SAttribute(SAttribute &&rhs) AI_NO_EXCEPT : - Name(rhs.Name), - Value(rhs.Value) { - // empty - } + SAttribute(SAttribute &&rhs) AI_NO_EXCEPT = default; }; /***********************************************/ diff --git a/code/AssetLib/X3D/X3DImporter_Node.hpp b/code/AssetLib/X3D/X3DImporter_Node.hpp index 8d33c4b7a..62bf857e4 100644 --- a/code/AssetLib/X3D/X3DImporter_Node.hpp +++ b/code/AssetLib/X3D/X3DImporter_Node.hpp @@ -108,9 +108,7 @@ struct X3DNodeElementBase { std::list Children; X3DElemType Type; - virtual ~X3DNodeElementBase() { - // empty - } + virtual ~X3DNodeElementBase() = default; protected: X3DNodeElementBase(X3DElemType type, X3DNodeElementBase *pParent) : @@ -367,9 +365,7 @@ struct X3DNodeElementMeta : X3DNodeElementBase { std::string Name; ///< Name of metadata object. std::string Reference; - virtual ~X3DNodeElementMeta() { - // empty - } + virtual ~X3DNodeElementMeta() = default; protected: X3DNodeElementMeta(X3DElemType type, X3DNodeElementBase *parent) : diff --git a/code/AssetLib/glTF/glTFAsset.h b/code/AssetLib/glTF/glTFAsset.h index 26ef239cd..955dea40f 100644 --- a/code/AssetLib/glTF/glTFAsset.h +++ b/code/AssetLib/glTF/glTFAsset.h @@ -629,9 +629,7 @@ struct Mesh : public Object { SExtension(const EType pType) : Type(pType) {} - virtual ~SExtension() { - // empty - } + virtual ~SExtension() = default; }; #ifdef ASSIMP_IMPORTER_GLTF_USE_OPEN3DGC @@ -657,9 +655,7 @@ struct Mesh : public Object { // empty } - virtual ~SCompression_Open3DGC() { - // empty - } + virtual ~SCompression_Open3DGC() = default; }; #endif diff --git a/code/AssetLib/glTF/glTFImporter.cpp b/code/AssetLib/glTF/glTFImporter.cpp index 3a5b0ef3c..61c11f594 100644 --- a/code/AssetLib/glTF/glTFImporter.cpp +++ b/code/AssetLib/glTF/glTFImporter.cpp @@ -80,7 +80,7 @@ static const aiImporterDesc desc = { }; glTFImporter::glTFImporter() : - BaseImporter(), meshOffsets(), embeddedTexIdxs(), mScene(nullptr) { + mScene(nullptr) { // empty } diff --git a/code/AssetLib/glTF2/glTF2Asset.h b/code/AssetLib/glTF2/glTF2Asset.h index 85af49acf..e8d1d88d1 100644 --- a/code/AssetLib/glTF2/glTF2Asset.h +++ b/code/AssetLib/glTF2/glTF2Asset.h @@ -365,16 +365,7 @@ struct CustomExtension { ~CustomExtension() = default; - CustomExtension(const CustomExtension &other) : - name(other.name), - mStringValue(other.mStringValue), - mDoubleValue(other.mDoubleValue), - mUint64Value(other.mUint64Value), - mInt64Value(other.mInt64Value), - mBoolValue(other.mBoolValue), - mValues(other.mValues) { - // empty - } + CustomExtension(const CustomExtension &other) = default; CustomExtension& operator=(const CustomExtension&) = default; }; @@ -1086,8 +1077,7 @@ struct AssetMetadata { void Read(Document &doc); - AssetMetadata() : - version() {} + AssetMetadata() = default; }; // diff --git a/code/AssetLib/glTF2/glTF2Importer.cpp b/code/AssetLib/glTF2/glTF2Importer.cpp index 7d3a4b9fe..d6b65b458 100644 --- a/code/AssetLib/glTF2/glTF2Importer.cpp +++ b/code/AssetLib/glTF2/glTF2Importer.cpp @@ -96,9 +96,6 @@ static const aiImporterDesc desc = { }; glTF2Importer::glTF2Importer() : - BaseImporter(), - meshOffsets(), - mEmbeddedTexIdxs(), mScene(nullptr) { // empty } diff --git a/code/Common/FileSystemFilter.h b/code/Common/FileSystemFilter.h index 9ab3812e2..d28233ae9 100644 --- a/code/Common/FileSystemFilter.h +++ b/code/Common/FileSystemFilter.h @@ -93,9 +93,7 @@ public: } /** Destructor. */ - ~FileSystemFilter() { - // empty - } + ~FileSystemFilter() = default; // ------------------------------------------------------------------- /** Tests for the existence of a file at the given path. */ diff --git a/include/assimp/IOStream.hpp b/include/assimp/IOStream.hpp index 3b9b3c3f8..12beb0dbb 100644 --- a/include/assimp/IOStream.hpp +++ b/include/assimp/IOStream.hpp @@ -128,9 +128,7 @@ public: // ---------------------------------------------------------------------------------- AI_FORCE_INLINE -IOStream::IOStream() AI_NO_EXCEPT { - // empty -} +IOStream::IOStream() AI_NO_EXCEPT = default; // ---------------------------------------------------------------------------------- AI_FORCE_INLINE diff --git a/include/assimp/IOStreamBuffer.h b/include/assimp/IOStreamBuffer.h index 09ca1c962..b34fc9ee1 100644 --- a/include/assimp/IOStreamBuffer.h +++ b/include/assimp/IOStreamBuffer.h @@ -141,9 +141,7 @@ AI_FORCE_INLINE IOStreamBuffer::IOStreamBuffer(size_t cache) : } template -AI_FORCE_INLINE IOStreamBuffer::~IOStreamBuffer() { - // empty -} +AI_FORCE_INLINE IOStreamBuffer::~IOStreamBuffer() = default; template AI_FORCE_INLINE bool IOStreamBuffer::open(IOStream *stream) { diff --git a/include/assimp/IOSystem.hpp b/include/assimp/IOSystem.hpp index b4531f96a..30f48b81c 100644 --- a/include/assimp/IOSystem.hpp +++ b/include/assimp/IOSystem.hpp @@ -237,10 +237,7 @@ private: }; // ---------------------------------------------------------------------------- -AI_FORCE_INLINE IOSystem::IOSystem() AI_NO_EXCEPT : - m_pathStack() { - // empty -} +AI_FORCE_INLINE IOSystem::IOSystem() AI_NO_EXCEPT = default; // ---------------------------------------------------------------------------- AI_FORCE_INLINE IOSystem::~IOSystem() = default; diff --git a/include/assimp/LineSplitter.h b/include/assimp/LineSplitter.h index a8aa665db..379821f03 100644 --- a/include/assimp/LineSplitter.h +++ b/include/assimp/LineSplitter.h @@ -145,7 +145,6 @@ private: AI_FORCE_INLINE LineSplitter::LineSplitter(StreamReaderLE& stream, bool skip_empty_lines, bool trim ) : mIdx(0), - mCur(), mStream(stream), mSwallow(), mSkip_empty_lines(skip_empty_lines), @@ -155,9 +154,7 @@ AI_FORCE_INLINE LineSplitter::LineSplitter(StreamReaderLE& stream, bool skip_emp mIdx = 0; } -AI_FORCE_INLINE LineSplitter::~LineSplitter() { - // empty -} +AI_FORCE_INLINE LineSplitter::~LineSplitter() = default; AI_FORCE_INLINE LineSplitter& LineSplitter::operator++() { if (mSwallow) { diff --git a/include/assimp/MemoryIOWrapper.h b/include/assimp/MemoryIOWrapper.h index b4c37763d..0bd3bc108 100644 --- a/include/assimp/MemoryIOWrapper.h +++ b/include/assimp/MemoryIOWrapper.h @@ -162,8 +162,7 @@ public: } /** Destructor. */ - ~MemoryIOSystem() { - } + ~MemoryIOSystem() = default; // ------------------------------------------------------------------- /** Tests for the existence of a file at the given path. */ diff --git a/include/assimp/Profiler.h b/include/assimp/Profiler.h index fe0ffbb10..3b9263b40 100644 --- a/include/assimp/Profiler.h +++ b/include/assimp/Profiler.h @@ -68,9 +68,7 @@ using namespace Formatter; */ class Profiler { public: - Profiler() { - // empty - } + Profiler() = default; /** Start a named timer */ diff --git a/include/assimp/ProgressHandler.hpp b/include/assimp/ProgressHandler.hpp index 1a272bb87..93d881659 100644 --- a/include/assimp/ProgressHandler.hpp +++ b/include/assimp/ProgressHandler.hpp @@ -67,15 +67,11 @@ class ASSIMP_API ProgressHandler { protected: /// @brief Default constructor - ProgressHandler () AI_NO_EXCEPT { - // empty - } + ProgressHandler () AI_NO_EXCEPT = default; public: /// @brief Virtual destructor. - virtual ~ProgressHandler () { - // empty - } + virtual ~ProgressHandler () = default; // ------------------------------------------------------------------- /** @brief Progress callback. diff --git a/include/assimp/SceneCombiner.h b/include/assimp/SceneCombiner.h index 6da38cd15..d6096900c 100644 --- a/include/assimp/SceneCombiner.h +++ b/include/assimp/SceneCombiner.h @@ -191,13 +191,9 @@ struct SceneHelper { */ class ASSIMP_API SceneCombiner { // class cannot be instanced - SceneCombiner() { - // empty - } + SceneCombiner() = delete; - ~SceneCombiner() { - // empty - } + ~SceneCombiner() = delete; public: // -------------------------------------------------------------------