From e3b01e10db3ed7551f7a42a9f3ce983a22922d6c Mon Sep 17 00:00:00 2001 From: Aaron Gokaslan Date: Thu, 1 Sep 2022 12:28:45 -0400 Subject: [PATCH] apply fixes to more headers --- code/AssetLib/ASE/ASEParser.h | 2 +- code/AssetLib/Blender/BlenderIntermediate.h | 3 +-- code/AssetLib/COB/COBScene.h | 2 +- code/AssetLib/Collada/ColladaExporter.h | 2 +- code/AssetLib/IFC/IFCUtil.h | 3 +-- code/AssetLib/IQM/IQMImporter.h | 2 +- code/AssetLib/Irr/IRRLoader.h | 3 +-- code/AssetLib/LWO/LWOFileData.h | 10 ++------- code/AssetLib/LWS/LWSLoader.h | 2 +- code/AssetLib/MMD/MMDPmxParser.h | 2 +- code/AssetLib/X3D/X3DExporter.hpp | 2 +- code/AssetLib/X3D/X3DImporter.hpp | 2 +- code/AssetLib/X3D/X3DImporter_Macro.hpp | 2 +- code/AssetLib/glTF/glTFAsset.h | 10 ++++----- code/AssetLib/glTF2/glTF2Asset.h | 24 ++++++++++----------- code/Common/BaseProcess.h | 4 ++-- include/assimp/IOStream.hpp | 4 +--- include/assimp/Logger.hpp | 4 +--- include/assimp/Subdivision.h | 5 +---- test/unit/UTLogStream.h | 2 +- 20 files changed, 37 insertions(+), 53 deletions(-) diff --git a/code/AssetLib/ASE/ASEParser.h b/code/AssetLib/ASE/ASEParser.h index 5c24fffd1..8cda32f24 100644 --- a/code/AssetLib/ASE/ASEParser.h +++ b/code/AssetLib/ASE/ASEParser.h @@ -116,7 +116,7 @@ struct Material : public D3DS::Material { return *this; } - ~Material() {} + ~Material() = default; //! Contains all sub materials of this material std::vector avSubMaterials; diff --git a/code/AssetLib/Blender/BlenderIntermediate.h b/code/AssetLib/Blender/BlenderIntermediate.h index 0651f7117..546b79f09 100644 --- a/code/AssetLib/Blender/BlenderIntermediate.h +++ b/code/AssetLib/Blender/BlenderIntermediate.h @@ -65,8 +65,7 @@ namespace Blender { struct TempArray { typedef TCLASS< T*,std::allocator > mywrap; - TempArray() { - } + TempArray() = default; ~TempArray () { for(T* elem : arr) { diff --git a/code/AssetLib/COB/COBScene.h b/code/AssetLib/COB/COBScene.h index 57620ca51..cc49de276 100644 --- a/code/AssetLib/COB/COBScene.h +++ b/code/AssetLib/COB/COBScene.h @@ -107,7 +107,7 @@ struct Node : public ChunkInfo TYPE_MESH,TYPE_GROUP,TYPE_LIGHT,TYPE_CAMERA,TYPE_BONE }; - virtual ~Node() {} + virtual ~Node() = default; Node(Type type) : type(type), unit_scale(1.f){} Type type; diff --git a/code/AssetLib/Collada/ColladaExporter.h b/code/AssetLib/Collada/ColladaExporter.h index 56415fba7..7288dce54 100644 --- a/code/AssetLib/Collada/ColladaExporter.h +++ b/code/AssetLib/Collada/ColladaExporter.h @@ -233,7 +233,7 @@ public: Surface ambient, diffuse, specular, emissive, reflective, transparent, normal; Property shininess, transparency, index_refraction; - Material() {} + Material() = default; }; std::map textures; diff --git a/code/AssetLib/IFC/IFCUtil.h b/code/AssetLib/IFC/IFCUtil.h index b5f72a56d..f9063ce22 100644 --- a/code/AssetLib/IFC/IFCUtil.h +++ b/code/AssetLib/IFC/IFCUtil.h @@ -344,8 +344,7 @@ protected: public: typedef std::pair ParamRange; - virtual ~Curve() {} - + virtual ~Curve() = default; // check if a curve is closed virtual bool IsClosed() const = 0; diff --git a/code/AssetLib/IQM/IQMImporter.h b/code/AssetLib/IQM/IQMImporter.h index fbeaff8c3..cc549186f 100644 --- a/code/AssetLib/IQM/IQMImporter.h +++ b/code/AssetLib/IQM/IQMImporter.h @@ -56,7 +56,7 @@ class IQMImporter : public BaseImporter { public: /// \brief Default constructor IQMImporter(); - ~IQMImporter() override {} + ~IQMImporter() 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/Irr/IRRLoader.h b/code/AssetLib/Irr/IRRLoader.h index d56c4ca2d..7fa239395 100644 --- a/code/AssetLib/Irr/IRRLoader.h +++ b/code/AssetLib/Irr/IRRLoader.h @@ -206,8 +206,7 @@ private: */ struct SkyboxVertex { - SkyboxVertex() - {} + SkyboxVertex() = default; //! Construction from single vertex components SkyboxVertex(ai_real px, ai_real py, ai_real pz, diff --git a/code/AssetLib/LWO/LWOFileData.h b/code/AssetLib/LWO/LWOFileData.h index 59d10eca1..656dd4529 100644 --- a/code/AssetLib/LWO/LWOFileData.h +++ b/code/AssetLib/LWO/LWOFileData.h @@ -338,13 +338,7 @@ struct Face : public aiFace { uint32_t type; //! Assignment operator - Face &operator=(const LWO::Face &f) { - aiFace::operator=(f); - surfaceIndex = f.surfaceIndex; - smoothGroup = f.smoothGroup; - type = f.type; - return *this; - } + Face &operator=(const LWO::Face &f) = default; }; // --------------------------------------------------------------------------- @@ -354,7 +348,7 @@ struct VMapEntry { explicit VMapEntry(unsigned int _dims) : dims(_dims) {} - virtual ~VMapEntry() {} + virtual ~VMapEntry() = default; //! allocates memory for the vertex map virtual void Allocate(unsigned int num) { diff --git a/code/AssetLib/LWS/LWSLoader.h b/code/AssetLib/LWS/LWSLoader.h index 225186f5c..3df9fe9d9 100644 --- a/code/AssetLib/LWS/LWSLoader.h +++ b/code/AssetLib/LWS/LWSLoader.h @@ -69,7 +69,7 @@ namespace LWS { */ class Element { public: - Element() {} + Element() = default; // first: name, second: rest std::string tokens[2]; diff --git a/code/AssetLib/MMD/MMDPmxParser.h b/code/AssetLib/MMD/MMDPmxParser.h index c9df37c68..f2e387975 100644 --- a/code/AssetLib/MMD/MMDPmxParser.h +++ b/code/AssetLib/MMD/MMDPmxParser.h @@ -88,7 +88,7 @@ namespace pmx { public: virtual void Read(std::istream *stream, PmxSetting *setting) = 0; - virtual ~PmxVertexSkinning() {} + virtual ~PmxVertexSkinning() = default; }; class PmxVertexSkinningBDEF1 : public PmxVertexSkinning diff --git a/code/AssetLib/X3D/X3DExporter.hpp b/code/AssetLib/X3D/X3DExporter.hpp index fefaba9f3..7a87821b4 100644 --- a/code/AssetLib/X3D/X3DExporter.hpp +++ b/code/AssetLib/X3D/X3DExporter.hpp @@ -241,7 +241,7 @@ public: /// \fn ~X3DExporter() /// Default destructor. - ~X3DExporter() {} + ~X3DExporter() = default; }; // class X3DExporter diff --git a/code/AssetLib/X3D/X3DImporter.hpp b/code/AssetLib/X3D/X3DImporter.hpp index d9aed70d8..8852b71ec 100644 --- a/code/AssetLib/X3D/X3DImporter.hpp +++ b/code/AssetLib/X3D/X3DImporter.hpp @@ -270,7 +270,7 @@ public: void Clear(); private: - X3DNodeElementBase *MACRO_USE_CHECKANDAPPLY(XmlNode &node, std::string pDEF, std::string pUSE, X3DElemType pType, X3DNodeElementBase *pNE); + X3DNodeElementBase *MACRO_USE_CHECKANDAPPLY(XmlNode &node, const std::string &pDEF, const std::string &pUSE, X3DElemType pType, X3DNodeElementBase *pNE); bool isNodeEmpty(XmlNode &node); void checkNodeMustBeEmpty(XmlNode &node); void skipUnsupportedNode(const std::string &pParentNodeName, XmlNode &node); diff --git a/code/AssetLib/X3D/X3DImporter_Macro.hpp b/code/AssetLib/X3D/X3DImporter_Macro.hpp index a84a739a3..26b949cfa 100644 --- a/code/AssetLib/X3D/X3DImporter_Macro.hpp +++ b/code/AssetLib/X3D/X3DImporter_Macro.hpp @@ -59,7 +59,7 @@ namespace Assimp { /// \param [in] pUSE - string holding "USE" value. /// \param [in] pType - type of element to find. /// \param [out] pNE - pointer to found node element. -inline X3DNodeElementBase *X3DImporter::MACRO_USE_CHECKANDAPPLY(XmlNode &node, std::string pDEF, std::string pUSE, X3DElemType pType, X3DNodeElementBase *pNE) { +inline X3DNodeElementBase *X3DImporter::MACRO_USE_CHECKANDAPPLY(XmlNode &node, const std::string &pDEF, const std::string &pUSE, X3DElemType pType, X3DNodeElementBase *pNE) { checkNodeMustBeEmpty(node); if (!pDEF.empty()) Assimp::Throw_DEF_And_USE(node.name()); diff --git a/code/AssetLib/glTF/glTFAsset.h b/code/AssetLib/glTF/glTFAsset.h index 1b4faa9f6..a599cd5fa 100644 --- a/code/AssetLib/glTF/glTFAsset.h +++ b/code/AssetLib/glTF/glTFAsset.h @@ -314,7 +314,7 @@ struct Object { virtual bool IsSpecial() const { return false; } Object() = default; - virtual ~Object() {} + virtual ~Object() = default; //! Maps special IDs to another ID, where needed. Subclasses may override it (statically) static const char *TranslateId(Asset & /*r*/, const char *id) { return id; } @@ -666,7 +666,7 @@ struct Mesh : public Object { std::vector primitives; std::list Extension; ///< List of extensions used in mesh. - Mesh() {} + Mesh() = default; /// Destructor. ~Mesh() { @@ -706,12 +706,12 @@ struct Node : public Object { Ref parent; //!< This is not part of the glTF specification. Used as a helper. - Node() {} + Node() = default; void Read(Value &obj, Asset &r); }; struct Program : public Object { - Program() {} + Program() = default; void Read(Value &obj, Asset &r); }; @@ -830,7 +830,7 @@ struct Animation : public Object { //! Base class for LazyDict that acts as an interface class LazyDictBase { public: - virtual ~LazyDictBase() {} + virtual ~LazyDictBase() = default; virtual void AttachToDocument(Document &doc) = 0; virtual void DetachFromDocument() = 0; diff --git a/code/AssetLib/glTF2/glTF2Asset.h b/code/AssetLib/glTF2/glTF2Asset.h index 44ab6c9c8..3becc4d9b 100644 --- a/code/AssetLib/glTF2/glTF2Asset.h +++ b/code/AssetLib/glTF2/glTF2Asset.h @@ -391,7 +391,7 @@ struct Object { //! Objects marked as special are not exported (used to emulate the binary body buffer) virtual bool IsSpecial() const { return false; } - virtual ~Object() {} + virtual ~Object() = default; //! Maps special IDs to another ID, where needed. Subclasses may override it (statically) static const char *TranslateId(Asset & /*r*/, const char *id) { return id; } @@ -613,7 +613,7 @@ struct Accessor : public Object { return Indexer(*this); } - Accessor() {} + Accessor() = default; void Read(Value &obj, Asset &r); //sparse @@ -681,7 +681,7 @@ struct Light : public Object { float innerConeAngle; float outerConeAngle; - Light() {} + Light() = default; void Read(Value &obj, Asset &r); }; @@ -877,7 +877,7 @@ struct Mesh : public Object { std::vector weights; std::vector targetNames; - Mesh() {} + Mesh() = default; /// Get mesh data from JSON-object and place them to root asset. /// \param [in] pJSON_Object - reference to pJSON-object from which data are read. @@ -903,12 +903,12 @@ struct Node : public Object { Ref parent; //!< This is not part of the glTF specification. Used as a helper. - Node() {} + Node() = default; void Read(Value &obj, Asset &r); }; struct Program : public Object { - Program() {} + Program() = default; void Read(Value &obj, Asset &r); }; @@ -927,12 +927,12 @@ struct Scene : public Object { std::string name; std::vector> nodes; - Scene() {} + Scene() = default; void Read(Value &obj, Asset &r); }; struct Shader : public Object { - Shader() {} + Shader() = default; void Read(Value &obj, Asset &r); }; @@ -942,7 +942,7 @@ struct Skin : public Object { std::vector> jointNames; //!< Joint names of the joints (nodes with a jointName property) in this skin. std::string name; //!< The user-defined name of this object. - Skin() {} + Skin() = default; void Read(Value &obj, Asset &r); }; @@ -957,7 +957,7 @@ struct Texture : public Object { //TextureTarget target; //!< The target that the WebGL texture should be bound to. (default: TextureTarget_TEXTURE_2D) //TextureType type; //!< Texel datatype. (default: TextureType_UNSIGNED_BYTE) - Texture() {} + Texture() = default; void Read(Value &obj, Asset &r); }; @@ -990,14 +990,14 @@ struct Animation : public Object { std::vector samplers; //!< All the key-frame data for this animation. std::vector channels; //!< Data to connect nodes to key-frames. - Animation() {} + Animation() = default; void Read(Value &obj, Asset &r); }; //! Base class for LazyDict that acts as an interface class LazyDictBase { public: - virtual ~LazyDictBase() {} + virtual ~LazyDictBase() = default; virtual void AttachToDocument(Document &doc) = 0; virtual void DetachFromDocument() = 0; diff --git a/code/Common/BaseProcess.h b/code/Common/BaseProcess.h index b6b1e1144..d2af4faa6 100644 --- a/code/Common/BaseProcess.h +++ b/code/Common/BaseProcess.h @@ -63,7 +63,7 @@ class Importer; class SharedPostProcessInfo { public: struct Base { - virtual ~Base() {} + virtual ~Base() = default; }; //! Represents data that is allocated on the heap, thus needs to be deleted @@ -84,7 +84,7 @@ public: explicit TStaticData(T in) : data(in) {} - ~TStaticData() {} + ~TStaticData() = default; T data; }; diff --git a/include/assimp/IOStream.hpp b/include/assimp/IOStream.hpp index 5e19f5176..3b9b3c3f8 100644 --- a/include/assimp/IOStream.hpp +++ b/include/assimp/IOStream.hpp @@ -134,9 +134,7 @@ IOStream::IOStream() AI_NO_EXCEPT { // ---------------------------------------------------------------------------------- AI_FORCE_INLINE -IOStream::~IOStream() { - // empty -} +IOStream::~IOStream() = default; // ---------------------------------------------------------------------------------- } //!namespace Assimp diff --git a/include/assimp/Logger.hpp b/include/assimp/Logger.hpp index 54fd5d03d..e8df64dd8 100644 --- a/include/assimp/Logger.hpp +++ b/include/assimp/Logger.hpp @@ -263,9 +263,7 @@ inline Logger::Logger() AI_NO_EXCEPT : } // ---------------------------------------------------------------------------------- -inline Logger::~Logger() { - // empty -} +inline Logger::~Logger() = default; // ---------------------------------------------------------------------------------- inline Logger::Logger(LogSeverity severity) : diff --git a/include/assimp/Subdivision.h b/include/assimp/Subdivision.h index 9dfb38901..114120368 100644 --- a/include/assimp/Subdivision.h +++ b/include/assimp/Subdivision.h @@ -122,10 +122,7 @@ public: }; -inline -Subdivider::~Subdivider() { - // empty -} +inline Subdivider::~Subdivider() = default; } // end namespace Assimp diff --git a/test/unit/UTLogStream.h b/test/unit/UTLogStream.h index 70cb3f801..6e5d75762 100644 --- a/test/unit/UTLogStream.h +++ b/test/unit/UTLogStream.h @@ -56,7 +56,7 @@ public: virtual void write(const char* message) { if ( nullptr != message ) { - m_messages.push_back( std::string( message ) ); + m_messages.emplace_back(message); } }