diff --git a/src/Mod/Sketcher/App/Constraint.cpp b/src/Mod/Sketcher/App/Constraint.cpp index 02b798b3fb..f75920593f 100644 --- a/src/Mod/Sketcher/App/Constraint.cpp +++ b/src/Mod/Sketcher/App/Constraint.cpp @@ -74,30 +74,6 @@ Constraint::Constraint() tag = gen(); } -Constraint::Constraint(const Constraint& from) -: Value(from.Value), - Type(from.Type), - AlignmentType(from.AlignmentType), - Name(from.Name), - First(from.First), - FirstPos(from.FirstPos), - Second(from.Second), - SecondPos(from.SecondPos), - Third(from.Third), - ThirdPos(from.ThirdPos), - LabelDistance(from.LabelDistance), - LabelPosition(from.LabelPosition), - isDriving(from.isDriving), - InternalAlignmentIndex(from.InternalAlignmentIndex), - isInVirtualSpace(from.isInVirtualSpace), - tag(from.tag) -{ -} - -Constraint::~Constraint() -{ -} - Constraint *Constraint::clone(void) const { return new Constraint(*this); diff --git a/src/Mod/Sketcher/App/Constraint.h b/src/Mod/Sketcher/App/Constraint.h index d241ee1d0c..fd1da59f73 100644 --- a/src/Mod/Sketcher/App/Constraint.h +++ b/src/Mod/Sketcher/App/Constraint.h @@ -83,20 +83,30 @@ class SketcherExport Constraint : public Base::Persistence public: Constraint(); - Constraint(const Constraint&); - virtual ~Constraint(); - virtual Constraint *clone(void) const; // does copy the tag, it will be treated as a rename by the expression engine. - virtual Constraint *copy(void) const; // does not copy the tag, but generates a new one + // PVS V690: It is perfectly fine to use copy operator only internally + + // Constraints objects explicitly not copiable with standard methods + // Copy constructor is private for internal use only + Constraint &operator =(const Constraint &a) = delete; + + // Constraints objects explicitly not movable + Constraint(Constraint&&) = delete; + Constraint& operator=(Constraint&&) = delete; + + virtual ~Constraint() = default; + + Constraint *clone(void) const; // does copy the tag, it will be treated as a rename by the expression engine. + Constraint *copy(void) const; // does not copy the tag, but generates a new one static const int GeoUndef; // from base class - virtual unsigned int getMemSize(void) const; - virtual void Save(Base::Writer &/*writer*/) const; - virtual void Restore(Base::XMLReader &/*reader*/); + virtual unsigned int getMemSize(void) const override; + virtual void Save(Base::Writer &/*writer*/) const override; + virtual void Restore(Base::XMLReader &/*reader*/) override; + + virtual PyObject *getPyObject(void) override; - virtual PyObject *getPyObject(void); - Base::Quantity getPresentationValue() const; inline void setValue(double newValue) { Value = newValue; @@ -112,6 +122,9 @@ public: friend class PropertyConstraintList; +private: + Constraint(const Constraint&) = default; // only for internal use + private: double Value; public: @@ -127,7 +140,7 @@ public: float LabelDistance; float LabelPosition; bool isDriving; - int InternalAlignmentIndex; // Note: for InternalAlignment Type this index indexes equal internal geometry elements (e.g. index of pole in a bspline). It is not a GeoId!! + int InternalAlignmentIndex; // Note: for InternalAlignment Type this index indexes equal internal geometry elements (e.g. index of pole in a bspline). It is not a GeoId!! bool isInVirtualSpace; protected: