From 8aff4a750351b609dfab12dcb550651777957d1b Mon Sep 17 00:00:00 2001 From: berniev Date: Mon, 1 Aug 2022 13:56:03 +1000 Subject: [PATCH] Base: Modernise ctors dtors defs etc --- src/Base/Axis.cpp | 5 +- src/Base/Axis.h | 2 +- src/Base/BaseClass.cpp | 9 +- src/Base/BindingManager.cpp | 4 +- src/Base/BoundBox.h | 4 +- src/Base/Builder3D.cpp | 4 +- src/Base/Console.cpp | 17 ++-- src/Base/ConsoleObserver.cpp | 4 +- src/Base/ConsoleObserver.h | 12 +-- src/Base/CoordinateSystem.cpp | 4 +- src/Base/Debugger.cpp | 4 +- src/Base/Debugger.h | 4 +- src/Base/DualNumber.h | 2 +- src/Base/DualQuaternion.h | 2 +- src/Base/Exception.h | 72 +++++++-------- src/Base/ExceptionFactory.h | 6 +- src/Base/Factory.h | 14 +-- src/Base/FileTemplate.cpp | 4 +- src/Base/FutureWatcherProgress.cpp | 4 +- src/Base/FutureWatcherProgress.h | 2 +- src/Base/GeometryPyCXX.cpp | 4 +- src/Base/GeometryPyCXX.h | 48 +++++----- src/Base/InputSource.cpp | 8 +- src/Base/InputSource.h | 12 +-- src/Base/Interpreter.cpp | 17 +--- src/Base/Interpreter.h | 8 +- src/Base/Matrix.h | 2 +- src/Base/Observer.h | 6 +- src/Base/Parameter.cpp | 33 +++---- src/Base/Parameter.h | 6 +- src/Base/ParameterPy.cpp | 8 +- src/Base/Placement.cpp | 5 +- src/Base/Placement.h | 2 +- src/Base/Quantity.h | 2 +- src/Base/Reader.h | 28 +++--- src/Base/Sequencer.cpp | 8 +- src/Base/Sequencer.h | 12 +-- src/Base/Stream.cpp | 28 ++---- src/Base/Stream.h | 102 +++++++++++----------- src/Base/TimeInfo.cpp | 4 +- src/Base/Tools.h | 3 +- src/Base/Tools2D.h | 6 +- src/Base/Translate.cpp | 5 +- src/Base/Translate.h | 2 +- src/Base/Type.cpp | 4 +- src/Base/Unit.h | 2 +- src/Base/UnitsSchema.h | 2 +- src/Base/UnitsSchemaCentimeters.h | 2 +- src/Base/UnitsSchemaFemMilliMeterNewton.h | 2 +- src/Base/UnitsSchemaImperial1.h | 8 +- src/Base/UnitsSchemaInternal.h | 2 +- src/Base/UnitsSchemaMKS.h | 2 +- src/Base/UnitsSchemaMmMin.h | 2 +- src/Base/Uuid.cpp | 4 +- src/Base/ViewProj.h | 20 ++--- src/Base/Writer.cpp | 8 +- src/Base/Writer.h | 16 ++-- src/Base/XMLTools.h | 4 +- src/Base/fdstream.hpp | 8 +- src/Base/gzstream.h | 10 +-- 60 files changed, 271 insertions(+), 363 deletions(-) diff --git a/src/Base/Axis.cpp b/src/Base/Axis.cpp index e1a1438b22..0f4ac79bbf 100644 --- a/src/Base/Axis.cpp +++ b/src/Base/Axis.cpp @@ -26,10 +26,7 @@ using namespace Base; -Axis::Axis() -{ - -} +Axis::Axis() = default; Axis::Axis(const Axis& that) { diff --git a/src/Base/Axis.h b/src/Base/Axis.h index 74e2058f0b..4adf3d3944 100644 --- a/src/Base/Axis.h +++ b/src/Base/Axis.h @@ -40,7 +40,7 @@ public: Axis(const Axis&); Axis(const Vector3d& Orig, const Vector3d& Dir); /// Destruction - ~Axis () {} + ~Axis () = default; const Vector3d& getBase() const {return _base;} const Vector3d& getDirection() const {return _dir;} diff --git a/src/Base/BaseClass.cpp b/src/Base/BaseClass.cpp index a4bc2e4854..a734dfee9e 100644 --- a/src/Base/BaseClass.cpp +++ b/src/Base/BaseClass.cpp @@ -42,18 +42,13 @@ Type BaseClass::classTypeId = Base::Type::badType(); * A constructor. * A more elaborate description of the constructor. */ -BaseClass::BaseClass() -{ - -} +BaseClass::BaseClass() = default; /** * A destructor. * A more elaborate description of the destructor. */ -BaseClass::~BaseClass() -{ -} +BaseClass::~BaseClass() = default; //************************************************************************** diff --git a/src/Base/BindingManager.cpp b/src/Base/BindingManager.cpp index fa7cd4ed9c..1b3c34363d 100644 --- a/src/Base/BindingManager.cpp +++ b/src/Base/BindingManager.cpp @@ -74,9 +74,7 @@ BindingManager::BindingManager() { } -BindingManager::~BindingManager() -{ -} +BindingManager::~BindingManager() = default; bool BindingManager::hasWrapper(const void *cptr) { diff --git a/src/Base/BoundBox.h b/src/Base/BoundBox.h index c589fc9b1e..9d26961067 100644 --- a/src/Base/BoundBox.h +++ b/src/Base/BoundBox.h @@ -263,9 +263,7 @@ inline BoundBox3<_Precision>::BoundBox3 (const Vector3<_Precision> &rcVector, _P } template -inline BoundBox3<_Precision>::~BoundBox3 () -{ -} +inline BoundBox3<_Precision>::~BoundBox3 () = default; template inline BoundBox3<_Precision>& BoundBox3<_Precision>::operator = (const BoundBox3<_Precision> &rcBound) diff --git a/src/Base/Builder3D.cpp b/src/Base/Builder3D.cpp index feb65d6a5e..3563afa8b9 100644 --- a/src/Base/Builder3D.cpp +++ b/src/Base/Builder3D.cpp @@ -57,9 +57,7 @@ Builder3D::Builder3D() * A destructor. * A more elaborate description of the destructor. */ -Builder3D::~Builder3D() -{ -} +Builder3D::~Builder3D() = default; //************************************************************************** diff --git a/src/Base/Console.cpp b/src/Base/Console.cpp index 8dd495625c..82a3c32188 100644 --- a/src/Base/Console.cpp +++ b/src/Base/Console.cpp @@ -55,9 +55,7 @@ public: : QEvent(QEvent::User), msgtype(type), msg(msg) { } - ~ConsoleEvent() - { - } + ~ConsoleEvent() override = default; }; class ConsoleOutput : public QObject // clazy:exclude=missing-qobject-macro @@ -73,7 +71,7 @@ public: instance = nullptr; } - void customEvent(QEvent* ev) { + void customEvent(QEvent* ev) override { if (ev->type() == QEvent::User) { ConsoleEvent* ce = static_cast(ev); switch (ce->msgtype) { @@ -94,12 +92,8 @@ public: } private: - ConsoleOutput() - { - } - ~ConsoleOutput() - { - } + ConsoleOutput() = default; + ~ConsoleOutput() override = default; static ConsoleOutput* instance; }; @@ -619,5 +613,4 @@ PyObject *ConsoleSingleton::sPyGetObservers(PyObject * /*self*/, PyObject *args) PY_CATCH } -Base::ILogger::~ILogger() -{} +Base::ILogger::~ILogger() = default; diff --git a/src/Base/ConsoleObserver.cpp b/src/Base/ConsoleObserver.cpp index ac564779d3..fdc23f7167 100644 --- a/src/Base/ConsoleObserver.cpp +++ b/src/Base/ConsoleObserver.cpp @@ -91,9 +91,7 @@ ConsoleObserverStd::ConsoleObserverStd() : bLog = false; } -ConsoleObserverStd::~ConsoleObserverStd() -{ -} +ConsoleObserverStd::~ConsoleObserverStd() = default; void ConsoleObserverStd::SendLog(const std::string& msg, LogStyle level) { diff --git a/src/Base/ConsoleObserver.h b/src/Base/ConsoleObserver.h index 9c64565ac9..41191d2f27 100644 --- a/src/Base/ConsoleObserver.h +++ b/src/Base/ConsoleObserver.h @@ -113,8 +113,8 @@ public: RedirectStdOutput(); protected: - int overflow(int c = EOF); - int sync(); + int overflow(int c = EOF) override; + int sync() override; private: std::string buffer; @@ -126,8 +126,8 @@ public: RedirectStdError(); protected: - int overflow(int c = EOF); - int sync(); + int overflow(int c = EOF) override; + int sync() override; private: std::string buffer; @@ -139,8 +139,8 @@ public: RedirectStdLog(); protected: - int overflow(int c = EOF); - int sync(); + int overflow(int c = EOF) override; + int sync() override; private: std::string buffer; diff --git a/src/Base/CoordinateSystem.cpp b/src/Base/CoordinateSystem.cpp index 7914335d99..f1f6c35f7f 100644 --- a/src/Base/CoordinateSystem.cpp +++ b/src/Base/CoordinateSystem.cpp @@ -35,9 +35,7 @@ CoordinateSystem::CoordinateSystem() { } -CoordinateSystem::~CoordinateSystem() -{ -} +CoordinateSystem::~CoordinateSystem() = default; void CoordinateSystem::setAxes(const Axis& v, const Vector3d& xd) { diff --git a/src/Base/Debugger.cpp b/src/Base/Debugger.cpp index 64de00c83e..6d1f987b22 100644 --- a/src/Base/Debugger.cpp +++ b/src/Base/Debugger.cpp @@ -38,9 +38,7 @@ Debugger::Debugger(QObject* parent) { } -Debugger::~Debugger() -{ -} +Debugger::~Debugger() = default; void Debugger::attach() { diff --git a/src/Base/Debugger.h b/src/Base/Debugger.h index b85a804eea..9f4b27a17b 100644 --- a/src/Base/Debugger.h +++ b/src/Base/Debugger.h @@ -59,11 +59,11 @@ class BaseExport Debugger : public QObject public: Debugger(QObject* parent=nullptr); - ~Debugger(); + ~Debugger() override; void attach(); void detach(); - bool eventFilter(QObject*, QEvent*); + bool eventFilter(QObject*, QEvent*) override; int exec(); public Q_SLOTS: diff --git a/src/Base/DualNumber.h b/src/Base/DualNumber.h index 48697e060f..206dae1f09 100644 --- a/src/Base/DualNumber.h +++ b/src/Base/DualNumber.h @@ -41,7 +41,7 @@ public: double re = 0.0; double du = 0.0; public: - DualNumber(){} + DualNumber() = default; DualNumber(double re, double du = 0.0) : re(re), du(du) {} diff --git a/src/Base/DualQuaternion.h b/src/Base/DualQuaternion.h index 6f4986a0f5..509a454af2 100644 --- a/src/Base/DualQuaternion.h +++ b/src/Base/DualQuaternion.h @@ -48,7 +48,7 @@ public: DualNumber w; public: ///default constructor: init with zeros - DualQuat(){} + DualQuat() = default; DualQuat(DualNumber x, DualNumber y, DualNumber z, DualNumber w) : x(x), y(y), z(z), w(w) {} DualQuat(double x,double y,double z,double w,double dx,double dy,double dz,double dw) diff --git a/src/Base/Exception.h b/src/Base/Exception.h index 044f11b935..6f678dd6b5 100644 --- a/src/Base/Exception.h +++ b/src/Base/Exception.h @@ -92,7 +92,7 @@ class BaseExport Exception : public BaseClass TYPESYSTEM_HEADER(); public: - virtual ~Exception() throw() {} + ~Exception() throw() override = default; Exception &operator=(const Exception &inst); @@ -121,9 +121,9 @@ public: inline void setReported(bool reported) { _isReported = reported; } /// returns a Python dictionary containing the exception data - virtual PyObject * getPyObject(); + PyObject * getPyObject() override; /// returns sets the exception data from a Python dictionary - virtual void setPyObject( PyObject * pydict); + void setPyObject( PyObject * pydict) override; /// returns the corresponding python exception type virtual PyObject * getPyExceptionType() const; @@ -165,7 +165,7 @@ public: AbortException(); /// Destruction - virtual ~AbortException() throw() {} + ~AbortException() throw() override = default; /// Description of the exception const char* what() const throw() override; /// returns the corresponding python exception type @@ -185,7 +185,7 @@ public: XMLBaseException(const std::string& sMessage); /// Destruction - virtual ~XMLBaseException() throw() {} + ~XMLBaseException() throw() override = default; PyObject * getPyExceptionType() const override; }; @@ -204,7 +204,7 @@ public: XMLParseException(); /// Destruction - virtual ~XMLParseException() throw() {} + ~XMLParseException() throw() override = default; /// Description of the exception const char* what() const throw() override; PyObject * getPyExceptionType() const override; @@ -225,7 +225,7 @@ public: XMLAttributeError(); /// Destruction - virtual ~XMLAttributeError() throw() {} + ~XMLAttributeError() throw() override = default; /// Description of the exception const char* what() const throw() override; PyObject * getPyExceptionType() const override; @@ -247,7 +247,7 @@ public: /// Construction FileException(const FileException &inst); /// Destruction - virtual ~FileException() throw() {} + ~FileException() throw() override = default; /// Assignment operator FileException &operator=(const FileException &inst); /// Description of the exception @@ -283,7 +283,7 @@ public: FileSystemError(const char * sMessage); FileSystemError(const std::string& sMessage); /// Destruction - virtual ~FileSystemError() throw() {} + ~FileSystemError() throw() override = default; PyObject * getPyExceptionType() const override; }; @@ -299,7 +299,7 @@ public: BadFormatError(const char * sMessage); BadFormatError(const std::string& sMessage); /// Destruction - virtual ~BadFormatError() throw() {} + ~BadFormatError() throw() override = default; PyObject * getPyExceptionType() const override; }; @@ -320,7 +320,7 @@ public: /// Construction MemoryException(const MemoryException &inst); /// Destruction - virtual ~MemoryException() throw() {} + ~MemoryException() throw() override = default; /// Assignment operator MemoryException &operator=(const MemoryException &inst); #if defined (__GNUC__) @@ -342,7 +342,7 @@ public: AccessViolation(const char * sMessage); AccessViolation(const std::string& sMessage); /// Destruction - virtual ~AccessViolation() throw() {} + ~AccessViolation() throw() override = default; PyObject * getPyExceptionType() const override; }; @@ -359,7 +359,7 @@ public: AbnormalProgramTermination(const char * sMessage); AbnormalProgramTermination(const std::string& sMessage); /// Destruction - virtual ~AbnormalProgramTermination() throw() {} + ~AbnormalProgramTermination() throw() override = default; PyObject * getPyExceptionType() const override; }; @@ -375,7 +375,7 @@ public: UnknownProgramOption(const char * sMessage); UnknownProgramOption(const std::string& sMessage); /// Destruction - virtual ~UnknownProgramOption() throw() {} + ~UnknownProgramOption() throw() override = default; PyObject * getPyExceptionType() const override; }; @@ -392,7 +392,7 @@ public: ProgramInformation(const std::string& sMessage); /// Destruction - virtual ~ProgramInformation() throw() {} + ~ProgramInformation() throw() override = default; }; /** @@ -407,7 +407,7 @@ public: TypeError(const char * sMessage); TypeError(const std::string& sMessage); /// Destruction - virtual ~TypeError() throw() {} + ~TypeError() throw() override = default; PyObject * getPyExceptionType() const override; }; @@ -423,7 +423,7 @@ public: ValueError(const char * sMessage); ValueError(const std::string& sMessage); /// Destruction - virtual ~ValueError() throw() {} + ~ValueError() throw() override = default; PyObject * getPyExceptionType() const override; }; @@ -439,7 +439,7 @@ public: IndexError(const char * sMessage); IndexError(const std::string& sMessage); /// Destruction - virtual ~IndexError() throw() {} + ~IndexError() throw() override = default; PyObject * getPyExceptionType() const override; }; @@ -451,7 +451,7 @@ public: NameError(const char * sMessage); NameError(const std::string& sMessage); /// Destruction - virtual ~NameError() throw() {} + ~NameError() throw() override = default; PyObject * getPyExceptionType() const override; }; @@ -463,7 +463,7 @@ public: ImportError(const char * sMessage); ImportError(const std::string& sMessage); /// Destruction - virtual ~ImportError() throw() {} + ~ImportError() throw() override = default; PyObject * getPyExceptionType() const override; }; @@ -479,7 +479,7 @@ public: AttributeError(const char * sMessage); AttributeError(const std::string& sMessage); /// Destruction - virtual ~AttributeError() throw() {} + ~AttributeError() throw() override = default; PyObject * getPyExceptionType() const override; }; @@ -495,7 +495,7 @@ public: RuntimeError(const char * sMessage); RuntimeError(const std::string& sMessage); /// Destruction - virtual ~RuntimeError() throw() {} + ~RuntimeError() throw() override = default; PyObject * getPyExceptionType() const override; }; @@ -511,8 +511,8 @@ public: BadGraphError(const char * sMessage); BadGraphError(const std::string& sMessage); /// Destruction - virtual ~BadGraphError() throw() {} - PyObject * getPyExceptionType() const; + ~BadGraphError() throw() override = default; + PyObject * getPyExceptionType() const override; }; /** @@ -527,7 +527,7 @@ public: NotImplementedError(const char * sMessage); NotImplementedError(const std::string& sMessage); /// Destruction - virtual ~NotImplementedError() throw() {} + ~NotImplementedError() throw() override = default; PyObject * getPyExceptionType() const override; }; @@ -543,7 +543,7 @@ public: ZeroDivisionError(const char * sMessage); ZeroDivisionError(const std::string& sMessage); /// Destruction - virtual ~ZeroDivisionError() throw() {} + ~ZeroDivisionError() throw() override = default; PyObject * getPyExceptionType() const override; }; @@ -559,7 +559,7 @@ public: ReferenceError(const char * sMessage); ReferenceError(const std::string& sMessage); /// Destruction - virtual ~ReferenceError() throw() {} + ~ReferenceError() throw() override = default; PyObject * getPyExceptionType() const override; }; @@ -576,7 +576,7 @@ public: ExpressionError(const char * sMessage); ExpressionError(const std::string& sMessage); /// Destruction - virtual ~ExpressionError() throw() {} + ~ExpressionError() throw() override = default; PyObject * getPyExceptionType() const override; }; @@ -592,7 +592,7 @@ public: ParserError(const char * sMessage); ParserError(const std::string& sMessage); /// Destruction - virtual ~ParserError() throw() {} + ~ParserError() throw() override = default; PyObject * getPyExceptionType() const override; }; @@ -608,7 +608,7 @@ public: UnicodeError(const char * sMessage); UnicodeError(const std::string& sMessage); /// Destruction - virtual ~UnicodeError() throw() {} + ~UnicodeError() throw() override = default; PyObject * getPyExceptionType() const override; }; @@ -624,7 +624,7 @@ public: OverflowError(const char * sMessage); OverflowError(const std::string& sMessage); /// Destruction - virtual ~OverflowError() throw() {} + ~OverflowError() throw() override = default; PyObject * getPyExceptionType() const override; }; @@ -640,7 +640,7 @@ public: UnderflowError(const char * sMessage); UnderflowError(const std::string& sMessage); /// Destruction - virtual ~UnderflowError() throw() {} + ~UnderflowError() throw() override = default; PyObject * getPyExceptionType() const override; }; @@ -656,7 +656,7 @@ public: UnitsMismatchError(const char * sMessage); UnitsMismatchError(const std::string& sMessage); /// Destruction - virtual ~UnitsMismatchError() throw() {} + ~UnitsMismatchError() throw() override = default; PyObject * getPyExceptionType() const override; }; @@ -673,8 +673,8 @@ public: CADKernelError(const char * sMessage); CADKernelError(const std::string& sMessage); /// Destruction - virtual ~CADKernelError() throw() {} - PyObject * getPyExceptionType() const; + ~CADKernelError() throw() override = default; + PyObject * getPyExceptionType() const override; }; /* The RestoreError can be used to try to do a best recovery effort when an error during restoring @@ -692,7 +692,7 @@ public: RestoreError(const char * sMessage); RestoreError(const std::string& sMessage); /// Destruction - virtual ~RestoreError() throw() {} + ~RestoreError() throw() override = default; PyObject * getPyExceptionType() const override; }; diff --git a/src/Base/ExceptionFactory.h b/src/Base/ExceptionFactory.h index 5eeedd4f63..c59b354246 100644 --- a/src/Base/ExceptionFactory.h +++ b/src/Base/ExceptionFactory.h @@ -40,7 +40,7 @@ class BaseExport AbstractExceptionProducer : public AbstractProducer public: AbstractExceptionProducer () = default; // just implement it - void* Produce () const { + void* Produce () const override { return nullptr; } virtual void raiseException(PyObject * pydict) const = 0; @@ -74,9 +74,9 @@ public: ExceptionFactory::Instance().AddProducer(typeid(CLASS).name(), this); } - virtual ~ExceptionProducer (){} + ~ExceptionProducer () override = default; - void raiseException(PyObject * pydict) const + void raiseException(PyObject * pydict) const override { CLASS c; c.setPyObject(pydict); diff --git a/src/Base/Factory.h b/src/Base/Factory.h index 9ae760c24c..035a78b173 100644 --- a/src/Base/Factory.h +++ b/src/Base/Factory.h @@ -40,8 +40,8 @@ namespace Base class BaseExport AbstractProducer { public: - AbstractProducer() {} - virtual ~AbstractProducer() {} + AbstractProducer() = default; + virtual ~AbstractProducer() = default; /// overwritten by a concrete producer to produce the needed object virtual void* Produce () const = 0; }; @@ -69,7 +69,7 @@ protected: void* Produce (const char* sClassName) const; std::map _mpcProducers; /// construction - Factory (){} + Factory () = default; /// destruction virtual ~Factory (); }; @@ -89,8 +89,8 @@ public: private: static ScriptFactorySingleton* _pcSingleton; - ScriptFactorySingleton(){} - ~ScriptFactorySingleton(){} + ScriptFactorySingleton() = default; + ~ScriptFactorySingleton() override = default; }; inline ScriptFactorySingleton& ScriptFactory() @@ -113,10 +113,10 @@ public: ScriptFactorySingleton::Instance().AddProducer(name, this); } - virtual ~ScriptProducer (){} + ~ScriptProducer () override = default; /// Produce an instance - virtual void* Produce () const + void* Produce () const override { return const_cast(mScript); } diff --git a/src/Base/FileTemplate.cpp b/src/Base/FileTemplate.cpp index ee4028e7a5..9114a6b800 100644 --- a/src/Base/FileTemplate.cpp +++ b/src/Base/FileTemplate.cpp @@ -48,9 +48,7 @@ ClassTemplate::ClassTemplate() * A destructor. * A more elaborate description of the destructor. */ -ClassTemplate::~ClassTemplate() -{ -} +ClassTemplate::~ClassTemplate() = default; //************************************************************************** diff --git a/src/Base/FutureWatcherProgress.cpp b/src/Base/FutureWatcherProgress.cpp index c151cd8924..574353893c 100644 --- a/src/Base/FutureWatcherProgress.cpp +++ b/src/Base/FutureWatcherProgress.cpp @@ -32,9 +32,7 @@ FutureWatcherProgress::FutureWatcherProgress(const char* text, unsigned int step { } -FutureWatcherProgress::~FutureWatcherProgress() -{ -} +FutureWatcherProgress::~FutureWatcherProgress() = default; void FutureWatcherProgress::progressValueChanged(int v) { diff --git a/src/Base/FutureWatcherProgress.h b/src/Base/FutureWatcherProgress.h index 86726fbf26..f2f802c23d 100644 --- a/src/Base/FutureWatcherProgress.h +++ b/src/Base/FutureWatcherProgress.h @@ -37,7 +37,7 @@ class BaseExport FutureWatcherProgress : public QObject public: FutureWatcherProgress(const char* text, unsigned int steps); - ~FutureWatcherProgress(); + ~FutureWatcherProgress() override; private Q_SLOTS: void progressValueChanged(int v); diff --git a/src/Base/GeometryPyCXX.cpp b/src/Base/GeometryPyCXX.cpp index 0d661489ec..67c5d374ce 100644 --- a/src/Base/GeometryPyCXX.cpp +++ b/src/Base/GeometryPyCXX.cpp @@ -133,9 +133,7 @@ Vector2dPy::Vector2dPy(Py::PythonClassInstance *self, Py::Tuple &args, Py::Dict v.y = y; } -Vector2dPy::~Vector2dPy() -{ -} +Vector2dPy::~Vector2dPy() = default; Py::Object Vector2dPy::repr() { diff --git a/src/Base/GeometryPyCXX.h b/src/Base/GeometryPyCXX.h index dcb3c51546..e530f64cef 100644 --- a/src/Base/GeometryPyCXX.h +++ b/src/Base/GeometryPyCXX.h @@ -58,12 +58,12 @@ public: static Py::PythonClassObject create(const Vector2d&); static Py::PythonClassObject create(double x, double y); Vector2dPy(Py::PythonClassInstance *self, Py::Tuple &args, Py::Dict &kwds); - virtual ~Vector2dPy(); + ~Vector2dPy() override; static void init_type(); - Py::Object getattro(const Py::String &name_); - int setattro(const Py::String &name_, const Py::Object &value); - virtual Py::Object repr(); + Py::Object getattro(const Py::String &name_) override; + int setattro(const Py::String &name_, const Py::Object &value) override; + Py::Object repr() override; inline const Vector2d& value() const { return v; } @@ -77,24 +77,24 @@ public: /** @name methods for group handling */ //@{ - virtual Py::Object number_negative(); - virtual Py::Object number_positive(); - virtual Py::Object number_absolute(); - virtual Py::Object number_invert(); - virtual Py::Object number_int(); - virtual Py::Object number_float(); - virtual Py::Object number_long(); - virtual Py::Object number_add( const Py::Object & ); - virtual Py::Object number_subtract( const Py::Object & ); - virtual Py::Object number_multiply( const Py::Object & ); - virtual Py::Object number_remainder( const Py::Object & ); - virtual Py::Object number_divmod( const Py::Object & ); - virtual Py::Object number_lshift( const Py::Object & ); - virtual Py::Object number_rshift( const Py::Object & ); - virtual Py::Object number_and( const Py::Object & ); - virtual Py::Object number_xor( const Py::Object & ); - virtual Py::Object number_or( const Py::Object & ); - virtual Py::Object number_power( const Py::Object &, const Py::Object & ); + Py::Object number_negative() override; + Py::Object number_positive() override; + Py::Object number_absolute() override; + Py::Object number_invert() override; + Py::Object number_int() override; + Py::Object number_float() override; + Py::Object number_long() override; + Py::Object number_add( const Py::Object & ) override; + Py::Object number_subtract( const Py::Object & ) override; + Py::Object number_multiply( const Py::Object & ) override; + Py::Object number_remainder( const Py::Object & ) override; + Py::Object number_divmod( const Py::Object & ) override; + Py::Object number_lshift( const Py::Object & ) override; + Py::Object number_rshift( const Py::Object & ) override; + Py::Object number_and( const Py::Object & ) override; + Py::Object number_xor( const Py::Object & ) override; + Py::Object number_or( const Py::Object & ) override; + Py::Object number_power( const Py::Object &, const Py::Object & ) override; //@} Py::Object isNull(const Py::Tuple&); @@ -144,7 +144,7 @@ public: explicit Vector (const Base::Vector3d&); explicit Vector (const Base::Vector3f&); - virtual bool accepts (PyObject *pyob) const; + bool accepts (PyObject *pyob) const override; Vector(const Object& other): Object(other.ptr()) { validate(); @@ -203,7 +203,7 @@ public: GeometryT(const Object& other): Object(other.ptr()) { validate(); } - virtual bool accepts (PyObject *pyob) const { + bool accepts (PyObject *pyob) const override { return pyob && Geometry_TypeCheck (pyob); } GeometryT& operator= (const Object& rhs) diff --git a/src/Base/InputSource.cpp b/src/Base/InputSource.cpp index da3f49af3a..6fad8cb739 100644 --- a/src/Base/InputSource.cpp +++ b/src/Base/InputSource.cpp @@ -44,9 +44,7 @@ StdInputStream::StdInputStream( std::istream& Stream, XERCES_CPP_NAMESPACE_QUALI } -StdInputStream::~StdInputStream() -{ -} +StdInputStream::~StdInputStream() = default; // --------------------------------------------------------------------------- @@ -135,9 +133,7 @@ StdInputSource::StdInputSource ( std::istream& Stream, const char* filePath, XER } -StdInputSource::~StdInputSource() -{ -} +StdInputSource::~StdInputSource() = default; // --------------------------------------------------------------------------- diff --git a/src/Base/InputSource.h b/src/Base/InputSource.h index 51e12a8421..e281c2ff6b 100644 --- a/src/Base/InputSource.h +++ b/src/Base/InputSource.h @@ -45,7 +45,7 @@ class BaseExport StdInputStream : public XERCES_CPP_NAMESPACE_QUALIFIER BinInput { public : StdInputStream ( std::istream& Stream, XERCES_CPP_NAMESPACE_QUALIFIER MemoryManager* const manager = XERCES_CPP_NAMESPACE_QUALIFIER XMLPlatformUtils::fgMemoryManager ); - virtual ~StdInputStream(); + ~StdInputStream() override; // ----------------------------------------------------------------------- // Implementation of the input stream interface @@ -54,9 +54,9 @@ public : virtual unsigned int curPos() const; virtual unsigned int readBytes( XMLByte* const toFill, const unsigned int maxToRead ); #else - virtual XMLFilePos curPos() const; - virtual XMLSize_t readBytes( XMLByte* const toFill, const XMLSize_t maxToRead ); - virtual const XMLCh* getContentType() const {return nullptr;} + XMLFilePos curPos() const override; + XMLSize_t readBytes( XMLByte* const toFill, const XMLSize_t maxToRead ) override; + const XMLCh* getContentType() const override {return nullptr;} #endif private : @@ -83,9 +83,9 @@ class BaseExport StdInputSource : public XERCES_CPP_NAMESPACE_QUALIFIER InputSou { public : StdInputSource ( std::istream& Stream, const char* filePath, XERCES_CPP_NAMESPACE_QUALIFIER MemoryManager* const manager = XERCES_CPP_NAMESPACE_QUALIFIER XMLPlatformUtils::fgMemoryManager ); - ~StdInputSource(); + ~StdInputSource() override; - virtual XERCES_CPP_NAMESPACE_QUALIFIER BinInputStream* makeStream() const; + XERCES_CPP_NAMESPACE_QUALIFIER BinInputStream* makeStream() const override; private: StdInputSource(const StdInputSource&); diff --git a/src/Base/Interpreter.cpp b/src/Base/Interpreter.cpp index 1a2b26e9fe..afe7601ad6 100644 --- a/src/Base/Interpreter.cpp +++ b/src/Base/Interpreter.cpp @@ -93,9 +93,7 @@ PyException::PyException() PyErr_Clear(); // must be called to keep Python interpreter in a valid state (Werner) } -PyException::~PyException() throw() -{ -} +PyException::~PyException() throw() = default; void PyException::ThrowException() { @@ -203,12 +201,8 @@ public: add_varargs_method("flush",&PythonStdOutput::flush,"flush()"); } - PythonStdOutput() - { - } - ~PythonStdOutput() - { - } + PythonStdOutput() = default; + ~PythonStdOutput() override = default; Py::Object write(const Py::Tuple&) { @@ -227,10 +221,7 @@ InterpreterSingleton::InterpreterSingleton() this->_global = nullptr; } -InterpreterSingleton::~InterpreterSingleton() -{ - -} +InterpreterSingleton::~InterpreterSingleton() = default; std::string InterpreterSingleton::runString(const char *sCmd) diff --git a/src/Base/Interpreter.h b/src/Base/Interpreter.h index 89a324d978..e875bc7ff1 100644 --- a/src/Base/Interpreter.h +++ b/src/Base/Interpreter.h @@ -93,7 +93,7 @@ public: /// constructor does the whole job PyException(); PyException(const Py::Object &obj); - ~PyException() throw(); + ~PyException() throw() override; void raiseException(); @@ -105,10 +105,10 @@ public: /// this function returns the stack trace const std::string &getStackTrace() const {return _stackTrace;} const std::string &getErrorType() const {return _errorType;} - virtual PyObject *getPyExceptionType() const override {return _exceptionType;} + PyObject *getPyExceptionType() const override {return _exceptionType;} void ReportException () const override; /// Sets the Python error indicator and an error message - virtual void setPyException() const override; + void setPyException() const override; protected: std::string _stackTrace; @@ -139,7 +139,7 @@ class BaseExport SystemExitException : public Exception { public: SystemExitException(); - virtual ~SystemExitException() throw() {} + ~SystemExitException() throw() override = default; long getExitCode() const { return _exitCode;} protected: diff --git a/src/Base/Matrix.h b/src/Base/Matrix.h index afcb95d0ed..20adfbc200 100644 --- a/src/Base/Matrix.h +++ b/src/Base/Matrix.h @@ -72,7 +72,7 @@ public: Matrix4D (const Vector3f& rclBase, const Vector3f& rclDir, float fAngle); Matrix4D (const Vector3d& rclBase, const Vector3d& rclDir, double fAngle); /// Destruction - ~Matrix4D () {} + ~Matrix4D () = default; /** @name Operators */ //@{ diff --git a/src/Base/Observer.h b/src/Base/Observer.h index 97bd4e464c..aa99d5b5cc 100644 --- a/src/Base/Observer.h +++ b/src/Base/Observer.h @@ -54,13 +54,13 @@ public: * A constructor. * No special function so far. */ - Observer(){} + Observer() = default; /** * A destructor. * No special function so far. */ - virtual ~Observer(){} + virtual ~Observer() = default; /** * This method need to be reimplemented from the concrete Observer @@ -108,7 +108,7 @@ public: * A constructor. * No special function so far. */ - Subject(){} + Subject() = default; /** * A destructor. diff --git a/src/Base/Parameter.cpp b/src/Base/Parameter.cpp index 1b13af39fe..f62e2b13da 100644 --- a/src/Base/Parameter.cpp +++ b/src/Base/Parameter.cpp @@ -84,17 +84,16 @@ public: fSawErrors(false) { } - ~DOMTreeErrorReporter() { - } + ~DOMTreeErrorReporter() override = default; // ----------------------------------------------------------------------- // Implementation of the error handler interface // ----------------------------------------------------------------------- - void warning(const SAXParseException& toCatch); - void error(const SAXParseException& toCatch); - void fatalError(const SAXParseException& toCatch); - void resetErrors(); + void warning(const SAXParseException& toCatch) override; + void error(const SAXParseException& toCatch) override; + void fatalError(const SAXParseException& toCatch) override; + void resetErrors() override; // ----------------------------------------------------------------------- // Getter methods @@ -156,20 +155,20 @@ public: //@{ /** @name Destructors */ - ~DOMPrintFilter() {} + ~DOMPrintFilter() override = default; //@{ /** @ interface from DOMWriterFilter */ - virtual FilterAction acceptNode(const XERCES_CPP_NAMESPACE_QUALIFIER DOMNode*) const; + FilterAction acceptNode(const XERCES_CPP_NAMESPACE_QUALIFIER DOMNode*) const override; //@{ - virtual ShowType getWhatToShow() const { + ShowType getWhatToShow() const override { return fWhatToShow; } private: // unimplemented copy ctor and assignment operator - DOMPrintFilter(const DOMPrintFilter&); + DOMPrintFilter(const DOMPrintFilter&) = delete; DOMPrintFilter & operator = (const DOMPrintFilter&); ShowType fWhatToShow; @@ -179,11 +178,11 @@ class DOMPrintErrorHandler : public DOMErrorHandler { public: - DOMPrintErrorHandler() {} - ~DOMPrintErrorHandler() {} + DOMPrintErrorHandler() = default; + ~DOMPrintErrorHandler() override = default; /** @name The error handler interface */ - bool handleError(const DOMError& domError); + bool handleError(const DOMError& domError) override; void resetErrors() {} private : @@ -222,9 +221,7 @@ ParameterGrp::ParameterGrp(XERCES_CPP_NAMESPACE_QUALIFIER DOMElement *GroupNode, /** Destruction * complete destruction of the object */ -ParameterGrp::~ParameterGrp() -{ -} +ParameterGrp::~ParameterGrp() = default; //************************************************************************** // Access methods @@ -1072,9 +1069,7 @@ ParameterSerializer::ParameterSerializer(const std::string& fn) { } -ParameterSerializer::~ParameterSerializer() -{ -} +ParameterSerializer::~ParameterSerializer() = default; void ParameterSerializer::SaveDocument(const ParameterManager& mgr) { diff --git a/src/Base/Parameter.h b/src/Base/Parameter.h index 8aa2ae55d1..481f4794ee 100644 --- a/src/Base/Parameter.h +++ b/src/Base/Parameter.h @@ -85,7 +85,7 @@ class ParameterManager; * and exporting groups of parameters and enables streaming * to a persistent medium via XML. * \par - * Its main task is making user parameter persistent, saving + * Its main task is making user parameter persistent, saving * last used values in dialog boxes, setting and retrieving all * kind of preferences and so on. * @see ParameterManager @@ -230,7 +230,7 @@ protected: /// constructor is protected (handle concept) ParameterGrp(XERCES_CPP_NAMESPACE_QUALIFIER DOMElement *GroupNode=nullptr,const char* sName=nullptr); /// destructor is protected (handle concept) - ~ParameterGrp(); + ~ParameterGrp() override; /// helper function for GetGroup Base::Reference _GetGroup(const char* Name); bool ShouldRemove() const; @@ -295,7 +295,7 @@ class BaseExport ParameterManager : public ParameterGrp { public: ParameterManager(); - ~ParameterManager(); + ~ParameterManager() override; static void Init(); static void Terminate(); diff --git a/src/Base/ParameterPy.cpp b/src/Base/ParameterPy.cpp index de7f17c2a1..d24d493306 100644 --- a/src/Base/ParameterPy.cpp +++ b/src/Base/ParameterPy.cpp @@ -52,12 +52,12 @@ public: { inst = obj; } - virtual ~ParameterGrpObserver() + ~ParameterGrpObserver() override { Base::PyGILStateLocker lock; inst = Py::None(); } - virtual void OnChange(ParameterGrp::SubjectType &rCaller,ParameterGrp::MessageType Reason) + void OnChange(ParameterGrp::SubjectType &rCaller,ParameterGrp::MessageType Reason) override { Base::PyGILStateLocker lock; try { @@ -93,9 +93,9 @@ public: static void init_type(); // announce properties and methods ParameterGrpPy(const Base::Reference &rcParamGrp); - ~ParameterGrpPy(); + ~ParameterGrpPy() override; - Py::Object repr(); + Py::Object repr() override; Py::Object getGroup(const Py::Tuple&); Py::Object getGroupName(const Py::Tuple&); diff --git a/src/Base/Placement.cpp b/src/Base/Placement.cpp index 0eaf2bc138..f6aac0d6f9 100644 --- a/src/Base/Placement.cpp +++ b/src/Base/Placement.cpp @@ -29,10 +29,7 @@ using namespace Base; -Placement::Placement() -{ - -} +Placement::Placement() = default; Placement::Placement(const Base::Matrix4D& matrix) { diff --git a/src/Base/Placement.h b/src/Base/Placement.h index 2020096214..2f3093d7b7 100644 --- a/src/Base/Placement.h +++ b/src/Base/Placement.h @@ -51,7 +51,7 @@ public: //@} /// Destruction - ~Placement () {} + ~Placement () = default; Matrix4D toMatrix() const; void fromMatrix(const Matrix4D& m); diff --git a/src/Base/Quantity.h b/src/Base/Quantity.h index fc941c9249..e10dfb489d 100644 --- a/src/Base/Quantity.h +++ b/src/Base/Quantity.h @@ -116,7 +116,7 @@ public: explicit Quantity(double value, const Unit& unit=Unit()); explicit Quantity(double value, const QString& unit); /// Destruction - ~Quantity () {} + ~Quantity () = default; /** Operators. */ //@{ diff --git a/src/Base/Reader.h b/src/Base/Reader.h index 0627e45628..c2788c0fe9 100644 --- a/src/Base/Reader.h +++ b/src/Base/Reader.h @@ -125,7 +125,7 @@ public: }; /// open the file and read the first element XMLReader(const char* FileName, std::istream&); - ~XMLReader(); + ~XMLReader() override; bool isValid() const { return _valid; } bool isVerbose() const { return _verbose; } @@ -223,28 +223,28 @@ protected: // ----------------------------------------------------------------------- /** @name Content handler */ //@{ - virtual void startDocument(); - virtual void endDocument(); - virtual void startElement(const XMLCh* const uri, const XMLCh* const localname, const XMLCh* const qname, const XERCES_CPP_NAMESPACE_QUALIFIER Attributes& attrs); - virtual void endElement (const XMLCh* const uri, const XMLCh *const localname, const XMLCh *const qname); + void startDocument() override; + void endDocument() override; + void startElement(const XMLCh* const uri, const XMLCh* const localname, const XMLCh* const qname, const XERCES_CPP_NAMESPACE_QUALIFIER Attributes& attrs) override; + void endElement (const XMLCh* const uri, const XMLCh *const localname, const XMLCh *const qname) override; #if (XERCES_VERSION_MAJOR == 2) virtual void characters (const XMLCh* const chars, const unsigned int length); virtual void ignorableWhitespace(const XMLCh* const chars, const unsigned int length); #else - virtual void characters (const XMLCh* const chars, const XMLSize_t length); - virtual void ignorableWhitespace(const XMLCh* const chars, const XMLSize_t length); + void characters (const XMLCh* const chars, const XMLSize_t length) override; + void ignorableWhitespace(const XMLCh* const chars, const XMLSize_t length) override; #endif //@} /** @name Lexical handler */ //@{ - virtual void startCDATA (); - virtual void endCDATA (); + void startCDATA () override; + void endCDATA () override; //@} /** @name Document handler */ //@{ - virtual void resetDocument(); + void resetDocument() override; //@} @@ -253,10 +253,10 @@ protected: // ----------------------------------------------------------------------- /** @name Error handler */ //@{ - void warning(const XERCES_CPP_NAMESPACE_QUALIFIER SAXParseException& exc); - void error(const XERCES_CPP_NAMESPACE_QUALIFIER SAXParseException& exc); - void fatalError(const XERCES_CPP_NAMESPACE_QUALIFIER SAXParseException& exc); - void resetErrors(); + void warning(const XERCES_CPP_NAMESPACE_QUALIFIER SAXParseException& exc) override; + void error(const XERCES_CPP_NAMESPACE_QUALIFIER SAXParseException& exc) override; + void fatalError(const XERCES_CPP_NAMESPACE_QUALIFIER SAXParseException& exc) override; + void resetErrors() override; //@} diff --git a/src/Base/Sequencer.cpp b/src/Base/Sequencer.cpp index 13b554cac9..9c0bace609 100644 --- a/src/Base/Sequencer.cpp +++ b/src/Base/Sequencer.cpp @@ -310,13 +310,9 @@ PyObject *ProgressIndicatorPy::PyMake(struct _typeobject *, PyObject *, PyObject return new ProgressIndicatorPy(); } -ProgressIndicatorPy::ProgressIndicatorPy() -{ -} +ProgressIndicatorPy::ProgressIndicatorPy() = default; -ProgressIndicatorPy::~ProgressIndicatorPy() -{ -} +ProgressIndicatorPy::~ProgressIndicatorPy() = default; Py::Object ProgressIndicatorPy::repr() { diff --git a/src/Base/Sequencer.h b/src/Base/Sequencer.h index 0b5e22f786..ae255e342d 100644 --- a/src/Base/Sequencer.h +++ b/src/Base/Sequencer.h @@ -269,15 +269,15 @@ public: protected: /** Starts the sequencer */ - void startStep(); + void startStep() override; /** Writes the current progress to the console window. */ - void nextStep(bool canAbort); + void nextStep(bool canAbort) override; private: /** Puts text to the console window */ - void setText (const char* pszTxt); + void setText (const char* pszTxt) override; /** Resets the sequencer */ - void resetData(); + void resetData() override; }; /** The SequencerLauncher class is provided for convenience. It allows you to run an instance of the @@ -390,9 +390,9 @@ public: static void init_type(); // announce properties and methods ProgressIndicatorPy(); - ~ProgressIndicatorPy(); + ~ProgressIndicatorPy() override; - Py::Object repr(); + Py::Object repr() override; Py::Object start(const Py::Tuple&); Py::Object next(const Py::Tuple&); diff --git a/src/Base/Stream.cpp b/src/Base/Stream.cpp index 134b0aa63e..c149dfafdb 100644 --- a/src/Base/Stream.cpp +++ b/src/Base/Stream.cpp @@ -44,9 +44,7 @@ Stream::Stream() : _swap(false) { } -Stream::~Stream() -{ -} +Stream::~Stream() = default; Stream::ByteOrder Stream::byteOrder() const { @@ -62,9 +60,7 @@ OutputStream::OutputStream(std::ostream &rout) : _out(rout) { } -OutputStream::~OutputStream() -{ -} +OutputStream::~OutputStream() = default; OutputStream& OutputStream::operator << (bool b) { @@ -144,9 +140,7 @@ InputStream::InputStream(std::istream &rin) : _in(rin) { } -InputStream::~InputStream() -{ -} +InputStream::~InputStream() = default; InputStream& InputStream::operator >> (bool& b) { @@ -297,9 +291,7 @@ ByteArrayIStreambuf::ByteArrayIStreambuf(const QByteArray& data) : _buffer(data) _cur = 0; } -ByteArrayIStreambuf::~ByteArrayIStreambuf() -{ -} +ByteArrayIStreambuf::~ByteArrayIStreambuf() = default; ByteArrayIStreambuf::int_type ByteArrayIStreambuf::underflow() { @@ -367,9 +359,7 @@ IODeviceOStreambuf::IODeviceOStreambuf(QIODevice* dev) : device(dev) { } -IODeviceOStreambuf::~IODeviceOStreambuf() -{ -} +IODeviceOStreambuf::~IODeviceOStreambuf() = default; std::streambuf::int_type IODeviceOStreambuf::overflow(std::streambuf::int_type c) @@ -433,9 +423,7 @@ IODeviceIStreambuf::IODeviceIStreambuf(QIODevice* dev) : device(dev), buffer{} buffer+pbSize); // end position } -IODeviceIStreambuf::~IODeviceIStreambuf() -{ -} +IODeviceIStreambuf::~IODeviceIStreambuf() = default; std::streambuf::int_type IODeviceIStreambuf::underflow() @@ -746,9 +734,7 @@ Streambuf::Streambuf(const std::string& data) _cur = _beg; } -Streambuf::~Streambuf() -{ -} +Streambuf::~Streambuf() = default; Streambuf::int_type Streambuf::underflow() { diff --git a/src/Base/Stream.h b/src/Base/Stream.h index 5ebba8999b..190cd8d2d7 100644 --- a/src/Base/Stream.h +++ b/src/Base/Stream.h @@ -67,7 +67,7 @@ class BaseExport OutputStream : public Stream { public: OutputStream(std::ostream &rout); - ~OutputStream(); + ~OutputStream() override; OutputStream& operator << (bool b); OutputStream& operator << (int8_t ch); @@ -97,7 +97,7 @@ class BaseExport InputStream : public Stream { public: InputStream(std::istream &rin); - ~InputStream(); + ~InputStream() override; InputStream& operator >> (bool& b); InputStream& operator >> (int8_t& ch); @@ -136,18 +136,18 @@ class BaseExport ByteArrayOStreambuf : public std::streambuf { public: explicit ByteArrayOStreambuf(QByteArray& ba); - ~ByteArrayOStreambuf(); + ~ByteArrayOStreambuf() override; protected: - virtual int_type overflow(std::streambuf::int_type v); - virtual std::streamsize xsputn (const char* s, std::streamsize num); - virtual pos_type seekoff(std::streambuf::off_type off, + int_type overflow(std::streambuf::int_type v) override; + std::streamsize xsputn (const char* s, std::streamsize num) override; + pos_type seekoff(std::streambuf::off_type off, std::ios_base::seekdir way, std::ios_base::openmode which = - std::ios::in | std::ios::out); - virtual pos_type seekpos(std::streambuf::pos_type sp, + std::ios::in | std::ios::out) override; + pos_type seekpos(std::streambuf::pos_type sp, std::ios_base::openmode which = - std::ios::in | std::ios::out); + std::ios::in | std::ios::out) override; private: ByteArrayOStreambuf(const ByteArrayOStreambuf&); @@ -166,20 +166,20 @@ class BaseExport ByteArrayIStreambuf : public std::streambuf { public: explicit ByteArrayIStreambuf(const QByteArray& buf); - ~ByteArrayIStreambuf(); + ~ByteArrayIStreambuf() override; protected: - virtual int_type uflow(); - virtual int_type underflow(); - virtual int_type pbackfail(int_type ch); - virtual std::streamsize showmanyc(); - virtual pos_type seekoff(std::streambuf::off_type off, + int_type uflow() override; + int_type underflow() override; + int_type pbackfail(int_type ch) override; + std::streamsize showmanyc() override; + pos_type seekoff(std::streambuf::off_type off, std::ios_base::seekdir way, std::ios_base::openmode which = - std::ios::in | std::ios::out); - virtual pos_type seekpos(std::streambuf::pos_type pos, + std::ios::in | std::ios::out) override; + pos_type seekpos(std::streambuf::pos_type pos, std::ios_base::openmode which = - std::ios::in | std::ios::out); + std::ios::in | std::ios::out) override; private: ByteArrayIStreambuf(const ByteArrayIStreambuf&); ByteArrayIStreambuf& operator=(const ByteArrayIStreambuf&); @@ -198,18 +198,18 @@ class BaseExport IODeviceOStreambuf : public std::streambuf { public: IODeviceOStreambuf(QIODevice* dev); - ~IODeviceOStreambuf(); + ~IODeviceOStreambuf() override; protected: - virtual int_type overflow(std::streambuf::int_type v); - virtual std::streamsize xsputn (const char* s, std::streamsize num); - virtual pos_type seekoff(std::streambuf::off_type off, + int_type overflow(std::streambuf::int_type v) override; + std::streamsize xsputn (const char* s, std::streamsize num) override; + pos_type seekoff(std::streambuf::off_type off, std::ios_base::seekdir way, std::ios_base::openmode which = - std::ios::in | std::ios::out); - virtual pos_type seekpos(std::streambuf::pos_type sp, + std::ios::in | std::ios::out) override; + pos_type seekpos(std::streambuf::pos_type sp, std::ios_base::openmode which = - std::ios::in | std::ios::out); + std::ios::in | std::ios::out) override; private: IODeviceOStreambuf(const IODeviceOStreambuf&); IODeviceOStreambuf& operator=(const IODeviceOStreambuf&); @@ -227,17 +227,17 @@ class BaseExport IODeviceIStreambuf : public std::streambuf { public: IODeviceIStreambuf(QIODevice* dev); - ~IODeviceIStreambuf(); + ~IODeviceIStreambuf() override; protected: - virtual int_type underflow(); - virtual pos_type seekoff(std::streambuf::off_type off, + int_type underflow() override; + pos_type seekoff(std::streambuf::off_type off, std::ios_base::seekdir way, std::ios_base::openmode which = - std::ios::in | std::ios::out); - virtual pos_type seekpos(std::streambuf::pos_type sp, + std::ios::in | std::ios::out) override; + pos_type seekpos(std::streambuf::pos_type sp, std::ios_base::openmode which = - std::ios::in | std::ios::out); + std::ios::in | std::ios::out) override; private: IODeviceIStreambuf(const IODeviceIStreambuf&); IODeviceIStreambuf& operator=(const IODeviceIStreambuf&); @@ -269,18 +269,18 @@ public: }; PyStreambuf(PyObject* o, std::size_t buf_size = 256, std::size_t put_back = 8); - virtual ~PyStreambuf(); + ~PyStreambuf() override; void setType(Type t) { type = t; } protected: - int_type underflow(); - int_type overflow(int_type c = EOF); - std::streamsize xsputn (const char* s, std::streamsize num); - int sync(); - pos_type seekoff(off_type offset, seekdir dir, openmode); - pos_type seekpos(pos_type offset, openmode mode); + int_type underflow() override; + int_type overflow(int_type c = EOF) override; + std::streamsize xsputn (const char* s, std::streamsize num) override; + int sync() override; + pos_type seekoff(off_type offset, seekdir dir, openmode) override; + pos_type seekpos(pos_type offset, openmode mode) override; private: bool flushBuffer(); @@ -301,20 +301,20 @@ class BaseExport Streambuf : public std::streambuf { public: explicit Streambuf(const std::string& data); - ~Streambuf(); + ~Streambuf() override; protected: - virtual int_type uflow(); - virtual int_type underflow(); - virtual int_type pbackfail(int_type ch); - virtual std::streamsize showmanyc(); - virtual pos_type seekoff(std::streambuf::off_type off, + int_type uflow() override; + int_type underflow() override; + int_type pbackfail(int_type ch) override; + std::streamsize showmanyc() override; + pos_type seekoff(std::streambuf::off_type off, std::ios_base::seekdir way, std::ios_base::openmode which = - std::ios::in | std::ios::out); - virtual pos_type seekpos(std::streambuf::pos_type pos, + std::ios::in | std::ios::out) override; + pos_type seekpos(std::streambuf::pos_type pos, std::ios_base::openmode which = - std::ios::in | std::ios::out); + std::ios::in | std::ios::out) override; private: Streambuf(const Streambuf&); @@ -348,9 +348,7 @@ public: #endif { } - virtual ~ofstream() - { - } + ~ofstream() override = default; }; /** @@ -371,9 +369,7 @@ public: #endif { } - virtual ~ifstream() - { - } + ~ifstream() override = default; }; } // namespace Base diff --git a/src/Base/TimeInfo.cpp b/src/Base/TimeInfo.cpp index f434d9b199..9ea9c49f0a 100644 --- a/src/Base/TimeInfo.cpp +++ b/src/Base/TimeInfo.cpp @@ -50,9 +50,7 @@ TimeInfo::TimeInfo() * A destructor. * A more elaborate description of the destructor. */ -TimeInfo::~TimeInfo() -{ -} +TimeInfo::~TimeInfo() = default; //************************************************************************** diff --git a/src/Base/Tools.h b/src/Base/Tools.h index c5a6826941..cacdd37eaf 100644 --- a/src/Base/Tools.h +++ b/src/Base/Tools.h @@ -236,8 +236,7 @@ class ConnectionBlocker { public: ConnectionBlocker(Connection& c) : blocker(c) { } - ~ConnectionBlocker() { - } + ~ConnectionBlocker() = default; }; // ---------------------------------------------------------------------------- diff --git a/src/Base/Tools2D.h b/src/Base/Tools2D.h index 3f49500228..d7c56fc649 100644 --- a/src/Base/Tools2D.h +++ b/src/Base/Tools2D.h @@ -139,7 +139,7 @@ class BaseExport Line2d public: Vector2d clV1, clV2; - Line2d () {} + Line2d () = default; inline Line2d (const Line2d &rclLine); inline Line2d (const Vector2d &rclV1, const Vector2d &rclV2); @@ -167,9 +167,9 @@ public: class BaseExport Polygon2d { public: - Polygon2d () {} + Polygon2d () = default; inline Polygon2d (const Polygon2d &rclPoly); - virtual ~Polygon2d () {} + virtual ~Polygon2d () = default; inline Polygon2d& operator = (const Polygon2d &rclP); diff --git a/src/Base/Translate.cpp b/src/Base/Translate.cpp index 0b95e2e204..9385257552 100644 --- a/src/Base/Translate.cpp +++ b/src/Base/Translate.cpp @@ -72,10 +72,7 @@ Translate::Translate() initialize("This module is the Translate module"); // register with Python } -Translate::~Translate() -{ - -} +Translate::~Translate() = default; Py::Object Translate::translate(const Py::Tuple& args) { diff --git a/src/Base/Translate.h b/src/Base/Translate.h index bb73095db8..4995689e01 100644 --- a/src/Base/Translate.h +++ b/src/Base/Translate.h @@ -40,7 +40,7 @@ class BaseExport Translate : public Py::ExtensionModule { public: Translate(); - virtual ~Translate(); + ~Translate() override; private: Py::Object translate(const Py::Tuple& args); diff --git a/src/Base/Type.cpp b/src/Base/Type.cpp index ef410857f9..f4c754b151 100644 --- a/src/Base/Type.cpp +++ b/src/Base/Type.cpp @@ -78,9 +78,7 @@ Type::Type(const Type& type) * A destructor. * A more elaborate description of the destructor. */ -Type::~Type() -{ -} +Type::~Type() = default; void *Type::createInstance() { diff --git a/src/Base/Unit.h b/src/Base/Unit.h index 162772e1d7..de865ac651 100644 --- a/src/Base/Unit.h +++ b/src/Base/Unit.h @@ -64,7 +64,7 @@ public: Unit(const Unit&); explicit Unit(const QString& expr); /// Destruction - ~Unit () {} + ~Unit () = default; /** Operators. */ diff --git a/src/Base/UnitsSchema.h b/src/Base/UnitsSchema.h index 020b323eac..112e82bb87 100644 --- a/src/Base/UnitsSchema.h +++ b/src/Base/UnitsSchema.h @@ -52,7 +52,7 @@ enum class UnitSystem { class UnitsSchema { public: - virtual ~UnitsSchema(){} + virtual ~UnitsSchema() = default; /** Gets called if this schema gets activated. * Here it's theoretically possible that you can change the static factors * for certain units (e.g. mi = 1,8km instead of mi=1.6km). diff --git a/src/Base/UnitsSchemaCentimeters.h b/src/Base/UnitsSchemaCentimeters.h index 415483b5e0..ea6ab8e043 100644 --- a/src/Base/UnitsSchemaCentimeters.h +++ b/src/Base/UnitsSchemaCentimeters.h @@ -36,7 +36,7 @@ namespace Base { class UnitsSchemaCentimeters: public UnitsSchema { public: - virtual QString schemaTranslate(const Base::Quantity& quant, double &factor, QString &unitString); + QString schemaTranslate(const Base::Quantity& quant, double &factor, QString &unitString) override; }; } // namespace Base diff --git a/src/Base/UnitsSchemaFemMilliMeterNewton.h b/src/Base/UnitsSchemaFemMilliMeterNewton.h index 677818c53d..c58de4b8e8 100644 --- a/src/Base/UnitsSchemaFemMilliMeterNewton.h +++ b/src/Base/UnitsSchemaFemMilliMeterNewton.h @@ -41,7 +41,7 @@ namespace Base { class UnitsSchemaFemMilliMeterNewton: public UnitsSchema { public: - virtual QString schemaTranslate(const Base::Quantity& quant, double &factor, QString &unitString); + QString schemaTranslate(const Base::Quantity& quant, double &factor, QString &unitString) override; }; diff --git a/src/Base/UnitsSchemaImperial1.h b/src/Base/UnitsSchemaImperial1.h index 90eccf7e81..35758f9360 100644 --- a/src/Base/UnitsSchemaImperial1.h +++ b/src/Base/UnitsSchemaImperial1.h @@ -40,7 +40,7 @@ class UnitsSchemaImperial1: public UnitsSchema public: //virtual void setSchemaUnits(void); //virtual void resetSchemaUnits(void); - virtual QString schemaTranslate(const Base::Quantity& quant, double &factor, QString &unitString); + QString schemaTranslate(const Base::Quantity& quant, double &factor, QString &unitString) override; }; /** The schema class for the imperial unit system @@ -52,7 +52,7 @@ class UnitsSchemaImperialDecimal: public UnitsSchema public: //virtual void setSchemaUnits(void); //virtual void resetSchemaUnits(void); - virtual QString schemaTranslate(const Base::Quantity& quant, double &factor, QString &unitString); + QString schemaTranslate(const Base::Quantity& quant, double &factor, QString &unitString) override; }; /** The schema class for the imperial unit system @@ -64,7 +64,7 @@ class UnitsSchemaImperialBuilding: public UnitsSchema public: //virtual void setSchemaUnits(void); //virtual void resetSchemaUnits(void); - virtual QString schemaTranslate(const Base::Quantity& quant, double &factor, QString &unitString); + QString schemaTranslate(const Base::Quantity& quant, double &factor, QString &unitString) override; }; /** The schema class for Civil Engineering in the imperial unit system @@ -76,7 +76,7 @@ class UnitsSchemaImperialCivil: public UnitsSchema public: //virtual void setSchemaUnits(void); //virtual void resetSchemaUnits(void); - virtual QString schemaTranslate(const Base::Quantity& quant, double &factor, QString &unitString); + QString schemaTranslate(const Base::Quantity& quant, double &factor, QString &unitString) override; }; diff --git a/src/Base/UnitsSchemaInternal.h b/src/Base/UnitsSchemaInternal.h index 2234de20a6..c555e58b8e 100644 --- a/src/Base/UnitsSchemaInternal.h +++ b/src/Base/UnitsSchemaInternal.h @@ -39,7 +39,7 @@ namespace Base { class UnitsSchemaInternal: public UnitsSchema { public: - virtual QString schemaTranslate(const Base::Quantity& quant, double &factor, QString &unitString); + QString schemaTranslate(const Base::Quantity& quant, double &factor, QString &unitString) override; }; diff --git a/src/Base/UnitsSchemaMKS.h b/src/Base/UnitsSchemaMKS.h index 87b88c5937..e36036de81 100644 --- a/src/Base/UnitsSchemaMKS.h +++ b/src/Base/UnitsSchemaMKS.h @@ -37,7 +37,7 @@ namespace Base { class UnitsSchemaMKS: public UnitsSchema { public: - virtual QString schemaTranslate(const Base::Quantity& quant, double &factor, QString &unitString); + QString schemaTranslate(const Base::Quantity& quant, double &factor, QString &unitString) override; }; diff --git a/src/Base/UnitsSchemaMmMin.h b/src/Base/UnitsSchemaMmMin.h index 9974aee4f7..c2c9901bc9 100644 --- a/src/Base/UnitsSchemaMmMin.h +++ b/src/Base/UnitsSchemaMmMin.h @@ -39,7 +39,7 @@ namespace Base { class UnitsSchemaMmMin: public UnitsSchema { public: - virtual QString schemaTranslate(const Base::Quantity& quant, double &factor, QString &unitString); + QString schemaTranslate(const Base::Quantity& quant, double &factor, QString &unitString) override; }; diff --git a/src/Base/Uuid.cpp b/src/Base/Uuid.cpp index 4968b6a328..1a800cb53f 100644 --- a/src/Base/Uuid.cpp +++ b/src/Base/Uuid.cpp @@ -51,9 +51,7 @@ Uuid::Uuid() * A destructor. * A more elaborate description of the destructor. */ -Uuid::~Uuid() -{ -} +Uuid::~Uuid() = default; //************************************************************************** //************************************************************************** diff --git a/src/Base/ViewProj.h b/src/Base/ViewProj.h index 36891f435c..cc78cd2054 100644 --- a/src/Base/ViewProj.h +++ b/src/Base/ViewProj.h @@ -78,12 +78,12 @@ class BaseExport ViewProjMatrix : public ViewProjMethod public: ViewProjMatrix (const Matrix4D &rclMtx); - Vector3f operator()(const Vector3f &rclPt) const; - Vector3d operator()(const Vector3d &rclPt) const; - Vector3f inverse (const Vector3f &rclPt) const; - Vector3d inverse (const Vector3d &rclPt) const; + Vector3f operator()(const Vector3f &rclPt) const override; + Vector3d operator()(const Vector3d &rclPt) const override; + Vector3f inverse (const Vector3f &rclPt) const override; + Vector3d inverse (const Vector3d &rclPt) const override; - Matrix4D getProjectionMatrix () const; + Matrix4D getProjectionMatrix () const override; protected: bool isOrthographic; @@ -101,12 +101,12 @@ class BaseExport ViewOrthoProjMatrix : public ViewProjMethod public: ViewOrthoProjMatrix (const Matrix4D &rclMtx); - Vector3f operator()(const Vector3f &rclPt) const; - Vector3d operator()(const Vector3d &rclPt) const; - Vector3f inverse (const Vector3f &rclPt) const; - Vector3d inverse (const Vector3d &rclPt) const; + Vector3f operator()(const Vector3f &rclPt) const override; + Vector3d operator()(const Vector3d &rclPt) const override; + Vector3f inverse (const Vector3f &rclPt) const override; + Vector3d inverse (const Vector3d &rclPt) const override; - Matrix4D getProjectionMatrix () const; + Matrix4D getProjectionMatrix () const override; protected: Matrix4D _clMtx, _clMtxInv; diff --git a/src/Base/Writer.cpp b/src/Base/Writer.cpp index f90b68c108..c93ec383bc 100644 --- a/src/Base/Writer.cpp +++ b/src/Base/Writer.cpp @@ -53,9 +53,7 @@ Writer::Writer() indBuf[0] = '\0'; } -Writer::~Writer() -{ -} +Writer::~Writer() = default; void Writer::insertAsciiFile(const char* FileName) { @@ -286,9 +284,7 @@ FileWriter::FileWriter(const char* DirName) : DirName(DirName) { } -FileWriter::~FileWriter() -{ -} +FileWriter::~FileWriter() = default; void FileWriter::putNextEntry(const char* file) { diff --git a/src/Base/Writer.h b/src/Base/Writer.h index b280c7804d..24771cf123 100644 --- a/src/Base/Writer.h +++ b/src/Base/Writer.h @@ -152,11 +152,11 @@ class BaseExport ZipWriter : public Writer public: ZipWriter(const char* FileName); ZipWriter(std::ostream&); - virtual ~ZipWriter(); + ~ZipWriter() override; - virtual void writeFiles(); + void writeFiles() override; - virtual std::ostream &Stream(){return ZipStream;} + std::ostream &Stream() override{return ZipStream;} void setComment(const char* str){ZipStream.setComment(str);} void setLevel(int level){ZipStream.setLevel( level );} @@ -176,9 +176,9 @@ class BaseExport StringWriter : public Writer { public: - virtual std::ostream &Stream(){return StrStream;} + std::ostream &Stream() override{return StrStream;} std::string getString() const {return StrStream.str();} - virtual void writeFiles(){} + void writeFiles() override{} private: std::stringstream StrStream; @@ -193,12 +193,12 @@ class BaseExport FileWriter : public Writer { public: FileWriter(const char* DirName); - virtual ~FileWriter(); + ~FileWriter() override; void putNextEntry(const char* file); - virtual void writeFiles(); + void writeFiles() override; - virtual std::ostream &Stream(){return FileStream;} + std::ostream &Stream() override{return FileStream;} void close() {FileStream.close();} /*! This method can be re-implemented in sub-classes to avoid diff --git a/src/Base/XMLTools.h b/src/Base/XMLTools.h index 9660379685..d0dc66c876 100644 --- a/src/Base/XMLTools.h +++ b/src/Base/XMLTools.h @@ -198,9 +198,7 @@ inline XUTF8Str::XUTF8Str(const char* const fromTranscode) str = XMLTools::toXMLString(fromTranscode); } -inline XUTF8Str::~XUTF8Str() -{ -} +inline XUTF8Str::~XUTF8Str() = default; // ----------------------------------------------------------------------- diff --git a/src/Base/fdstream.hpp b/src/Base/fdstream.hpp index 2deef38d24..bf6f6d29b4 100644 --- a/src/Base/fdstream.hpp +++ b/src/Base/fdstream.hpp @@ -62,7 +62,7 @@ class fdoutbuf : public std::streambuf { } protected: // write one character - virtual int_type overflow (int_type c) { + int_type overflow (int_type c) override { if (c != EOF) { char z = c; #ifdef _MSC_VER @@ -76,9 +76,9 @@ class fdoutbuf : public std::streambuf { return c; } // write multiple characters - virtual + std::streamsize xsputn (const char* s, - std::streamsize num) { + std::streamsize num) override { #ifdef _MSC_VER return _write(fd,s,num); #else @@ -129,7 +129,7 @@ class fdinbuf : public std::streambuf { protected: // insert new characters into the buffer - virtual int_type underflow () { + int_type underflow () override { #ifndef _MSC_VER using std::memcpy; #endif diff --git a/src/Base/gzstream.h b/src/Base/gzstream.h index 7a098d8bf6..eb2e75c19d 100644 --- a/src/Base/gzstream.h +++ b/src/Base/gzstream.h @@ -71,11 +71,11 @@ public: int is_open() { return opened; } gzstreambuf* open( const char* name, int open_mode, int comp); gzstreambuf* close(); - ~gzstreambuf() { close(); } + ~gzstreambuf() override { close(); } - virtual int overflow( int c = EOF); - virtual int underflow(); - virtual int sync(); + int overflow( int c = EOF) override; + int underflow() override; + int sync() override; }; class BaseExport gzstreambase : virtual public std::ios { @@ -84,7 +84,7 @@ protected: public: gzstreambase() { init(&buf); } gzstreambase( const char* name, int open_mode, int comp); - ~gzstreambase(); + ~gzstreambase() override; void open( const char* name, int open_mode, int comp); void close(); gzstreambuf* rdbuf() { return &buf; }