From 3e35b5f60618d623064ee2678965f0de8fa086eb Mon Sep 17 00:00:00 2001 From: wmayer Date: Sun, 20 Aug 2023 15:30:18 +0200 Subject: [PATCH] App: modernize C++: use equals default --- src/App/ColorModel.cpp | 26 -------------------------- src/App/ColorModel.h | 6 +++--- src/App/DocumentObserver.cpp | 5 +---- src/App/Extension.cpp | 4 ---- src/App/Extension.h | 2 +- src/App/Link.cpp | 11 +---------- src/App/Link.h | 4 ++-- src/App/Material.cpp | 4 ---- src/App/Material.h | 1 - src/App/MaterialObject.cpp | 4 ---- src/App/MaterialObject.h | 1 - src/App/PropertyExpressionEngine.h | 11 ++--------- 12 files changed, 10 insertions(+), 69 deletions(-) diff --git a/src/App/ColorModel.cpp b/src/App/ColorModel.cpp index 6af1a42ffd..4fdd3485f1 100644 --- a/src/App/ColorModel.cpp +++ b/src/App/ColorModel.cpp @@ -89,17 +89,6 @@ ColorField::ColorField (const ColorModel &rclModel, float fMin, float fMax, std: set(rclModel, fMin, fMax, usCt); } -ColorField::ColorField (const ColorField &rclCF) - : colorModel(rclCF.colorModel) - , fMin(rclCF.fMin) - , fMax(rclCF.fMax) - , fAscent(rclCF.fAscent) - , fConstant(rclCF.fConstant) - , ctColors(rclCF.ctColors) - , colorField(rclCF.colorField) -{ -} - ColorField& ColorField::operator = (const ColorField &rclCF) { colorField = rclCF.colorField; @@ -338,21 +327,6 @@ ColorLegend::ColorLegend () values.push_back(1.0f); } -ColorLegend::ColorLegend (const ColorLegend &rclCL) -{ - *this = rclCL; -} - -ColorLegend& ColorLegend::operator = (const ColorLegend &rclCL) -{ - colorFields = rclCL.colorFields; - names = rclCL.names; - values = rclCL.values; - outsideGrayed = rclCL.outsideGrayed; - - return *this; -} - bool ColorLegend::operator == (const ColorLegend &rclCL) const { return (colorFields.size() == rclCL.colorFields.size()) && diff --git a/src/App/ColorModel.h b/src/App/ColorModel.h index b38a79fb4b..36a55e1906 100644 --- a/src/App/ColorModel.h +++ b/src/App/ColorModel.h @@ -253,7 +253,7 @@ class AppExport ColorField { public: ColorField (); - ColorField (const ColorField &rclCF); + ColorField (const ColorField &rclCF) = default; ColorField (const ColorModel &rclModel, float fMin, float fMax, std::size_t usCt); virtual ~ColorField () = default; @@ -441,10 +441,10 @@ class AppExport ColorLegend { public: ColorLegend (); - ColorLegend (const ColorLegend &rclCL); + ColorLegend (const ColorLegend &rclCL) = default; virtual ~ColorLegend () = default; - ColorLegend& operator = (const ColorLegend &rclCL); + ColorLegend& operator = (const ColorLegend &rclCL) = default; bool operator == (const ColorLegend &rclCL) const; bool operator != (const ColorLegend &rclCL) const { return !(*this == rclCL); diff --git a/src/App/DocumentObserver.cpp b/src/App/DocumentObserver.cpp index e9a7edc3a0..49f32235c8 100644 --- a/src/App/DocumentObserver.cpp +++ b/src/App/DocumentObserver.cpp @@ -259,10 +259,7 @@ Property *DocumentObjectT::getProperty() const { SubObjectT::SubObjectT() = default; -SubObjectT::SubObjectT(const SubObjectT &other) - :DocumentObjectT(other), subname(other.subname) -{ -} +SubObjectT::SubObjectT(const SubObjectT &) = default; SubObjectT::SubObjectT(SubObjectT &&other) :DocumentObjectT(std::move(other)), subname(std::move(other.subname)) diff --git a/src/App/Extension.cpp b/src/App/Extension.cpp index 4b5cbc61ad..9a620004e2 100644 --- a/src/App/Extension.cpp +++ b/src/App/Extension.cpp @@ -53,10 +53,6 @@ void App::Extension::init(){ using namespace App; -Extension::Extension() -{ -} - Extension::~Extension() { if (!ExtensionPythonObject.is(Py::_None())){ diff --git a/src/App/Extension.h b/src/App/Extension.h index 79171b2071..10e54e4355 100644 --- a/src/App/Extension.h +++ b/src/App/Extension.h @@ -228,7 +228,7 @@ class AppExport Extension public: - Extension(); + Extension() = default; virtual ~Extension(); virtual void initExtension(App::ExtensionContainer* obj); diff --git a/src/App/Link.cpp b/src/App/Link.cpp index 183cbb5ecf..be3f53d835 100644 --- a/src/App/Link.cpp +++ b/src/App/Link.cpp @@ -81,8 +81,7 @@ public: } // Auto generated code. See class document of LinkParams. - ~LinkParamsP() override { - } + ~LinkParamsP() override = default; // Auto generated code. See class document of LinkParams. void OnChange(Base::Subject &, const char* sReason) override { @@ -162,10 +161,6 @@ LinkBaseExtension::LinkBaseExtension() props.resize(PropMax,nullptr); } -LinkBaseExtension::~LinkBaseExtension() -{ -} - PyObject* LinkBaseExtension::getExtensionPyObject() { if (ExtensionPythonObject.is(Py::_None())){ // ref counter is set to 1 @@ -2235,10 +2230,6 @@ LinkExtension::LinkExtension() LINK_PROPS_ADD_EXTENSION(LINK_PARAMS_EXT); } -LinkExtension::~LinkExtension() -{ -} - /////////////////////////////////////////////////////////////////////////////////////////// namespace App { diff --git a/src/App/Link.h b/src/App/Link.h index 37a9154d01..9e0ed2cafc 100644 --- a/src/App/Link.h +++ b/src/App/Link.h @@ -55,7 +55,7 @@ class AppExport LinkBaseExtension : public App::DocumentObjectExtension public: LinkBaseExtension(); - ~LinkBaseExtension() override; + ~LinkBaseExtension() override = default; PropertyBool _LinkTouched; PropertyInteger _LinkOwner; @@ -411,7 +411,7 @@ class AppExport LinkExtension : public LinkBaseExtension public: LinkExtension(); - ~LinkExtension() override; + ~LinkExtension() override = default; /** \name Helpers for defining extended parameter * diff --git a/src/App/Material.cpp b/src/App/Material.cpp index d45a628e31..3b5b95da1f 100644 --- a/src/App/Material.cpp +++ b/src/App/Material.cpp @@ -57,10 +57,6 @@ Material::Material(const MaterialType MatType) setType(MatType); } -Material::~Material() -{ -} - void Material::set(const char* MatName) { if (strcmp("Brass",MatName) == 0 ) { diff --git a/src/App/Material.h b/src/App/Material.h index c2e60a6753..fb4297257c 100644 --- a/src/App/Material.h +++ b/src/App/Material.h @@ -73,7 +73,6 @@ public: /** Does basically the same as the constructor above unless that it accepts a MaterialType as argument. */ explicit Material(const MaterialType MatType); //@} - ~Material(); /** Set a material by name * There are some standard materials defined which are: diff --git a/src/App/MaterialObject.cpp b/src/App/MaterialObject.cpp index 5a8bbb3f7e..60c4f2ee1e 100644 --- a/src/App/MaterialObject.cpp +++ b/src/App/MaterialObject.cpp @@ -37,10 +37,6 @@ MaterialObject::MaterialObject() } -MaterialObject::~MaterialObject() -{ -} - // Python feature --------------------------------------------------------- namespace App { diff --git a/src/App/MaterialObject.h b/src/App/MaterialObject.h index 8a1aafbf54..177a35764e 100644 --- a/src/App/MaterialObject.h +++ b/src/App/MaterialObject.h @@ -38,7 +38,6 @@ class AppExport MaterialObject : public DocumentObject public: /// Constructor MaterialObject(); - ~MaterialObject() override; App::PropertyMap Material; diff --git a/src/App/PropertyExpressionEngine.h b/src/App/PropertyExpressionEngine.h index 2689eb3303..9db884f1b6 100644 --- a/src/App/PropertyExpressionEngine.h +++ b/src/App/PropertyExpressionEngine.h @@ -92,16 +92,9 @@ public: this->busy = false; } - ExpressionInfo(const ExpressionInfo & other) { - expression = other.expression; - busy = other.busy; - } + ExpressionInfo(const ExpressionInfo &) = default; - ExpressionInfo & operator=(const ExpressionInfo & other) { - expression = other.expression; - busy = other.busy; - return *this; - } + ExpressionInfo & operator=(const ExpressionInfo &) = default; }; PropertyExpressionEngine();