From 162f480c8455c9fb0be9f40485e964f013d2fe62 Mon Sep 17 00:00:00 2001 From: wmayer Date: Tue, 22 Aug 2023 11:06:53 +0200 Subject: [PATCH] Points: modernize C++: use equals default --- src/Mod/Points/App/AppPointsPy.cpp | 2 - src/Mod/Points/App/Points.cpp | 18 ++------ src/Mod/Points/App/Points.h | 10 ++--- src/Mod/Points/App/PointsAlgos.cpp | 51 +++------------------- src/Mod/Points/App/PointsAlgos.h | 7 --- src/Mod/Points/App/PointsFeature.cpp | 4 -- src/Mod/Points/App/PointsFeature.h | 1 - src/Mod/Points/App/PointsGrid.h | 2 +- src/Mod/Points/App/Properties.cpp | 30 ++----------- src/Mod/Points/App/Properties.h | 10 +---- src/Mod/Points/App/PropertyPointKernel.cpp | 4 -- src/Mod/Points/App/PropertyPointKernel.h | 1 - src/Mod/Points/App/Structured.cpp | 4 -- src/Mod/Points/App/Structured.h | 1 - src/Mod/Points/Gui/AppPointsGui.cpp | 4 -- src/Mod/Points/Gui/DlgPointsReadImp.cpp | 6 +-- src/Mod/Points/Gui/ViewProvider.h | 4 +- src/Mod/Points/Gui/Workbench.cpp | 8 +--- 18 files changed, 23 insertions(+), 144 deletions(-) diff --git a/src/Mod/Points/App/AppPointsPy.cpp b/src/Mod/Points/App/AppPointsPy.cpp index 9bd3d6d74a..c5508d4043 100644 --- a/src/Mod/Points/App/AppPointsPy.cpp +++ b/src/Mod/Points/App/AppPointsPy.cpp @@ -59,8 +59,6 @@ public: initialize("This module is the Points module."); // register with Python } - ~Module() override {} - private: std::tuple readE57Settings() const { diff --git a/src/Mod/Points/App/Points.cpp b/src/Mod/Points/App/Points.cpp index 3b84a64851..2ad629226e 100644 --- a/src/Mod/Points/App/Points.cpp +++ b/src/Mod/Points/App/Points.cpp @@ -259,23 +259,13 @@ PointKernel::const_point_iterator::const_point_iterator } PointKernel::const_point_iterator::const_point_iterator -(const PointKernel::const_point_iterator& fi) - : _kernel(fi._kernel), _point(fi._point), _p_it(fi._p_it) -{ -} +(const PointKernel::const_point_iterator& fi) = default; -//PointKernel::const_point_iterator::~const_point_iterator() -//{ -//} +PointKernel::const_point_iterator::~const_point_iterator() = default; PointKernel::const_point_iterator& -PointKernel::const_point_iterator::operator=(const PointKernel::const_point_iterator& pi) -{ - this->_kernel = pi._kernel; - this->_point = pi._point; - this->_p_it = pi._p_it; - return *this; -} +PointKernel::const_point_iterator::operator= +(const PointKernel::const_point_iterator& pi) = default; void PointKernel::const_point_iterator::dereference() { diff --git a/src/Mod/Points/App/Points.h b/src/Mod/Points/App/Points.h index 080bff5770..7dcd593339 100644 --- a/src/Mod/Points/App/Points.h +++ b/src/Mod/Points/App/Points.h @@ -52,17 +52,13 @@ public: using difference_type = std::vector::difference_type; using size_type = std::vector::size_type; - PointKernel() - { - } + PointKernel() = default; explicit PointKernel(size_type size) { resize(size); } PointKernel(const PointKernel&); - ~PointKernel() override - { - } + ~PointKernel() override = default; void operator = (const PointKernel&); @@ -153,7 +149,7 @@ public: const_point_iterator(const PointKernel*, std::vector::const_iterator index); const_point_iterator(const const_point_iterator& pi); - //~const_point_iterator(); + ~const_point_iterator(); const_point_iterator& operator=(const const_point_iterator& fi); const value_type& operator*(); diff --git a/src/Mod/Points/App/PointsAlgos.cpp b/src/Mod/Points/App/PointsAlgos.cpp index 470ddaf0d5..9204e299cd 100644 --- a/src/Mod/Points/App/PointsAlgos.cpp +++ b/src/Mod/Points/App/PointsAlgos.cpp @@ -124,9 +124,7 @@ Reader::Reader() height = 0; } -Reader::~Reader() -{ -} +Reader::~Reader() = default; void Reader::clear() { @@ -192,13 +190,7 @@ int Reader::getHeight() const // ---------------------------------------------------------------------------- -AscReader::AscReader() -{ -} - -AscReader::~AscReader() -{ -} +AscReader::AscReader() = default; void AscReader::read(const std::string& filename) { @@ -252,8 +244,7 @@ public: _end = data.size(); _cur = 0; } - ~DataStreambuf() override { - } + ~DataStreambuf() override = default; protected: int_type uflow() override { @@ -503,13 +494,7 @@ lzfDecompress (const void *const in_data, unsigned int in_len, } } -PlyReader::PlyReader() -{ -} - -PlyReader::~PlyReader() -{ -} +PlyReader::PlyReader() = default; void PlyReader::read(const std::string& filename) { @@ -948,13 +933,7 @@ void PlyReader::readBinary(bool swapByteOrder, // ---------------------------------------------------------------------------- -PcdReader::PcdReader() -{ -} - -PcdReader::~PcdReader() -{ -} +PcdReader::PcdReader() = default; void PcdReader::read(const std::string& filename) { @@ -1754,10 +1733,6 @@ E57Reader::E57Reader(const bool& Color, const bool& State, const float& Distance minDistance = Distance; } -E57Reader::~E57Reader() -{ -} - void E57Reader::read(const std::string& filename) { try { @@ -1784,9 +1759,7 @@ Writer::Writer(const PointKernel& p) : points(p) height = 1; } -Writer::~Writer() -{ -} +Writer::~Writer() = default; void Writer::setIntensities(const std::vector& i) { @@ -1824,10 +1797,6 @@ AscWriter::AscWriter(const PointKernel& p) : Writer(p) { } -AscWriter::~AscWriter() -{ -} - void AscWriter::write(const std::string& filename) { if (placement.isIdentity()) { @@ -1846,10 +1815,6 @@ PlyWriter::PlyWriter(const PointKernel& p) : Writer(p) { } -PlyWriter::~PlyWriter() -{ -} - void PlyWriter::write(const std::string& filename) { std::list properties; @@ -2005,10 +1970,6 @@ PcdWriter::PcdWriter(const PointKernel& p) : Writer(p) { } -PcdWriter::~PcdWriter() -{ -} - void PcdWriter::write(const std::string& filename) { std::list fields; diff --git a/src/Mod/Points/App/PointsAlgos.h b/src/Mod/Points/App/PointsAlgos.h index 19ad609a59..241cf175e1 100644 --- a/src/Mod/Points/App/PointsAlgos.h +++ b/src/Mod/Points/App/PointsAlgos.h @@ -77,7 +77,6 @@ class AscReader : public Reader { public: AscReader(); - ~AscReader() override; void read(const std::string& filename) override; }; @@ -85,7 +84,6 @@ class PlyReader : public Reader { public: PlyReader(); - ~PlyReader() override; void read(const std::string& filename) override; private: @@ -103,7 +101,6 @@ class PcdReader : public Reader { public: PcdReader(); - ~PcdReader() override; void read(const std::string& filename) override; private: @@ -120,7 +117,6 @@ class E57Reader : public Reader { public: E57Reader(const bool& Color, const bool& State, const float& Distance); - ~E57Reader() override; void read(const std::string& filename) override; protected: bool useColor, checkState; @@ -154,7 +150,6 @@ class AscWriter : public Writer { public: explicit AscWriter(const PointKernel&); - ~AscWriter() override; void write(const std::string& filename) override; }; @@ -162,7 +157,6 @@ class PlyWriter : public Writer { public: explicit PlyWriter(const PointKernel&); - ~PlyWriter() override; void write(const std::string& filename) override; }; @@ -170,7 +164,6 @@ class PcdWriter : public Writer { public: explicit PcdWriter(const PointKernel&); - ~PcdWriter() override; void write(const std::string& filename) override; }; diff --git a/src/Mod/Points/App/PointsFeature.cpp b/src/Mod/Points/App/PointsFeature.cpp index cb513e2220..ffb1ec73bb 100644 --- a/src/Mod/Points/App/PointsFeature.cpp +++ b/src/Mod/Points/App/PointsFeature.cpp @@ -42,10 +42,6 @@ Feature::Feature() ADD_PROPERTY(Points, (PointKernel())); } -Feature::~Feature() -{ -} - short Feature::mustExecute() const { return 0; diff --git a/src/Mod/Points/App/PointsFeature.h b/src/Mod/Points/App/PointsFeature.h index 5f5c1f07f9..3ccc82ffa0 100644 --- a/src/Mod/Points/App/PointsFeature.h +++ b/src/Mod/Points/App/PointsFeature.h @@ -55,7 +55,6 @@ class PointsExport Feature : public App::GeoFeature public: /// Constructor Feature(); - ~Feature() override; /** @name methods override Feature */ //@{ diff --git a/src/Mod/Points/App/PointsGrid.h b/src/Mod/Points/App/PointsGrid.h index a85fac5d03..1c4ed42717 100644 --- a/src/Mod/Points/App/PointsGrid.h +++ b/src/Mod/Points/App/PointsGrid.h @@ -62,7 +62,7 @@ public: /// Construction PointsGrid (const PointKernel &rclM, unsigned long ulX, unsigned long ulY, unsigned long ulZ); /// Destruction - virtual ~PointsGrid () { } + virtual ~PointsGrid () = default; //@} public: diff --git a/src/Mod/Points/App/Properties.cpp b/src/Mod/Points/App/Properties.cpp index a304e96839..93408b7363 100644 --- a/src/Mod/Points/App/Properties.cpp +++ b/src/Mod/Points/App/Properties.cpp @@ -51,15 +51,7 @@ TYPESYSTEM_SOURCE(Points::PropertyGreyValueList, App::PropertyLists) TYPESYSTEM_SOURCE(Points::PropertyNormalList, App::PropertyLists) TYPESYSTEM_SOURCE(Points::PropertyCurvatureList , App::PropertyLists) -PropertyGreyValueList::PropertyGreyValueList() -{ - -} - -PropertyGreyValueList::~PropertyGreyValueList() -{ - -} +PropertyGreyValueList::PropertyGreyValueList() = default; void PropertyGreyValueList::setSize(int newSize) { @@ -221,15 +213,7 @@ void PropertyGreyValueList::removeIndices( const std::vector& uIn setValues(remainValue); } -PropertyNormalList::PropertyNormalList() -{ - -} - -PropertyNormalList::~PropertyNormalList() -{ - -} +PropertyNormalList::PropertyNormalList() = default; void PropertyNormalList::setSize(int newSize) { @@ -433,15 +417,7 @@ void PropertyNormalList::removeIndices( const std::vector& uIndic setValues(remainValue); } -PropertyCurvatureList::PropertyCurvatureList() -{ - -} - -PropertyCurvatureList::~PropertyCurvatureList() -{ - -} +PropertyCurvatureList::PropertyCurvatureList() = default; void PropertyCurvatureList::setValue(const CurvatureInfo& lValue) { diff --git a/src/Mod/Points/App/Properties.h b/src/Mod/Points/App/Properties.h index fcc3cd044c..be9cc54112 100644 --- a/src/Mod/Points/App/Properties.h +++ b/src/Mod/Points/App/Properties.h @@ -43,12 +43,7 @@ class PointsExport PropertyGreyValue : public App::PropertyFloat TYPESYSTEM_HEADER_WITH_OVERRIDE(); public: - PropertyGreyValue() - { - } - ~PropertyGreyValue() override - { - } + PropertyGreyValue() = default; }; class PointsExport PropertyGreyValueList: public App::PropertyLists @@ -57,7 +52,6 @@ class PointsExport PropertyGreyValueList: public App::PropertyLists public: PropertyGreyValueList(); - ~PropertyGreyValueList() override; void setSize(int newSize) override; int getSize() const override; @@ -108,7 +102,6 @@ class PointsExport PropertyNormalList: public App::PropertyLists public: PropertyNormalList(); - ~PropertyNormalList() override; void setSize(int newSize) override; int getSize() const override; @@ -178,7 +171,6 @@ public: public: PropertyCurvatureList(); - ~PropertyCurvatureList() override; void setSize(int newSize) override { _lValueList.resize(newSize); diff --git a/src/Mod/Points/App/PropertyPointKernel.cpp b/src/Mod/Points/App/PropertyPointKernel.cpp index 75e21442a2..f87eeec0c9 100644 --- a/src/Mod/Points/App/PropertyPointKernel.cpp +++ b/src/Mod/Points/App/PropertyPointKernel.cpp @@ -45,10 +45,6 @@ PropertyPointKernel::PropertyPointKernel() } -PropertyPointKernel::~PropertyPointKernel() -{ -} - void PropertyPointKernel::setValue(const PointKernel& m) { aboutToSetValue(); diff --git a/src/Mod/Points/App/PropertyPointKernel.h b/src/Mod/Points/App/PropertyPointKernel.h index 415c3af34a..e1f055f768 100644 --- a/src/Mod/Points/App/PropertyPointKernel.h +++ b/src/Mod/Points/App/PropertyPointKernel.h @@ -37,7 +37,6 @@ class PointsExport PropertyPointKernel : public App::PropertyComplexGeoData public: PropertyPointKernel(); - ~PropertyPointKernel() override; /** @name Getter/setter */ //@{ diff --git a/src/Mod/Points/App/Structured.cpp b/src/Mod/Points/App/Structured.cpp index 2b48373935..5f7f036831 100644 --- a/src/Mod/Points/App/Structured.cpp +++ b/src/Mod/Points/App/Structured.cpp @@ -70,10 +70,6 @@ Structured::Structured() //Height.setStatus(App::Property::ReadOnly, true); } -Structured::~Structured() -{ -} - App::DocumentObjectExecReturn *Structured::execute() { std::size_t size = Height.getValue() * Width.getValue(); diff --git a/src/Mod/Points/App/Structured.h b/src/Mod/Points/App/Structured.h index 236c511414..c388c8b34b 100644 --- a/src/Mod/Points/App/Structured.h +++ b/src/Mod/Points/App/Structured.h @@ -41,7 +41,6 @@ class PointsExport Structured : public Feature public: /// Constructor Structured(); - ~Structured() override; App::PropertyInteger Width; /**< The width of the structured cloud. */ App::PropertyInteger Height; /**< The height of the structured cloud. */ diff --git a/src/Mod/Points/Gui/AppPointsGui.cpp b/src/Mod/Points/Gui/AppPointsGui.cpp index 73c596a82d..f2ddcd41b7 100644 --- a/src/Mod/Points/Gui/AppPointsGui.cpp +++ b/src/Mod/Points/Gui/AppPointsGui.cpp @@ -52,10 +52,6 @@ public: { initialize("This module is the PointsGui module."); // register with Python } - - ~Module() override {} - -private: }; PyObject* initModule() diff --git a/src/Mod/Points/Gui/DlgPointsReadImp.cpp b/src/Mod/Points/Gui/DlgPointsReadImp.cpp index 14d55a6214..badb36b6ff 100644 --- a/src/Mod/Points/Gui/DlgPointsReadImp.cpp +++ b/src/Mod/Points/Gui/DlgPointsReadImp.cpp @@ -39,11 +39,7 @@ DlgPointsReadImp::DlgPointsReadImp(const char *FileName, QWidget* parent, Qt::W /* * Destroys the object and frees any allocated resources */ -DlgPointsReadImp::~DlgPointsReadImp() -{ - // no need to delete child widgets, Qt does it all for us -} - +DlgPointsReadImp::~DlgPointsReadImp() = default; #include "moc_DlgPointsReadImp.cpp" diff --git a/src/Mod/Points/Gui/ViewProvider.h b/src/Mod/Points/Gui/ViewProvider.h index fc782d5639..3ee49e304f 100644 --- a/src/Mod/Points/Gui/ViewProvider.h +++ b/src/Mod/Points/Gui/ViewProvider.h @@ -59,8 +59,8 @@ namespace PointsGui { class ViewProviderPointsBuilder : public Gui::ViewProviderBuilder { public: - ViewProviderPointsBuilder(){} - ~ViewProviderPointsBuilder() override{} + ViewProviderPointsBuilder() = default; + ~ViewProviderPointsBuilder() override = default; void buildNodes(const App::Property*, std::vector&) const override; void createPoints(const App::Property*, SoCoordinate3*, SoPointSet*) const; void createPoints(const App::Property*, SoCoordinate3*, SoIndexedPointSet*) const; diff --git a/src/Mod/Points/Gui/Workbench.cpp b/src/Mod/Points/Gui/Workbench.cpp index 7dd51ebdd3..cc84a176b1 100644 --- a/src/Mod/Points/Gui/Workbench.cpp +++ b/src/Mod/Points/Gui/Workbench.cpp @@ -38,13 +38,9 @@ using namespace PointsGui; /// @namespace PointsGui @class Workbench TYPESYSTEM_SOURCE(PointsGui::Workbench, Gui::StdWorkbench) -Workbench::Workbench() -{ -} +Workbench::Workbench() = default; -Workbench::~Workbench() -{ -} +Workbench::~Workbench() = default; Gui::ToolBarItem* Workbench::setupToolBars() const {