From: Benjamin Bihler Date: Mon, 25 Feb 2019 09:52:01 +0000 (+0300) Subject: 0030448: Coding - add typo detection to derivation creation methods using Standard_NO... X-Git-Tag: V7_4_0_beta~237 X-Git-Url: http://git.dev.opencascade.org/gitweb/?p=occt.git;a=commitdiff_plain;h=0be7dbe18320cd58be4ac0472ecfac9b473c6bf1 0030448: Coding - add typo detection to derivation creation methods using Standard_NODISCARD attribute Added macro Standard_NODISCARD equivalent to C++17 attribute [[nodiscard]] for compilers that support this. Using Standard_NODISCARD macro for methods that create new object in gp, math, Geom, Bnd packages. Marked equivalent operators with Standard_NODISCARD, if they are defined close to relevant methods. Corrected code where warnings on unused result of calls to methods creating new objects are generated. In most cases it looks like spelling errors (e.g. Normalised() instead of Normalise()) --- diff --git a/dox/resources/occt_rm.doxyfile b/dox/resources/occt_rm.doxyfile index 6f774779cc..a1d7281232 100644 --- a/dox/resources/occt_rm.doxyfile +++ b/dox/resources/occt_rm.doxyfile @@ -23,7 +23,7 @@ WARNINGS = NO ENABLE_PREPROCESSING = YES MACRO_EXPANSION = YES EXPAND_ONLY_PREDEF = YES -PREDEFINED = Standard_EXPORT Standard_OVERRIDE:=override __Standard_API __Draw_API Handle(a):=Handle DEFINE_STANDARD_ALLOC DEFINE_NCOLLECTION_ALLOC +PREDEFINED = Standard_EXPORT Standard_NODISCARD Standard_OVERRIDE:=override __Standard_API __Draw_API Handle(a):=Handle DEFINE_STANDARD_ALLOC DEFINE_NCOLLECTION_ALLOC GENERATE_HTML = YES GENERATE_LATEX = NO SEARCH_INCLUDES = YES diff --git a/src/Bnd/Bnd_B2d.hxx b/src/Bnd/Bnd_B2d.hxx index 9a9d783faf..6dfd2f7f0f 100644 --- a/src/Bnd/Bnd_B2d.hxx +++ b/src/Bnd/Bnd_B2d.hxx @@ -83,7 +83,7 @@ public: //! Transform the bounding box with the given transformation. //! The resulting box will be larger if theTrsf contains rotation. - Standard_EXPORT Bnd_B2d Transformed (const gp_Trsf2d& theTrsf) const; + Standard_EXPORT Standard_NODISCARD Bnd_B2d Transformed (const gp_Trsf2d& theTrsf) const; //! Check the given point for the inclusion in the Box. //! Returns True if the point is outside. diff --git a/src/Bnd/Bnd_B2f.hxx b/src/Bnd/Bnd_B2f.hxx index c2f03a2158..bf1acad00b 100644 --- a/src/Bnd/Bnd_B2f.hxx +++ b/src/Bnd/Bnd_B2f.hxx @@ -84,7 +84,7 @@ public: //! Transform the bounding box with the given transformation. //! The resulting box will be larger if theTrsf contains rotation. - Standard_EXPORT Bnd_B2f Transformed (const gp_Trsf2d& theTrsf) const; + Standard_EXPORT Standard_NODISCARD Bnd_B2f Transformed (const gp_Trsf2d& theTrsf) const; //! Check the given point for the inclusion in the Box. //! Returns True if the point is outside. diff --git a/src/Bnd/Bnd_B3d.hxx b/src/Bnd/Bnd_B3d.hxx index feab75b17b..5f72d6bb2c 100644 --- a/src/Bnd/Bnd_B3d.hxx +++ b/src/Bnd/Bnd_B3d.hxx @@ -84,7 +84,7 @@ public: //! Transform the bounding box with the given transformation. //! The resulting box will be larger if theTrsf contains rotation. - Standard_EXPORT Bnd_B3d Transformed (const gp_Trsf& theTrsf) const; + Standard_EXPORT Standard_NODISCARD Bnd_B3d Transformed (const gp_Trsf& theTrsf) const; //! Check the given point for the inclusion in the Box. //! Returns True if the point is outside. diff --git a/src/Bnd/Bnd_B3f.hxx b/src/Bnd/Bnd_B3f.hxx index f0a86a2438..e625ca33bd 100644 --- a/src/Bnd/Bnd_B3f.hxx +++ b/src/Bnd/Bnd_B3f.hxx @@ -85,7 +85,7 @@ public: //! Transform the bounding box with the given transformation. //! The resulting box will be larger if theTrsf contains rotation. - Standard_EXPORT Bnd_B3f Transformed (const gp_Trsf& theTrsf) const; + Standard_EXPORT Standard_NODISCARD Bnd_B3f Transformed (const gp_Trsf& theTrsf) const; //! Check the given point for the inclusion in the Box. //! Returns True if the point is outside. diff --git a/src/Bnd/Bnd_Box.hxx b/src/Bnd/Bnd_Box.hxx index 301d9ad72c..834338f5bf 100644 --- a/src/Bnd/Bnd_Box.hxx +++ b/src/Bnd/Bnd_Box.hxx @@ -213,7 +213,7 @@ public: //! Applying a geometric transformation (for example, a //! rotation) to a bounding box generally increases its //! dimensions. This is not optimal for algorithms which use it. - Standard_EXPORT Bnd_Box Transformed (const gp_Trsf& T) const; + Standard_EXPORT Standard_NODISCARD Bnd_Box Transformed (const gp_Trsf& T) const; //! Adds the box to . Standard_EXPORT void Add (const Bnd_Box& Other); diff --git a/src/Bnd/Bnd_Box2d.hxx b/src/Bnd/Bnd_Box2d.hxx index ac8af037c3..a7541f61ed 100644 --- a/src/Bnd/Bnd_Box2d.hxx +++ b/src/Bnd/Bnd_Box2d.hxx @@ -160,7 +160,7 @@ public: //! Applying a geometric transformation (for example, a //! rotation) to a bounding box generally increases its //! dimensions. This is not optimal for algorithms which use it. - Standard_EXPORT Bnd_Box2d Transformed (const gp_Trsf2d& T) const; + Standard_EXPORT Standard_NODISCARD Bnd_Box2d Transformed (const gp_Trsf2d& T) const; //! Adds the 2d box to . Standard_EXPORT void Add (const Bnd_Box2d& Other); diff --git a/src/ChFi3d/ChFi3d_Builder_2.cxx b/src/ChFi3d/ChFi3d_Builder_2.cxx index aac4206a57..f298d94ad2 100644 --- a/src/ChFi3d/ChFi3d_Builder_2.cxx +++ b/src/ChFi3d/ChFi3d_Builder_2.cxx @@ -851,7 +851,7 @@ void ChFi3d_Builder::StartSol(const Handle(ChFiDS_Stripe)& Stripe, PC->D1(woned, P1, derive); // There are ponts on the border, and internal points are found if (derive.Magnitude() > Precision::PConfusion()) { - derive.Normalized(); + derive.Normalize(); derive.Rotate(M_PI/2); AS.Initialize(f1); ResU = AS.UResolution(TolE); diff --git a/src/Contap/Contap_ArcFunction.cxx b/src/Contap/Contap_ArcFunction.cxx index df4ef249e1..d0b18fbb2c 100644 --- a/src/Contap/Contap_ArcFunction.cxx +++ b/src/Contap/Contap_ArcFunction.cxx @@ -128,7 +128,7 @@ Standard_Boolean Contap_ArcFunction::Derivative (const Standard_Real U, dnorm = d2uv.Crossed(d1v) + d1u.Crossed(d2v); dfv = (dnorm.Dot(myDir)-myCosAng*dnorm.Dot(norm))/myMean; */ - norm.Normalized(); + norm.Normalize(); dfu = (dnu.Dot(myDir)-myCosAng*dnu.Dot(norm))/myMean; dfv = (dnv.Dot(myDir)-myCosAng*dnv.Dot(norm))/myMean; } diff --git a/src/Extrema/Extrema_ExtPElS.cxx b/src/Extrema/Extrema_ExtPElS.cxx index d494bddbac..6b74541a1b 100644 --- a/src/Extrema/Extrema_ExtPElS.cxx +++ b/src/Extrema/Extrema_ExtPElS.cxx @@ -162,13 +162,14 @@ void Extrema_ExtPElS::Perform(const gp_Pnt& P, myDone = Standard_True; return; } - gp_Vec DirZ; - if (M.SquareDistance(O) reversed. - Standard_EXPORT Handle(Geom_Axis1Placement) Reversed() const; + Standard_EXPORT Standard_NODISCARD Handle(Geom_Axis1Placement) Reversed() const; //! Assigns V to the unit vector of this axis. Standard_EXPORT void SetDirection (const gp_Dir& V) Standard_OVERRIDE; diff --git a/src/Geom/Geom_Curve.hxx b/src/Geom/Geom_Curve.hxx index 4cacecc422..4ec6137d2c 100644 --- a/src/Geom/Geom_Curve.hxx +++ b/src/Geom/Geom_Curve.hxx @@ -117,7 +117,7 @@ public: Standard_EXPORT virtual Standard_Real ParametricTransformation (const gp_Trsf& T) const; //! Returns a copy of reversed. - Standard_EXPORT Handle(Geom_Curve) Reversed() const; + Standard_EXPORT Standard_NODISCARD Handle(Geom_Curve) Reversed() const; //! Returns the value of the first parameter. //! Warnings : diff --git a/src/Geom/Geom_Geometry.hxx b/src/Geom/Geom_Geometry.hxx index 217c3a38ad..4b6799a550 100644 --- a/src/Geom/Geom_Geometry.hxx +++ b/src/Geom/Geom_Geometry.hxx @@ -99,21 +99,21 @@ public: //! (see class Transformation of the package Geom). Standard_EXPORT virtual void Transform (const gp_Trsf& T) = 0; - Standard_EXPORT Handle(Geom_Geometry) Mirrored (const gp_Pnt& P) const; + Standard_EXPORT Standard_NODISCARD Handle(Geom_Geometry) Mirrored (const gp_Pnt& P) const; - Standard_EXPORT Handle(Geom_Geometry) Mirrored (const gp_Ax1& A1) const; + Standard_EXPORT Standard_NODISCARD Handle(Geom_Geometry) Mirrored (const gp_Ax1& A1) const; - Standard_EXPORT Handle(Geom_Geometry) Mirrored (const gp_Ax2& A2) const; + Standard_EXPORT Standard_NODISCARD Handle(Geom_Geometry) Mirrored (const gp_Ax2& A2) const; - Standard_EXPORT Handle(Geom_Geometry) Rotated (const gp_Ax1& A1, const Standard_Real Ang) const; + Standard_EXPORT Standard_NODISCARD Handle(Geom_Geometry) Rotated (const gp_Ax1& A1, const Standard_Real Ang) const; - Standard_EXPORT Handle(Geom_Geometry) Scaled (const gp_Pnt& P, const Standard_Real S) const; + Standard_EXPORT Standard_NODISCARD Handle(Geom_Geometry) Scaled (const gp_Pnt& P, const Standard_Real S) const; - Standard_EXPORT Handle(Geom_Geometry) Transformed (const gp_Trsf& T) const; + Standard_EXPORT Standard_NODISCARD Handle(Geom_Geometry) Transformed (const gp_Trsf& T) const; - Standard_EXPORT Handle(Geom_Geometry) Translated (const gp_Vec& V) const; + Standard_EXPORT Standard_NODISCARD Handle(Geom_Geometry) Translated (const gp_Vec& V) const; - Standard_EXPORT Handle(Geom_Geometry) Translated (const gp_Pnt& P1, const gp_Pnt& P2) const; + Standard_EXPORT Standard_NODISCARD Handle(Geom_Geometry) Translated (const gp_Pnt& P1, const gp_Pnt& P2) const; //! Creates a new object which is a copy of this geometric object. Standard_EXPORT virtual Handle(Geom_Geometry) Copy() const = 0; diff --git a/src/Geom/Geom_Surface.hxx b/src/Geom/Geom_Surface.hxx index 187c3b47d9..a9faaf6299 100644 --- a/src/Geom/Geom_Surface.hxx +++ b/src/Geom/Geom_Surface.hxx @@ -79,7 +79,7 @@ public: //! Reverses the U direction of parametrization of . //! The bounds of the surface are not modified. //! A copy of is returned. - Standard_EXPORT Handle(Geom_Surface) UReversed() const; + Standard_EXPORT Standard_NODISCARD Handle(Geom_Surface) UReversed() const; //! Returns the parameter on the Ureversed surface for //! the point of parameter U on . @@ -100,7 +100,7 @@ public: //! Reverses the V direction of parametrization of . //! The bounds of the surface are not modified. //! A copy of is returned. - Standard_EXPORT Handle(Geom_Surface) VReversed() const; + Standard_EXPORT Standard_NODISCARD Handle(Geom_Surface) VReversed() const; //! Returns the parameter on the Vreversed surface for //! the point of parameter V on . diff --git a/src/Geom/Geom_Transformation.hxx b/src/Geom/Geom_Transformation.hxx index 46e69c60a6..69c261a3ab 100644 --- a/src/Geom/Geom_Transformation.hxx +++ b/src/Geom/Geom_Transformation.hxx @@ -160,12 +160,12 @@ public: //! Raised if the the transformation is singular. This means that //! the ScaleFactor is lower or equal to Resolution from //! package gp. - Standard_EXPORT Handle(Geom_Transformation) Inverted() const; + Standard_EXPORT Standard_NODISCARD Handle(Geom_Transformation) Inverted() const; //! Computes the transformation composed with Other and . //! * Other. //! Returns a new transformation - Standard_EXPORT Handle(Geom_Transformation) Multiplied (const Handle(Geom_Transformation)& Other) const; + Standard_EXPORT Standard_NODISCARD Handle(Geom_Transformation) Multiplied (const Handle(Geom_Transformation)& Other) const; //! Computes the transformation composed with Other and . //! = * Other. diff --git a/src/Geom/Geom_Vector.hxx b/src/Geom/Geom_Vector.hxx index addc144111..1c45b0e006 100644 --- a/src/Geom/Geom_Vector.hxx +++ b/src/Geom/Geom_Vector.hxx @@ -47,7 +47,7 @@ public: //! Returns a copy of reversed. - Standard_EXPORT Handle(Geom_Vector) Reversed() const; + Standard_EXPORT Standard_NODISCARD Handle(Geom_Vector) Reversed() const; //! Computes the angular value, in radians, between this //! vector and vector Other. The result is a value between 0 and Pi. diff --git a/src/Geom/Geom_VectorWithMagnitude.hxx b/src/Geom/Geom_VectorWithMagnitude.hxx index a9c52eac07..bf8b57434a 100644 --- a/src/Geom/Geom_VectorWithMagnitude.hxx +++ b/src/Geom/Geom_VectorWithMagnitude.hxx @@ -80,7 +80,7 @@ public: //! Adds the vector Other to . - Standard_EXPORT Handle(Geom_VectorWithMagnitude) Added (const Handle(Geom_Vector)& Other) const; + Standard_EXPORT Standard_NODISCARD Handle(Geom_VectorWithMagnitude) Added (const Handle(Geom_Vector)& Other) const; //! Computes the cross product between and Other @@ -106,12 +106,12 @@ public: //! Divides by a scalar. A new vector is returned. - Standard_EXPORT Handle(Geom_VectorWithMagnitude) Divided (const Standard_Real Scalar) const; + Standard_EXPORT Standard_NODISCARD Handle(Geom_VectorWithMagnitude) Divided (const Standard_Real Scalar) const; //! Computes the product of the vector by a scalar. //! A new vector is returned. - Standard_EXPORT Handle(Geom_VectorWithMagnitude) Multiplied (const Standard_Real Scalar) const; + Standard_EXPORT Standard_NODISCARD Handle(Geom_VectorWithMagnitude) Multiplied (const Standard_Real Scalar) const; //! Computes the product of the vector by a scalar. @@ -127,14 +127,15 @@ public: //! //! Raised if the magnitude of the vector is lower or equal to //! Resolution from package gp. - Standard_EXPORT Handle(Geom_VectorWithMagnitude) Normalized() const; + Standard_EXPORT Standard_NODISCARD Handle(Geom_VectorWithMagnitude) Normalized() const; //! Subtracts the Vector Other to . Standard_EXPORT void Subtract (const Handle(Geom_Vector)& Other); //! Subtracts the vector Other to . A new vector is returned. - Standard_EXPORT Handle(Geom_VectorWithMagnitude) Subtracted (const Handle(Geom_Vector)& Other) const; + Standard_EXPORT Standard_NODISCARD + Handle(Geom_VectorWithMagnitude) Subtracted (const Handle(Geom_Vector)& Other) const; //! Applies the transformation T to this vector. Standard_EXPORT void Transform (const gp_Trsf& T) Standard_OVERRIDE; diff --git a/src/Geom2d/Geom2d_AxisPlacement.hxx b/src/Geom2d/Geom2d_AxisPlacement.hxx index 8055ec47c1..5a570c365d 100644 --- a/src/Geom2d/Geom2d_AxisPlacement.hxx +++ b/src/Geom2d/Geom2d_AxisPlacement.hxx @@ -64,7 +64,7 @@ public: //! Note: //! - Reverse assigns the result to this axis, while //! - Reversed creates a new one. - Standard_EXPORT Handle(Geom2d_AxisPlacement) Reversed() const; + Standard_EXPORT Standard_NODISCARD Handle(Geom2d_AxisPlacement) Reversed() const; //! Changes the complete definition of the axis placement. Standard_EXPORT void SetAxis (const gp_Ax2d& A); diff --git a/src/Geom2d/Geom2d_Curve.hxx b/src/Geom2d/Geom2d_Curve.hxx index 844993b2bb..f12036a659 100644 --- a/src/Geom2d/Geom2d_Curve.hxx +++ b/src/Geom2d/Geom2d_Curve.hxx @@ -110,7 +110,7 @@ public: //! - the end point of the initial curve becomes the start //! point of the reversed curve. //! - Reversed creates a new curve. - Standard_EXPORT Handle(Geom2d_Curve) Reversed() const; + Standard_EXPORT Standard_NODISCARD Handle(Geom2d_Curve) Reversed() const; //! Returns the value of the first parameter. //! Warnings : diff --git a/src/Geom2d/Geom2d_Geometry.hxx b/src/Geom2d/Geom2d_Geometry.hxx index 155854360d..b28d45359d 100644 --- a/src/Geom2d/Geom2d_Geometry.hxx +++ b/src/Geom2d/Geom2d_Geometry.hxx @@ -94,19 +94,19 @@ public: //! itself. A copy of the object is returned. Standard_EXPORT virtual void Transform (const gp_Trsf2d& T) = 0; - Standard_EXPORT Handle(Geom2d_Geometry) Mirrored (const gp_Pnt2d& P) const; + Standard_EXPORT Standard_NODISCARD Handle(Geom2d_Geometry) Mirrored (const gp_Pnt2d& P) const; - Standard_EXPORT Handle(Geom2d_Geometry) Mirrored (const gp_Ax2d& A) const; + Standard_EXPORT Standard_NODISCARD Handle(Geom2d_Geometry) Mirrored (const gp_Ax2d& A) const; - Standard_EXPORT Handle(Geom2d_Geometry) Rotated (const gp_Pnt2d& P, const Standard_Real Ang) const; + Standard_EXPORT Standard_NODISCARD Handle(Geom2d_Geometry) Rotated (const gp_Pnt2d& P, const Standard_Real Ang) const; - Standard_EXPORT Handle(Geom2d_Geometry) Scaled (const gp_Pnt2d& P, const Standard_Real S) const; + Standard_EXPORT Standard_NODISCARD Handle(Geom2d_Geometry) Scaled (const gp_Pnt2d& P, const Standard_Real S) const; - Standard_EXPORT Handle(Geom2d_Geometry) Transformed (const gp_Trsf2d& T) const; + Standard_EXPORT Standard_NODISCARD Handle(Geom2d_Geometry) Transformed (const gp_Trsf2d& T) const; - Standard_EXPORT Handle(Geom2d_Geometry) Translated (const gp_Vec2d& V) const; + Standard_EXPORT Standard_NODISCARD Handle(Geom2d_Geometry) Translated (const gp_Vec2d& V) const; - Standard_EXPORT Handle(Geom2d_Geometry) Translated (const gp_Pnt2d& P1, const gp_Pnt2d& P2) const; + Standard_EXPORT Standard_NODISCARD Handle(Geom2d_Geometry) Translated (const gp_Pnt2d& P1, const gp_Pnt2d& P2) const; Standard_EXPORT virtual Handle(Geom2d_Geometry) Copy() const = 0; diff --git a/src/Geom2d/Geom2d_Transformation.hxx b/src/Geom2d/Geom2d_Transformation.hxx index a660db319c..07434e4340 100644 --- a/src/Geom2d/Geom2d_Transformation.hxx +++ b/src/Geom2d/Geom2d_Transformation.hxx @@ -170,14 +170,15 @@ public: //! Computes the inverse of this transformation and creates a new one. //! Raises ConstructionError if the the transformation is singular. This means that //! the ScaleFactor is lower or equal to Resolution from package gp. - Standard_EXPORT Handle(Geom2d_Transformation) Inverted() const; + Standard_EXPORT Standard_NODISCARD Handle(Geom2d_Transformation) Inverted() const; //! Computes the transformation composed with Other and . //! * Other. //! Returns a new transformation - Standard_EXPORT Handle(Geom2d_Transformation) Multiplied (const Handle(Geom2d_Transformation)& Other) const; -Handle(Geom2d_Transformation) operator * (const Handle(Geom2d_Transformation)& Other) const + Standard_EXPORT Standard_NODISCARD + Handle(Geom2d_Transformation) Multiplied (const Handle(Geom2d_Transformation)& Other) const; +Standard_NODISCARD Handle(Geom2d_Transformation) operator * (const Handle(Geom2d_Transformation)& Other) const { return Multiplied(Other); } diff --git a/src/Geom2d/Geom2d_Vector.hxx b/src/Geom2d/Geom2d_Vector.hxx index 0687a145eb..276a86e752 100644 --- a/src/Geom2d/Geom2d_Vector.hxx +++ b/src/Geom2d/Geom2d_Vector.hxx @@ -46,7 +46,7 @@ public: Standard_EXPORT void Reverse(); //! Returns a copy of reversed. - Standard_EXPORT Handle(Geom2d_Vector) Reversed() const; + Standard_EXPORT Standard_NODISCARD Handle(Geom2d_Vector) Reversed() const; //! Computes the angular value, in radians, between this //! vector and vector Other. The result is a value diff --git a/src/Geom2d/Geom2d_VectorWithMagnitude.cxx b/src/Geom2d/Geom2d_VectorWithMagnitude.cxx index aa86352616..147cc66c5a 100644 --- a/src/Geom2d/Geom2d_VectorWithMagnitude.cxx +++ b/src/Geom2d/Geom2d_VectorWithMagnitude.cxx @@ -135,8 +135,7 @@ void Geom2d_VectorWithMagnitude::Normalize () { gpVec2d.Normalize (); } Handle(Geom2d_VectorWithMagnitude) Geom2d_VectorWithMagnitude::Normalized () const { - gp_Vec2d V = gpVec2d; - V.Normalized (); + gp_Vec2d V = gpVec2d.Normalized(); return new VectorWithMagnitude (V); } diff --git a/src/Geom2d/Geom2d_VectorWithMagnitude.hxx b/src/Geom2d/Geom2d_VectorWithMagnitude.hxx index bf2f24bdd1..4b15785b0c 100644 --- a/src/Geom2d/Geom2d_VectorWithMagnitude.hxx +++ b/src/Geom2d/Geom2d_VectorWithMagnitude.hxx @@ -80,8 +80,9 @@ void operator += (const Handle(Geom2d_Vector)& Other) //! Adds the vector Other to . - Standard_EXPORT Handle(Geom2d_VectorWithMagnitude) Added (const Handle(Geom2d_Vector)& Other) const; -Handle(Geom2d_VectorWithMagnitude) operator + (const Handle(Geom2d_Vector)& Other) const + Standard_EXPORT Standard_NODISCARD + Handle(Geom2d_VectorWithMagnitude) Added (const Handle(Geom2d_Vector)& Other) const; +Standard_NODISCARD Handle(Geom2d_VectorWithMagnitude) operator + (const Handle(Geom2d_Vector)& Other) const { return Added(Other); } @@ -104,8 +105,8 @@ void operator /= (const Standard_Real Scalar) //! Divides by a scalar. A new vector is returned. - Standard_EXPORT Handle(Geom2d_VectorWithMagnitude) Divided (const Standard_Real Scalar) const; -Handle(Geom2d_VectorWithMagnitude) operator / (const Standard_Real Scalar) const + Standard_EXPORT Standard_NODISCARD Handle(Geom2d_VectorWithMagnitude) Divided (const Standard_Real Scalar) const; +Standard_NODISCARD Handle(Geom2d_VectorWithMagnitude) operator / (const Standard_Real Scalar) const { return Divided(Scalar); } @@ -116,7 +117,7 @@ Handle(Geom2d_VectorWithMagnitude) operator / (const Standard_Real Scalar) const //! //! -C++: alias operator * //! Collision with same operator defined for the class Vector! - Standard_EXPORT Handle(Geom2d_VectorWithMagnitude) Multiplied (const Standard_Real Scalar) const; + Standard_EXPORT Standard_NODISCARD Handle(Geom2d_VectorWithMagnitude) Multiplied (const Standard_Real Scalar) const; //! Computes the product of the vector by a scalar. @@ -136,7 +137,7 @@ void operator *= (const Standard_Real Scalar) //! //! Raised if the magnitude of the vector is lower or equal to //! Resolution from package gp. - Standard_EXPORT Handle(Geom2d_VectorWithMagnitude) Normalized() const; + Standard_EXPORT Standard_NODISCARD Handle(Geom2d_VectorWithMagnitude) Normalized() const; //! Subtracts the Vector Other to . Standard_EXPORT void Subtract (const Handle(Geom2d_Vector)& Other); @@ -147,8 +148,9 @@ void operator -= (const Handle(Geom2d_Vector)& Other) //! Subtracts the vector Other to . A new vector is returned. - Standard_EXPORT Handle(Geom2d_VectorWithMagnitude) Subtracted (const Handle(Geom2d_Vector)& Other) const; -Handle(Geom2d_VectorWithMagnitude) operator - (const Handle(Geom2d_Vector)& Other) const + Standard_EXPORT Standard_NODISCARD + Handle(Geom2d_VectorWithMagnitude) Subtracted (const Handle(Geom2d_Vector)& Other) const; +Standard_NODISCARD Handle(Geom2d_VectorWithMagnitude) operator - (const Handle(Geom2d_Vector)& Other) const { return Subtracted(Other); } diff --git a/src/GeomFill/GeomFill_GuideTrihedronPlan.cxx b/src/GeomFill/GeomFill_GuideTrihedronPlan.cxx index 557a7b7f75..1698b06cf7 100644 --- a/src/GeomFill/GeomFill_GuideTrihedronPlan.cxx +++ b/src/GeomFill/GeomFill_GuideTrihedronPlan.cxx @@ -252,7 +252,7 @@ void GeomFill_GuideTrihedronPlan::SetCurve(const Handle(Adaptor3d_HCurve)& C) Normal = n.Normalized(); BiNormal = Tangent.Crossed(Normal); - BiNormal.Normalized(); + BiNormal.Normalize(); } else { // Erreur... #ifdef OCCT_DEBUG diff --git a/src/GeomFill/GeomFill_TgtOnCoons.cxx b/src/GeomFill/GeomFill_TgtOnCoons.cxx index d4e0180d77..1bd5b96d78 100644 --- a/src/GeomFill/GeomFill_TgtOnCoons.cxx +++ b/src/GeomFill/GeomFill_TgtOnCoons.cxx @@ -124,7 +124,7 @@ gp_Vec GeomFill_TgtOnCoons::D1(const Standard_Real W) const Standard_Real scal = tgsc.Dot(n); gp_Vec scaln = n.Multiplied(-scal); - tgsc.Added(scaln); + tgsc.Add(scaln); gp_Vec scaldn = dn.Multiplied(-scal); diff --git a/src/IntImpParGen/IntImpParGen.cxx b/src/IntImpParGen/IntImpParGen.cxx index 4e2d0af9c5..b62b3f95be 100644 --- a/src/IntImpParGen/IntImpParGen.cxx +++ b/src/IntImpParGen/IntImpParGen.cxx @@ -125,7 +125,6 @@ void IntImpParGen::DetermineTransition(const IntRes2d_Position Pos1, } else { gp_Vec2d Norm; - Tan1.Normalized(); Norm.SetCoord(-Tan1.Y(),Tan1.X()); Standard_Real Val1,Val2; if (!courbure1) { diff --git a/src/IntImpParGen/IntImpParGen_Tool.cxx b/src/IntImpParGen/IntImpParGen_Tool.cxx index 417d1c8e23..01cda619d0 100644 --- a/src/IntImpParGen/IntImpParGen_Tool.cxx +++ b/src/IntImpParGen/IntImpParGen_Tool.cxx @@ -116,7 +116,6 @@ void Determine_Transition(const IntRes2d_Position Pos1, } else { gp_Vec2d Norm; - Tan1.Normalized(); Norm.SetCoord(-Tan1.Y(),Tan1.X()); Standard_Real Val1,Val2; if (!courbure1) { diff --git a/src/ShapeAnalysis/ShapeAnalysis_TransferParametersProj.cxx b/src/ShapeAnalysis/ShapeAnalysis_TransferParametersProj.cxx index 3cf48a864c..3079a1c4ab 100644 --- a/src/ShapeAnalysis/ShapeAnalysis_TransferParametersProj.cxx +++ b/src/ShapeAnalysis/ShapeAnalysis_TransferParametersProj.cxx @@ -550,12 +550,11 @@ TopoDS_Vertex ShapeAnalysis_TransferParametersProj::CopyNMVertex (const TopoDS_V Handle(BRep_GCurve) fromGC = Handle(BRep_GCurve)::DownCast(fromitcr.Value()); if ( fromGC.IsNull() || !fromGC->IsCurveOnSurface()) continue; - TopLoc_Location aL = fromGC->Location(); - aL.Predivided(theV.Location()); + TopLoc_Location aL = fromGC->Location().Predivided(theV.Location()); Handle(Geom_Surface) surface1 = fromGC->Surface(); Handle(Geom2d_Curve) ac2d1 = fromGC->PCurve(); if (pr->IsPointOnCurveOnSurface(ac2d1,surface1,aL)) { - found = Standard_True; + found = Standard_True; if(!hasRepr) { aOldPar = pr->Parameter(); } diff --git a/src/Standard/Standard_Macro.hxx b/src/Standard/Standard_Macro.hxx index ebcd0f329e..a2ab9188a4 100644 --- a/src/Standard/Standard_Macro.hxx +++ b/src/Standard/Standard_Macro.hxx @@ -57,6 +57,28 @@ #define Standard_FALLTHROUGH #endif +//! @def Standard_NODISCARD +//! This attribute may appear in a function declaration, +//! enumeration declaration or class declaration. It tells the compiler to +//! issue a warning, if a return value marked by that attribute is discarded. +//! +//! Expands to C++17 attribute statement "[[nodiscard]]" on compilers that +//! declare support of this attribute, or equivalent attribute on GCC. +#if defined(__has_cpp_attribute) + #if __has_cpp_attribute(nodiscard) + #define Standard_NODISCARD [[nodiscard]] + #else + #define Standard_NODISCARD + #endif +#elif defined(__GNUC__) && ! defined(INTEL_COMPILER) + // According to available documentation, GCC-style __attribute__ ((warn_unused_result)) + // should be available in GCC since version 3.4, and in CLang since 3.9; + // Intel compiler does not seem to support this + #define Standard_NODISCARD __attribute__ ((warn_unused_result)) +#else + #define Standard_NODISCARD +#endif + //! @def Standard_UNUSED //! Macro for marking variables / functions as possibly unused //! so that compiler will not emit redundant "unused" warnings. diff --git a/src/TopLoc/TopLoc_Location.hxx b/src/TopLoc/TopLoc_Location.hxx index f0feceb60c..88d361421c 100644 --- a/src/TopLoc/TopLoc_Location.hxx +++ b/src/TopLoc/TopLoc_Location.hxx @@ -91,30 +91,30 @@ Standard_EXPORT operator gp_Trsf() const; //! Returns the inverse of . //! //! * Inverted() is an Identity. - Standard_EXPORT TopLoc_Location Inverted() const; + Standard_EXPORT Standard_NODISCARD TopLoc_Location Inverted() const; //! Returns * , the elementary datums are //! concatenated. - Standard_EXPORT TopLoc_Location Multiplied (const TopLoc_Location& Other) const; -TopLoc_Location operator* (const TopLoc_Location& Other) const + Standard_EXPORT Standard_NODISCARD TopLoc_Location Multiplied (const TopLoc_Location& Other) const; +Standard_NODISCARD TopLoc_Location operator* (const TopLoc_Location& Other) const { return Multiplied(Other); } //! Returns / . - Standard_EXPORT TopLoc_Location Divided (const TopLoc_Location& Other) const; -TopLoc_Location operator/ (const TopLoc_Location& Other) const + Standard_EXPORT Standard_NODISCARD TopLoc_Location Divided (const TopLoc_Location& Other) const; +Standard_NODISCARD TopLoc_Location operator/ (const TopLoc_Location& Other) const { return Divided(Other); } //! Returns .Inverted() * . - Standard_EXPORT TopLoc_Location Predivided (const TopLoc_Location& Other) const; + Standard_EXPORT Standard_NODISCARD TopLoc_Location Predivided (const TopLoc_Location& Other) const; //! Returns me at the power . If is zero //! returns Identity. can be lower than zero //! (usual meaning for powers). - Standard_EXPORT TopLoc_Location Powered (const Standard_Integer pwr) const; + Standard_EXPORT Standard_NODISCARD TopLoc_Location Powered (const Standard_Integer pwr) const; //! Returns a hashed value for this local coordinate system. //! This value is used, with map tables, to store and diff --git a/src/Units/Units_Token.hxx b/src/Units/Units_Token.hxx index 0a478cbdb8..9048b3c47c 100644 --- a/src/Units/Units_Token.hxx +++ b/src/Units/Units_Token.hxx @@ -126,7 +126,7 @@ public: //! This virtual method is called by the Measurement //! methods, to compute the measurement during a //! conversion. - Standard_EXPORT virtual Standard_Real Multiplied (const Standard_Real avalue) const; + Standard_EXPORT Standard_NODISCARD virtual Standard_Real Multiplied (const Standard_Real avalue) const; //! Returns a token which is the division of by another //! token . @@ -135,7 +135,7 @@ public: //! This virtual method is called by the Measurement //! methods, to compute the measurement during a //! conversion. - Standard_EXPORT virtual Standard_Real Divided (const Standard_Real avalue) const; + Standard_EXPORT Standard_NODISCARD virtual Standard_Real Divided (const Standard_Real avalue) const; //! Returns a token which is to the power of another //! token . The computation is possible only if diff --git a/src/gp/gp_Ax1.hxx b/src/gp/gp_Ax1.hxx index 7f0bf7afe5..8fea4a4e42 100644 --- a/src/gp/gp_Ax1.hxx +++ b/src/gp/gp_Ax1.hxx @@ -112,7 +112,7 @@ public: void Reverse(); //! Reverses the unit vector of this axis and creates a new one. - gp_Ax1 Reversed() const; + Standard_NODISCARD gp_Ax1 Reversed() const; //! Performs the symmetrical transformation of an axis @@ -123,7 +123,7 @@ public: //! Performs the symmetrical transformation of an axis //! placement with respect to the point P which is the //! center of the symmetry and creates a new axis. - Standard_EXPORT gp_Ax1 Mirrored (const gp_Pnt& P) const; + Standard_EXPORT Standard_NODISCARD gp_Ax1 Mirrored (const gp_Pnt& P) const; //! Performs the symmetrical transformation of an axis @@ -135,7 +135,7 @@ public: //! Performs the symmetrical transformation of an axis //! placement with respect to an axis placement which //! is the axis of the symmetry and creates a new axis. - Standard_EXPORT gp_Ax1 Mirrored (const gp_Ax1& A1) const; + Standard_EXPORT Standard_NODISCARD gp_Ax1 Mirrored (const gp_Ax1& A1) const; //! Performs the symmetrical transformation of an axis @@ -149,7 +149,7 @@ public: //! placement with respect to a plane. The axis placement //! locates the plane of the symmetry : //! (Location, XDirection, YDirection) and creates a new axis. - Standard_EXPORT gp_Ax1 Mirrored (const gp_Ax2& A2) const; + Standard_EXPORT Standard_NODISCARD gp_Ax1 Mirrored (const gp_Ax2& A2) const; //! Rotates this axis at an angle Ang (in radians) about the axis A1 //! and assigns the result to this axis. @@ -157,7 +157,7 @@ public: //! Rotates this axis at an angle Ang (in radians) about the axis A1 //! and creates a new one. - gp_Ax1 Rotated (const gp_Ax1& A1, const Standard_Real Ang) const; + Standard_NODISCARD gp_Ax1 Rotated (const gp_Ax1& A1, const Standard_Real Ang) const; //! Applies a scaling transformation to this axis with: @@ -169,7 +169,7 @@ public: //! Applies a scaling transformation to this axis with: //! - scale factor S, and //! - center P and creates a new axis. - gp_Ax1 Scaled (const gp_Pnt& P, const Standard_Real S) const; + Standard_NODISCARD gp_Ax1 Scaled (const gp_Pnt& P, const Standard_Real S) const; //! Applies the transformation T to this axis. //! and assigns the result to this axis. @@ -180,7 +180,7 @@ public: //! //! Translates an axis plaxement in the direction of the vector //! . The magnitude of the translation is the vector's magnitude. - gp_Ax1 Transformed (const gp_Trsf& T) const; + Standard_NODISCARD gp_Ax1 Transformed (const gp_Trsf& T) const; //! Translates this axis by the vector V, @@ -190,7 +190,7 @@ public: //! Translates this axis by the vector V, //! and creates a new one. - gp_Ax1 Translated (const gp_Vec& V) const; + Standard_NODISCARD gp_Ax1 Translated (const gp_Vec& V) const; //! Translates this axis by: @@ -202,7 +202,7 @@ public: //! Translates this axis by: //! the vector (P1, P2) defined from point P1 to point P2. //! and creates a new one. - gp_Ax1 Translated (const gp_Pnt& P1, const gp_Pnt& P2) const; + Standard_NODISCARD gp_Ax1 Translated (const gp_Pnt& P1, const gp_Pnt& P2) const; diff --git a/src/gp/gp_Ax2.hxx b/src/gp/gp_Ax2.hxx index a33d678db2..c11aafdf9e 100644 --- a/src/gp/gp_Ax2.hxx +++ b/src/gp/gp_Ax2.hxx @@ -202,7 +202,7 @@ public: //! product "X Direction" ^ "Y Direction". //! This maintains the right-handed property of the //! coordinate system. - Standard_EXPORT gp_Ax2 Mirrored (const gp_Pnt& P) const; + Standard_EXPORT Standard_NODISCARD gp_Ax2 Mirrored (const gp_Pnt& P) const; //! Performs a symmetrical transformation of this coordinate @@ -238,7 +238,7 @@ public: //! product "X Direction" ^ "Y Direction". //! This maintains the right-handed property of the //! coordinate system. - Standard_EXPORT gp_Ax2 Mirrored (const gp_Ax1& A1) const; + Standard_EXPORT Standard_NODISCARD gp_Ax2 Mirrored (const gp_Ax1& A1) const; //! Performs a symmetrical transformation of this coordinate @@ -276,7 +276,7 @@ public: //! product "X Direction" ^ "Y Direction". //! This maintains the right-handed property of the //! coordinate system. - Standard_EXPORT gp_Ax2 Mirrored (const gp_Ax2& A2) const; + Standard_EXPORT Standard_NODISCARD gp_Ax2 Mirrored (const gp_Ax2& A2) const; void Rotate (const gp_Ax1& A1, const Standard_Real Ang); @@ -284,7 +284,7 @@ public: //! Rotates an axis placement. is the axis of the //! rotation . Ang is the angular value of the rotation //! in radians. - gp_Ax2 Rotated (const gp_Ax1& A1, const Standard_Real Ang) const; + Standard_NODISCARD gp_Ax2 Rotated (const gp_Ax1& A1, const Standard_Real Ang) const; void Scale (const gp_Pnt& P, const Standard_Real S); @@ -296,7 +296,7 @@ public: //! . the main direction of the axis placement is not changed. //! . The "XDirection" and the "YDirection" are reversed. //! So the axis placement stay right handed. - gp_Ax2 Scaled (const gp_Pnt& P, const Standard_Real S) const; + Standard_NODISCARD gp_Ax2 Scaled (const gp_Pnt& P, const Standard_Real S) const; void Transform (const gp_Trsf& T); @@ -306,21 +306,21 @@ public: //! "YDirection" are transformed with T. The resulting //! main "Direction" of is the cross product between //! the "XDirection" and the "YDirection" after transformation. - gp_Ax2 Transformed (const gp_Trsf& T) const; + Standard_NODISCARD gp_Ax2 Transformed (const gp_Trsf& T) const; void Translate (const gp_Vec& V); //! Translates an axis plaxement in the direction of the vector //! . The magnitude of the translation is the vector's magnitude. - gp_Ax2 Translated (const gp_Vec& V) const; + Standard_NODISCARD gp_Ax2 Translated (const gp_Vec& V) const; void Translate (const gp_Pnt& P1, const gp_Pnt& P2); //! Translates an axis placement from the point to the //! point . - gp_Ax2 Translated (const gp_Pnt& P1, const gp_Pnt& P2) const; + Standard_NODISCARD gp_Ax2 Translated (const gp_Pnt& P1, const gp_Pnt& P2) const; diff --git a/src/gp/gp_Ax22d.hxx b/src/gp/gp_Ax22d.hxx index 39d206e0ba..b837199853 100644 --- a/src/gp/gp_Ax22d.hxx +++ b/src/gp/gp_Ax22d.hxx @@ -152,7 +152,7 @@ public: //! The main direction of the axis placement is not changed. //! The "XDirection" and the "YDirection" are reversed. //! So the axis placement stay right handed. - Standard_EXPORT gp_Ax22d Mirrored (const gp_Pnt2d& P) const; + Standard_EXPORT Standard_NODISCARD gp_Ax22d Mirrored (const gp_Pnt2d& P) const; Standard_EXPORT void Mirror (const gp_Ax2d& A); @@ -164,7 +164,7 @@ public: //! point, on the "XDirection" and "YDirection". //! The resulting main "Direction" is the cross product between //! the "XDirection" and the "YDirection" after transformation. - Standard_EXPORT gp_Ax22d Mirrored (const gp_Ax2d& A) const; + Standard_EXPORT Standard_NODISCARD gp_Ax22d Mirrored (const gp_Ax2d& A) const; void Rotate (const gp_Pnt2d& P, const Standard_Real Ang); @@ -172,7 +172,7 @@ public: //! Rotates an axis placement. is the axis of the //! rotation . Ang is the angular value of the rotation //! in radians. - gp_Ax22d Rotated (const gp_Pnt2d& P, const Standard_Real Ang) const; + Standard_NODISCARD gp_Ax22d Rotated (const gp_Pnt2d& P, const Standard_Real Ang) const; void Scale (const gp_Pnt2d& P, const Standard_Real S); @@ -184,7 +184,7 @@ public: //! . the main direction of the axis placement is not changed. //! . The "XDirection" and the "YDirection" are reversed. //! So the axis placement stay right handed. - gp_Ax22d Scaled (const gp_Pnt2d& P, const Standard_Real S) const; + Standard_NODISCARD gp_Ax22d Scaled (const gp_Pnt2d& P, const Standard_Real S) const; void Transform (const gp_Trsf2d& T); @@ -194,21 +194,21 @@ public: //! "YDirection" are transformed with T. The resulting //! main "Direction" of is the cross product between //! the "XDirection" and the "YDirection" after transformation. - gp_Ax22d Transformed (const gp_Trsf2d& T) const; + Standard_NODISCARD gp_Ax22d Transformed (const gp_Trsf2d& T) const; void Translate (const gp_Vec2d& V); //! Translates an axis plaxement in the direction of the vector //! . The magnitude of the translation is the vector's magnitude. - gp_Ax22d Translated (const gp_Vec2d& V) const; + Standard_NODISCARD gp_Ax22d Translated (const gp_Vec2d& V) const; void Translate (const gp_Pnt2d& P1, const gp_Pnt2d& P2); //! Translates an axis placement from the point to the //! point . - gp_Ax22d Translated (const gp_Pnt2d& P1, const gp_Pnt2d& P2) const; + Standard_NODISCARD gp_Ax22d Translated (const gp_Pnt2d& P1, const gp_Pnt2d& P2) const; diff --git a/src/gp/gp_Ax2d.hxx b/src/gp/gp_Ax2d.hxx index 385a77ea5f..20a30cc2f1 100644 --- a/src/gp/gp_Ax2d.hxx +++ b/src/gp/gp_Ax2d.hxx @@ -115,7 +115,7 @@ public: //! Computes a new axis placement with a direction opposite to //! the direction of . - gp_Ax2d Reversed() const; + Standard_NODISCARD gp_Ax2d Reversed() const; Standard_EXPORT void Mirror (const gp_Pnt2d& P); @@ -123,7 +123,7 @@ public: //! Performs the symmetrical transformation of an axis //! placement with respect to the point P which is the //! center of the symmetry. - Standard_EXPORT gp_Ax2d Mirrored (const gp_Pnt2d& P) const; + Standard_EXPORT Standard_NODISCARD gp_Ax2d Mirrored (const gp_Pnt2d& P) const; Standard_EXPORT void Mirror (const gp_Ax2d& A); @@ -131,7 +131,7 @@ public: //! Performs the symmetrical transformation of an axis //! placement with respect to an axis placement which //! is the axis of the symmetry. - Standard_EXPORT gp_Ax2d Mirrored (const gp_Ax2d& A) const; + Standard_EXPORT Standard_NODISCARD gp_Ax2d Mirrored (const gp_Ax2d& A) const; void Rotate (const gp_Pnt2d& P, const Standard_Real Ang); @@ -139,7 +139,7 @@ public: //! Rotates an axis placement.

is the center of the //! rotation . Ang is the angular value of the rotation //! in radians. - gp_Ax2d Rotated (const gp_Pnt2d& P, const Standard_Real Ang) const; + Standard_NODISCARD gp_Ax2d Rotated (const gp_Pnt2d& P, const Standard_Real Ang) const; Standard_EXPORT void Scale (const gp_Pnt2d& P, const Standard_Real S); @@ -147,26 +147,26 @@ public: //! Applies a scaling transformation on the axis placement. //! The "Location" point of the axisplacement is modified. //! The "Direction" is reversed if the scale is negative. - gp_Ax2d Scaled (const gp_Pnt2d& P, const Standard_Real S) const; + Standard_NODISCARD gp_Ax2d Scaled (const gp_Pnt2d& P, const Standard_Real S) const; void Transform (const gp_Trsf2d& T); //! Transforms an axis placement with a Trsf. - gp_Ax2d Transformed (const gp_Trsf2d& T) const; + Standard_NODISCARD gp_Ax2d Transformed (const gp_Trsf2d& T) const; void Translate (const gp_Vec2d& V); //! Translates an axis placement in the direction of the vector //! . The magnitude of the translation is the vector's magnitude. - gp_Ax2d Translated (const gp_Vec2d& V) const; + Standard_NODISCARD gp_Ax2d Translated (const gp_Vec2d& V) const; void Translate (const gp_Pnt2d& P1, const gp_Pnt2d& P2); //! Translates an axis placement from the point to the //! point . - gp_Ax2d Translated (const gp_Pnt2d& P1, const gp_Pnt2d& P2) const; + Standard_NODISCARD gp_Ax2d Translated (const gp_Pnt2d& P1, const gp_Pnt2d& P2) const; diff --git a/src/gp/gp_Ax3.hxx b/src/gp/gp_Ax3.hxx index 7294dd3855..2d09566fbb 100644 --- a/src/gp/gp_Ax3.hxx +++ b/src/gp/gp_Ax3.hxx @@ -218,7 +218,7 @@ public: //! The main direction of the axis placement is not changed. //! The "XDirection" and the "YDirection" are reversed. //! So the axis placement stay right handed. - Standard_EXPORT gp_Ax3 Mirrored (const gp_Pnt& P) const; + Standard_EXPORT Standard_NODISCARD gp_Ax3 Mirrored (const gp_Pnt& P) const; Standard_EXPORT void Mirror (const gp_Ax1& A1); @@ -230,7 +230,7 @@ public: //! point, on the "XDirection" and "YDirection". //! The resulting main "Direction" is the cross product between //! the "XDirection" and the "YDirection" after transformation. - Standard_EXPORT gp_Ax3 Mirrored (const gp_Ax1& A1) const; + Standard_EXPORT Standard_NODISCARD gp_Ax3 Mirrored (const gp_Ax1& A1) const; Standard_EXPORT void Mirror (const gp_Ax2& A2); @@ -243,7 +243,7 @@ public: //! point, on the "XDirection" and "YDirection". //! The resulting main "Direction" is the cross product between //! the "XDirection" and the "YDirection" after transformation. - Standard_EXPORT gp_Ax3 Mirrored (const gp_Ax2& A2) const; + Standard_EXPORT Standard_NODISCARD gp_Ax3 Mirrored (const gp_Ax2& A2) const; void Rotate (const gp_Ax1& A1, const Standard_Real Ang); @@ -251,7 +251,7 @@ public: //! Rotates an axis placement. is the axis of the //! rotation . Ang is the angular value of the rotation //! in radians. - gp_Ax3 Rotated (const gp_Ax1& A1, const Standard_Real Ang) const; + Standard_NODISCARD gp_Ax3 Rotated (const gp_Ax1& A1, const Standard_Real Ang) const; void Scale (const gp_Pnt& P, const Standard_Real S); @@ -263,7 +263,7 @@ public: //! . the main direction of the axis placement is not changed. //! . The "XDirection" and the "YDirection" are reversed. //! So the axis placement stay right handed. - gp_Ax3 Scaled (const gp_Pnt& P, const Standard_Real S) const; + Standard_NODISCARD gp_Ax3 Scaled (const gp_Pnt& P, const Standard_Real S) const; void Transform (const gp_Trsf& T); @@ -273,21 +273,21 @@ public: //! "YDirection" are transformed with T. The resulting //! main "Direction" of is the cross product between //! the "XDirection" and the "YDirection" after transformation. - gp_Ax3 Transformed (const gp_Trsf& T) const; + Standard_NODISCARD gp_Ax3 Transformed (const gp_Trsf& T) const; void Translate (const gp_Vec& V); //! Translates an axis plaxement in the direction of the vector //! . The magnitude of the translation is the vector's magnitude. - gp_Ax3 Translated (const gp_Vec& V) const; + Standard_NODISCARD gp_Ax3 Translated (const gp_Vec& V) const; void Translate (const gp_Pnt& P1, const gp_Pnt& P2); //! Translates an axis placement from the point to the //! point . - gp_Ax3 Translated (const gp_Pnt& P1, const gp_Pnt& P2) const; + Standard_NODISCARD gp_Ax3 Translated (const gp_Pnt& P1, const gp_Pnt& P2) const; diff --git a/src/gp/gp_Circ.hxx b/src/gp/gp_Circ.hxx index 69fea1b8bc..d2b58f1d32 100644 --- a/src/gp/gp_Circ.hxx +++ b/src/gp/gp_Circ.hxx @@ -153,7 +153,7 @@ public: //! Performs the symmetrical transformation of a circle //! with respect to the point P which is the center of the //! symmetry. - Standard_EXPORT gp_Circ Mirrored (const gp_Pnt& P) const; + Standard_EXPORT Standard_NODISCARD gp_Circ Mirrored (const gp_Pnt& P) const; Standard_EXPORT void Mirror (const gp_Ax1& A1); @@ -161,7 +161,7 @@ public: //! Performs the symmetrical transformation of a circle with //! respect to an axis placement which is the axis of the //! symmetry. - Standard_EXPORT gp_Circ Mirrored (const gp_Ax1& A1) const; + Standard_EXPORT Standard_NODISCARD gp_Circ Mirrored (const gp_Ax1& A1) const; Standard_EXPORT void Mirror (const gp_Ax2& A2); @@ -169,14 +169,14 @@ public: //! Performs the symmetrical transformation of a circle with respect //! to a plane. The axis placement A2 locates the plane of the //! of the symmetry : (Location, XDirection, YDirection). - Standard_EXPORT gp_Circ Mirrored (const gp_Ax2& A2) const; + Standard_EXPORT Standard_NODISCARD gp_Circ Mirrored (const gp_Ax2& A2) const; void Rotate (const gp_Ax1& A1, const Standard_Real Ang); //! Rotates a circle. A1 is the axis of the rotation. //! Ang is the angular value of the rotation in radians. - gp_Circ Rotated (const gp_Ax1& A1, const Standard_Real Ang) const; + Standard_NODISCARD gp_Circ Rotated (const gp_Ax1& A1, const Standard_Real Ang) const; void Scale (const gp_Pnt& P, const Standard_Real S); @@ -186,26 +186,26 @@ public: //! If S is negative the radius stay positive but //! the "XAxis" and the "YAxis" are reversed as for //! an ellipse. - gp_Circ Scaled (const gp_Pnt& P, const Standard_Real S) const; + Standard_NODISCARD gp_Circ Scaled (const gp_Pnt& P, const Standard_Real S) const; void Transform (const gp_Trsf& T); //! Transforms a circle with the transformation T from class Trsf. - gp_Circ Transformed (const gp_Trsf& T) const; + Standard_NODISCARD gp_Circ Transformed (const gp_Trsf& T) const; void Translate (const gp_Vec& V); //! Translates a circle in the direction of the vector V. //! The magnitude of the translation is the vector's magnitude. - gp_Circ Translated (const gp_Vec& V) const; + Standard_NODISCARD gp_Circ Translated (const gp_Vec& V) const; void Translate (const gp_Pnt& P1, const gp_Pnt& P2); //! Translates a circle from the point P1 to the point P2. - gp_Circ Translated (const gp_Pnt& P1, const gp_Pnt& P2) const; + Standard_NODISCARD gp_Circ Translated (const gp_Pnt& P1, const gp_Pnt& P2) const; diff --git a/src/gp/gp_Circ2d.hxx b/src/gp/gp_Circ2d.hxx index 316682033c..b4a2168696 100644 --- a/src/gp/gp_Circ2d.hxx +++ b/src/gp/gp_Circ2d.hxx @@ -156,7 +156,7 @@ public: //! of this circle (the "Y Direction" is reversed) and therefore //! changes the implicit orientation of this circle. //! Reversed creates a new circle. - gp_Circ2d Reversed() const; + Standard_NODISCARD gp_Circ2d Reversed() const; //! Returns true if the local coordinate system is direct //! and false in the other case. @@ -167,21 +167,21 @@ public: //! Performs the symmetrical transformation of a circle with respect //! to the point P which is the center of the symmetry - Standard_EXPORT gp_Circ2d Mirrored (const gp_Pnt2d& P) const; + Standard_EXPORT Standard_NODISCARD gp_Circ2d Mirrored (const gp_Pnt2d& P) const; Standard_EXPORT void Mirror (const gp_Ax2d& A); //! Performs the symmetrical transformation of a circle with respect //! to an axis placement which is the axis of the symmetry. - Standard_EXPORT gp_Circ2d Mirrored (const gp_Ax2d& A) const; + Standard_EXPORT Standard_NODISCARD gp_Circ2d Mirrored (const gp_Ax2d& A) const; void Rotate (const gp_Pnt2d& P, const Standard_Real Ang); //! Rotates a circle. P is the center of the rotation. //! Ang is the angular value of the rotation in radians. - gp_Circ2d Rotated (const gp_Pnt2d& P, const Standard_Real Ang) const; + Standard_NODISCARD gp_Circ2d Rotated (const gp_Pnt2d& P, const Standard_Real Ang) const; void Scale (const gp_Pnt2d& P, const Standard_Real S); @@ -191,26 +191,26 @@ public: //! If S is negative the radius stay positive but //! the "XAxis" and the "YAxis" are reversed as for //! an ellipse. - gp_Circ2d Scaled (const gp_Pnt2d& P, const Standard_Real S) const; + Standard_NODISCARD gp_Circ2d Scaled (const gp_Pnt2d& P, const Standard_Real S) const; void Transform (const gp_Trsf2d& T); //! Transforms a circle with the transformation T from class Trsf2d. - gp_Circ2d Transformed (const gp_Trsf2d& T) const; + Standard_NODISCARD gp_Circ2d Transformed (const gp_Trsf2d& T) const; void Translate (const gp_Vec2d& V); //! Translates a circle in the direction of the vector V. //! The magnitude of the translation is the vector's magnitude. - gp_Circ2d Translated (const gp_Vec2d& V) const; + Standard_NODISCARD gp_Circ2d Translated (const gp_Vec2d& V) const; void Translate (const gp_Pnt2d& P1, const gp_Pnt2d& P2); //! Translates a circle from the point P1 to the point P2. - gp_Circ2d Translated (const gp_Pnt2d& P1, const gp_Pnt2d& P2) const; + Standard_NODISCARD gp_Circ2d Translated (const gp_Pnt2d& P1, const gp_Pnt2d& P2) const; diff --git a/src/gp/gp_Cone.hxx b/src/gp/gp_Cone.hxx index a6617f1b4e..cd30bcc100 100644 --- a/src/gp/gp_Cone.hxx +++ b/src/gp/gp_Cone.hxx @@ -163,7 +163,7 @@ public: //! Performs the symmetrical transformation of a cone //! with respect to the point P which is the center of the //! symmetry. - Standard_EXPORT gp_Cone Mirrored (const gp_Pnt& P) const; + Standard_EXPORT Standard_NODISCARD gp_Cone Mirrored (const gp_Pnt& P) const; Standard_EXPORT void Mirror (const gp_Ax1& A1); @@ -171,7 +171,7 @@ public: //! Performs the symmetrical transformation of a cone with //! respect to an axis placement which is the axis of the //! symmetry. - Standard_EXPORT gp_Cone Mirrored (const gp_Ax1& A1) const; + Standard_EXPORT Standard_NODISCARD gp_Cone Mirrored (const gp_Ax1& A1) const; Standard_EXPORT void Mirror (const gp_Ax2& A2); @@ -179,40 +179,40 @@ public: //! Performs the symmetrical transformation of a cone with respect //! to a plane. The axis placement A2 locates the plane of the //! of the symmetry : (Location, XDirection, YDirection). - Standard_EXPORT gp_Cone Mirrored (const gp_Ax2& A2) const; + Standard_EXPORT Standard_NODISCARD gp_Cone Mirrored (const gp_Ax2& A2) const; void Rotate (const gp_Ax1& A1, const Standard_Real Ang); //! Rotates a cone. A1 is the axis of the rotation. //! Ang is the angular value of the rotation in radians. - gp_Cone Rotated (const gp_Ax1& A1, const Standard_Real Ang) const; + Standard_NODISCARD gp_Cone Rotated (const gp_Ax1& A1, const Standard_Real Ang) const; void Scale (const gp_Pnt& P, const Standard_Real S); //! Scales a cone. S is the scaling value. //! The absolute value of S is used to scale the cone - gp_Cone Scaled (const gp_Pnt& P, const Standard_Real S) const; + Standard_NODISCARD gp_Cone Scaled (const gp_Pnt& P, const Standard_Real S) const; void Transform (const gp_Trsf& T); //! Transforms a cone with the transformation T from class Trsf. - gp_Cone Transformed (const gp_Trsf& T) const; + Standard_NODISCARD gp_Cone Transformed (const gp_Trsf& T) const; void Translate (const gp_Vec& V); //! Translates a cone in the direction of the vector V. //! The magnitude of the translation is the vector's magnitude. - gp_Cone Translated (const gp_Vec& V) const; + Standard_NODISCARD gp_Cone Translated (const gp_Vec& V) const; void Translate (const gp_Pnt& P1, const gp_Pnt& P2); //! Translates a cone from the point P1 to the point P2. - gp_Cone Translated (const gp_Pnt& P1, const gp_Pnt& P2) const; + Standard_NODISCARD gp_Cone Translated (const gp_Pnt& P1, const gp_Pnt& P2) const; diff --git a/src/gp/gp_Cylinder.hxx b/src/gp/gp_Cylinder.hxx index ed32f9c216..37c670b9d0 100644 --- a/src/gp/gp_Cylinder.hxx +++ b/src/gp/gp_Cylinder.hxx @@ -125,7 +125,7 @@ public: //! Performs the symmetrical transformation of a cylinder //! with respect to the point P which is the center of the //! symmetry. - Standard_EXPORT gp_Cylinder Mirrored (const gp_Pnt& P) const; + Standard_EXPORT Standard_NODISCARD gp_Cylinder Mirrored (const gp_Pnt& P) const; Standard_EXPORT void Mirror (const gp_Ax1& A1); @@ -133,7 +133,7 @@ public: //! Performs the symmetrical transformation of a cylinder with //! respect to an axis placement which is the axis of the //! symmetry. - Standard_EXPORT gp_Cylinder Mirrored (const gp_Ax1& A1) const; + Standard_EXPORT Standard_NODISCARD gp_Cylinder Mirrored (const gp_Ax1& A1) const; Standard_EXPORT void Mirror (const gp_Ax2& A2); @@ -141,40 +141,40 @@ public: //! Performs the symmetrical transformation of a cylinder with respect //! to a plane. The axis placement A2 locates the plane of the //! of the symmetry : (Location, XDirection, YDirection). - Standard_EXPORT gp_Cylinder Mirrored (const gp_Ax2& A2) const; + Standard_EXPORT Standard_NODISCARD gp_Cylinder Mirrored (const gp_Ax2& A2) const; void Rotate (const gp_Ax1& A1, const Standard_Real Ang); //! Rotates a cylinder. A1 is the axis of the rotation. //! Ang is the angular value of the rotation in radians. - gp_Cylinder Rotated (const gp_Ax1& A1, const Standard_Real Ang) const; + Standard_NODISCARD gp_Cylinder Rotated (const gp_Ax1& A1, const Standard_Real Ang) const; void Scale (const gp_Pnt& P, const Standard_Real S); //! Scales a cylinder. S is the scaling value. //! The absolute value of S is used to scale the cylinder - gp_Cylinder Scaled (const gp_Pnt& P, const Standard_Real S) const; + Standard_NODISCARD gp_Cylinder Scaled (const gp_Pnt& P, const Standard_Real S) const; void Transform (const gp_Trsf& T); //! Transforms a cylinder with the transformation T from class Trsf. - gp_Cylinder Transformed (const gp_Trsf& T) const; + Standard_NODISCARD gp_Cylinder Transformed (const gp_Trsf& T) const; void Translate (const gp_Vec& V); //! Translates a cylinder in the direction of the vector V. //! The magnitude of the translation is the vector's magnitude. - gp_Cylinder Translated (const gp_Vec& V) const; + Standard_NODISCARD gp_Cylinder Translated (const gp_Vec& V) const; void Translate (const gp_Pnt& P1, const gp_Pnt& P2); //! Translates a cylinder from the point P1 to the point P2. - gp_Cylinder Translated (const gp_Pnt& P1, const gp_Pnt& P2) const; + Standard_NODISCARD gp_Cylinder Translated (const gp_Pnt& P1, const gp_Pnt& P2) const; diff --git a/src/gp/gp_Dir.hxx b/src/gp/gp_Dir.hxx index 4fca6d2104..ae492722ef 100644 --- a/src/gp/gp_Dir.hxx +++ b/src/gp/gp_Dir.hxx @@ -176,8 +176,8 @@ public: //! Raises the exception ConstructionError if V1 and V2 are parallel //! or and (V1^V2) are parallel because the computed vector //! can't be normalized to create a direction. - gp_Dir Crossed (const gp_Dir& Right) const; - gp_Dir operator ^ (const gp_Dir& Right) const + Standard_NODISCARD gp_Dir Crossed (const gp_Dir& Right) const; + Standard_NODISCARD gp_Dir operator ^ (const gp_Dir& Right) const { return Crossed(Right); } @@ -192,7 +192,7 @@ public: //! - this unit vector and (V1 ^ V2) are parallel. //! This is because, in these conditions, the computed vector //! is null and cannot be normalized. - gp_Dir CrossCrossed (const gp_Dir& V1, const gp_Dir& V2) const; + Standard_NODISCARD gp_Dir CrossCrossed (const gp_Dir& V1, const gp_Dir& V2) const; //! Computes the scalar product Standard_Real Dot (const gp_Dir& Other) const; @@ -216,8 +216,8 @@ public: //! Performs the symmetrical transformation of a direction //! with respect to the direction V which is the center of //! the symmetry.] - gp_Dir Reversed() const; - gp_Dir operator -() const + Standard_NODISCARD gp_Dir Reversed() const; + Standard_NODISCARD gp_Dir operator -() const { return Reversed(); } @@ -228,7 +228,7 @@ public: //! Performs the symmetrical transformation of a direction //! with respect to the direction V which is the center of //! the symmetry. - Standard_EXPORT gp_Dir Mirrored (const gp_Dir& V) const; + Standard_EXPORT Standard_NODISCARD gp_Dir Mirrored (const gp_Dir& V) const; Standard_EXPORT void Mirror (const gp_Ax1& A1); @@ -236,7 +236,7 @@ public: //! Performs the symmetrical transformation of a direction //! with respect to an axis placement which is the axis //! of the symmetry. - Standard_EXPORT gp_Dir Mirrored (const gp_Ax1& A1) const; + Standard_EXPORT Standard_NODISCARD gp_Dir Mirrored (const gp_Ax1& A1) const; Standard_EXPORT void Mirror (const gp_Ax2& A2); @@ -244,14 +244,14 @@ public: //! Performs the symmetrical transformation of a direction //! with respect to a plane. The axis placement A2 locates //! the plane of the symmetry : (Location, XDirection, YDirection). - Standard_EXPORT gp_Dir Mirrored (const gp_Ax2& A2) const; + Standard_EXPORT Standard_NODISCARD gp_Dir Mirrored (const gp_Ax2& A2) const; void Rotate (const gp_Ax1& A1, const Standard_Real Ang); //! Rotates a direction. A1 is the axis of the rotation. //! Ang is the angular value of the rotation in radians. - gp_Dir Rotated (const gp_Ax1& A1, const Standard_Real Ang) const; + Standard_NODISCARD gp_Dir Rotated (const gp_Ax1& A1, const Standard_Real Ang) const; Standard_EXPORT void Transform (const gp_Trsf& T); @@ -260,7 +260,7 @@ public: //! Warnings : //! If the scale factor of the "Trsf" T is negative then the //! direction is reversed. - gp_Dir Transformed (const gp_Trsf& T) const; + Standard_NODISCARD gp_Dir Transformed (const gp_Trsf& T) const; diff --git a/src/gp/gp_Dir2d.hxx b/src/gp/gp_Dir2d.hxx index 2c77d2a1a3..cc1333dbee 100644 --- a/src/gp/gp_Dir2d.hxx +++ b/src/gp/gp_Dir2d.hxx @@ -195,8 +195,8 @@ public: //! Computes the cross product between two directions. - Standard_Real Crossed (const gp_Dir2d& Right) const; - Standard_Real operator ^ (const gp_Dir2d& Right) const + Standard_NODISCARD Standard_Real Crossed (const gp_Dir2d& Right) const; + Standard_NODISCARD Standard_Real operator ^ (const gp_Dir2d& Right) const { return Crossed(Right); } @@ -211,8 +211,8 @@ public: void Reverse(); //! Reverses the orientation of a direction - gp_Dir2d Reversed() const; - gp_Dir2d operator -() const + Standard_NODISCARD gp_Dir2d Reversed() const; + Standard_NODISCARD gp_Dir2d operator -() const { return Reversed(); } @@ -223,7 +223,7 @@ public: //! Performs the symmetrical transformation of a direction //! with respect to the direction V which is the center of //! the symmetry. - Standard_EXPORT gp_Dir2d Mirrored (const gp_Dir2d& V) const; + Standard_EXPORT Standard_NODISCARD gp_Dir2d Mirrored (const gp_Dir2d& V) const; Standard_EXPORT void Mirror (const gp_Ax2d& A); @@ -231,14 +231,14 @@ public: //! Performs the symmetrical transformation of a direction //! with respect to an axis placement which is the axis //! of the symmetry. - Standard_EXPORT gp_Dir2d Mirrored (const gp_Ax2d& A) const; + Standard_EXPORT Standard_NODISCARD gp_Dir2d Mirrored (const gp_Ax2d& A) const; void Rotate (const Standard_Real Ang); //! Rotates a direction. Ang is the angular value of //! the rotation in radians. - gp_Dir2d Rotated (const Standard_Real Ang) const; + Standard_NODISCARD gp_Dir2d Rotated (const Standard_Real Ang) const; Standard_EXPORT void Transform (const gp_Trsf2d& T); @@ -247,7 +247,7 @@ public: //! Warnings : //! If the scale factor of the "Trsf" T is negative then the //! direction is reversed. - gp_Dir2d Transformed (const gp_Trsf2d& T) const; + Standard_NODISCARD gp_Dir2d Transformed (const gp_Trsf2d& T) const; diff --git a/src/gp/gp_Elips.hxx b/src/gp/gp_Elips.hxx index 11ab81274e..56df6f3ade 100644 --- a/src/gp/gp_Elips.hxx +++ b/src/gp/gp_Elips.hxx @@ -198,14 +198,14 @@ public: //! Performs the symmetrical transformation of an ellipse with //! respect to the point P which is the center of the symmetry. - Standard_EXPORT gp_Elips Mirrored (const gp_Pnt& P) const; + Standard_EXPORT Standard_NODISCARD gp_Elips Mirrored (const gp_Pnt& P) const; Standard_EXPORT void Mirror (const gp_Ax1& A1); //! Performs the symmetrical transformation of an ellipse with //! respect to an axis placement which is the axis of the symmetry. - Standard_EXPORT gp_Elips Mirrored (const gp_Ax1& A1) const; + Standard_EXPORT Standard_NODISCARD gp_Elips Mirrored (const gp_Ax1& A1) const; Standard_EXPORT void Mirror (const gp_Ax2& A2); @@ -213,39 +213,39 @@ public: //! Performs the symmetrical transformation of an ellipse with //! respect to a plane. The axis placement A2 locates the plane //! of the symmetry (Location, XDirection, YDirection). - Standard_EXPORT gp_Elips Mirrored (const gp_Ax2& A2) const; + Standard_EXPORT Standard_NODISCARD gp_Elips Mirrored (const gp_Ax2& A2) const; void Rotate (const gp_Ax1& A1, const Standard_Real Ang); //! Rotates an ellipse. A1 is the axis of the rotation. //! Ang is the angular value of the rotation in radians. - gp_Elips Rotated (const gp_Ax1& A1, const Standard_Real Ang) const; + Standard_NODISCARD gp_Elips Rotated (const gp_Ax1& A1, const Standard_Real Ang) const; void Scale (const gp_Pnt& P, const Standard_Real S); //! Scales an ellipse. S is the scaling value. - gp_Elips Scaled (const gp_Pnt& P, const Standard_Real S) const; + Standard_NODISCARD gp_Elips Scaled (const gp_Pnt& P, const Standard_Real S) const; void Transform (const gp_Trsf& T); //! Transforms an ellipse with the transformation T from class Trsf. - gp_Elips Transformed (const gp_Trsf& T) const; + Standard_NODISCARD gp_Elips Transformed (const gp_Trsf& T) const; void Translate (const gp_Vec& V); //! Translates an ellipse in the direction of the vector V. //! The magnitude of the translation is the vector's magnitude. - gp_Elips Translated (const gp_Vec& V) const; + Standard_NODISCARD gp_Elips Translated (const gp_Vec& V) const; void Translate (const gp_Pnt& P1, const gp_Pnt& P2); //! Translates an ellipse from the point P1 to the point P2. - gp_Elips Translated (const gp_Pnt& P1, const gp_Pnt& P2) const; + Standard_NODISCARD gp_Elips Translated (const gp_Pnt& P1, const gp_Pnt& P2) const; diff --git a/src/gp/gp_Elips2d.hxx b/src/gp/gp_Elips2d.hxx index 72f7d4269e..6c30c1c515 100644 --- a/src/gp/gp_Elips2d.hxx +++ b/src/gp/gp_Elips2d.hxx @@ -197,7 +197,7 @@ public: void Reverse(); - gp_Elips2d Reversed() const; + Standard_NODISCARD gp_Elips2d Reversed() const; //! Returns true if the local coordinate system is direct //! and false in the other case. @@ -208,43 +208,43 @@ public: //! Performs the symmetrical transformation of a ellipse with respect //! to the point P which is the center of the symmetry - Standard_EXPORT gp_Elips2d Mirrored (const gp_Pnt2d& P) const; + Standard_EXPORT Standard_NODISCARD gp_Elips2d Mirrored (const gp_Pnt2d& P) const; Standard_EXPORT void Mirror (const gp_Ax2d& A); //! Performs the symmetrical transformation of a ellipse with respect //! to an axis placement which is the axis of the symmetry. - Standard_EXPORT gp_Elips2d Mirrored (const gp_Ax2d& A) const; + Standard_EXPORT Standard_NODISCARD gp_Elips2d Mirrored (const gp_Ax2d& A) const; void Rotate (const gp_Pnt2d& P, const Standard_Real Ang); - gp_Elips2d Rotated (const gp_Pnt2d& P, const Standard_Real Ang) const; + Standard_NODISCARD gp_Elips2d Rotated (const gp_Pnt2d& P, const Standard_Real Ang) const; void Scale (const gp_Pnt2d& P, const Standard_Real S); //! Scales a ellipse. S is the scaling value. - gp_Elips2d Scaled (const gp_Pnt2d& P, const Standard_Real S) const; + Standard_NODISCARD gp_Elips2d Scaled (const gp_Pnt2d& P, const Standard_Real S) const; void Transform (const gp_Trsf2d& T); //! Transforms an ellipse with the transformation T from class Trsf2d. - gp_Elips2d Transformed (const gp_Trsf2d& T) const; + Standard_NODISCARD gp_Elips2d Transformed (const gp_Trsf2d& T) const; void Translate (const gp_Vec2d& V); //! Translates a ellipse in the direction of the vector V. //! The magnitude of the translation is the vector's magnitude. - gp_Elips2d Translated (const gp_Vec2d& V) const; + Standard_NODISCARD gp_Elips2d Translated (const gp_Vec2d& V) const; void Translate (const gp_Pnt2d& P1, const gp_Pnt2d& P2); //! Translates a ellipse from the point P1 to the point P2. - gp_Elips2d Translated (const gp_Pnt2d& P1, const gp_Pnt2d& P2) const; + Standard_NODISCARD gp_Elips2d Translated (const gp_Pnt2d& P1, const gp_Pnt2d& P2) const; diff --git a/src/gp/gp_GTrsf.hxx b/src/gp/gp_GTrsf.hxx index a2fa2af8d7..068aa81826 100644 --- a/src/gp/gp_GTrsf.hxx +++ b/src/gp/gp_GTrsf.hxx @@ -182,7 +182,7 @@ public: //! Computes the reverse transformation. //! Raises an exception if the matrix of the transformation //! is not inversible. - gp_GTrsf Inverted() const; + Standard_NODISCARD gp_GTrsf Inverted() const; //! Computes the transformation composed from T and . @@ -198,8 +198,8 @@ public: //! XYZ P2(P); //! T1.Transforms(P2); //using T1 then T2 //! T2.Transforms(P2); // P1 = P2 !!! - gp_GTrsf Multiplied (const gp_GTrsf& T) const; - gp_GTrsf operator * (const gp_GTrsf& T) const + Standard_NODISCARD gp_GTrsf Multiplied (const gp_GTrsf& T) const; + Standard_NODISCARD gp_GTrsf operator * (const gp_GTrsf& T) const { return Multiplied(T); } @@ -235,7 +235,7 @@ public: //! //! Raises an exception if N < 0 and if the matrix of the //! transformation not inversible. - gp_GTrsf Powered (const Standard_Integer N) const; + Standard_NODISCARD gp_GTrsf Powered (const Standard_Integer N) const; void Transforms (gp_XYZ& Coord) const; diff --git a/src/gp/gp_GTrsf2d.hxx b/src/gp/gp_GTrsf2d.hxx index 8ac5cd3250..e0dc5a512e 100644 --- a/src/gp/gp_GTrsf2d.hxx +++ b/src/gp/gp_GTrsf2d.hxx @@ -156,7 +156,7 @@ public: //! Computes the reverse transformation. //! Raised an exception if the matrix of the transformation //! is not inversible. - gp_GTrsf2d Inverted() const; + Standard_NODISCARD gp_GTrsf2d Inverted() const; //! Computes the transformation composed with T and . @@ -172,8 +172,8 @@ public: //! XY P2(P); //! T1.Transforms(P2); //using T1 then T2 //! T2.Transforms(P2); // P1 = P2 !!! - gp_GTrsf2d Multiplied (const gp_GTrsf2d& T) const; - gp_GTrsf2d operator * (const gp_GTrsf2d& T) const + Standard_NODISCARD gp_GTrsf2d Multiplied (const gp_GTrsf2d& T) const; + Standard_NODISCARD gp_GTrsf2d operator * (const gp_GTrsf2d& T) const { return Multiplied(T); } @@ -200,11 +200,11 @@ void operator *= (const gp_GTrsf2d& T) //! //! Raises an exception if N < 0 and if the matrix of the //! transformation is not inversible. - gp_GTrsf2d Powered (const Standard_Integer N) const; + Standard_NODISCARD gp_GTrsf2d Powered (const Standard_Integer N) const; void Transforms (gp_XY& Coord) const; - gp_XY Transformed (const gp_XY& Coord) const; + Standard_NODISCARD gp_XY Transformed (const gp_XY& Coord) const; //! Applies this transformation to the coordinates: diff --git a/src/gp/gp_Hypr.hxx b/src/gp/gp_Hypr.hxx index fb01300a2d..0bf0aa9114 100644 --- a/src/gp/gp_Hypr.hxx +++ b/src/gp/gp_Hypr.hxx @@ -251,14 +251,14 @@ public: //! Performs the symmetrical transformation of an hyperbola with //! respect to the point P which is the center of the symmetry. - Standard_EXPORT gp_Hypr Mirrored (const gp_Pnt& P) const; + Standard_EXPORT Standard_NODISCARD gp_Hypr Mirrored (const gp_Pnt& P) const; Standard_EXPORT void Mirror (const gp_Ax1& A1); //! Performs the symmetrical transformation of an hyperbola with //! respect to an axis placement which is the axis of the symmetry. - Standard_EXPORT gp_Hypr Mirrored (const gp_Ax1& A1) const; + Standard_EXPORT Standard_NODISCARD gp_Hypr Mirrored (const gp_Ax1& A1) const; Standard_EXPORT void Mirror (const gp_Ax2& A2); @@ -266,40 +266,40 @@ public: //! Performs the symmetrical transformation of an hyperbola with //! respect to a plane. The axis placement A2 locates the plane //! of the symmetry (Location, XDirection, YDirection). - Standard_EXPORT gp_Hypr Mirrored (const gp_Ax2& A2) const; + Standard_EXPORT Standard_NODISCARD gp_Hypr Mirrored (const gp_Ax2& A2) const; void Rotate (const gp_Ax1& A1, const Standard_Real Ang); //! Rotates an hyperbola. A1 is the axis of the rotation. //! Ang is the angular value of the rotation in radians. - gp_Hypr Rotated (const gp_Ax1& A1, const Standard_Real Ang) const; + Standard_NODISCARD gp_Hypr Rotated (const gp_Ax1& A1, const Standard_Real Ang) const; void Scale (const gp_Pnt& P, const Standard_Real S); //! Scales an hyperbola. S is the scaling value. - gp_Hypr Scaled (const gp_Pnt& P, const Standard_Real S) const; + Standard_NODISCARD gp_Hypr Scaled (const gp_Pnt& P, const Standard_Real S) const; void Transform (const gp_Trsf& T); //! Transforms an hyperbola with the transformation T from //! class Trsf. - gp_Hypr Transformed (const gp_Trsf& T) const; + Standard_NODISCARD gp_Hypr Transformed (const gp_Trsf& T) const; void Translate (const gp_Vec& V); //! Translates an hyperbola in the direction of the vector V. //! The magnitude of the translation is the vector's magnitude. - gp_Hypr Translated (const gp_Vec& V) const; + Standard_NODISCARD gp_Hypr Translated (const gp_Vec& V) const; void Translate (const gp_Pnt& P1, const gp_Pnt& P2); //! Translates an hyperbola from the point P1 to the point P2. - gp_Hypr Translated (const gp_Pnt& P1, const gp_Pnt& P2) const; + Standard_NODISCARD gp_Hypr Translated (const gp_Pnt& P1, const gp_Pnt& P2) const; diff --git a/src/gp/gp_Hypr2d.hxx b/src/gp/gp_Hypr2d.hxx index 8013f9d06b..98eeead645 100644 --- a/src/gp/gp_Hypr2d.hxx +++ b/src/gp/gp_Hypr2d.hxx @@ -268,7 +268,7 @@ public: //! Note: //! - Reverse assigns the result to this hyperbola, while //! - Reversed creates a new one. - gp_Hypr2d Reversed() const; + Standard_NODISCARD gp_Hypr2d Reversed() const; //! Returns true if the local coordinate system is direct //! and false in the other case. @@ -279,21 +279,21 @@ public: //! Performs the symmetrical transformation of an hyperbola with //! respect to the point P which is the center of the symmetry. - Standard_EXPORT gp_Hypr2d Mirrored (const gp_Pnt2d& P) const; + Standard_EXPORT Standard_NODISCARD gp_Hypr2d Mirrored (const gp_Pnt2d& P) const; Standard_EXPORT void Mirror (const gp_Ax2d& A); //! Performs the symmetrical transformation of an hyperbola with //! respect to an axis placement which is the axis of the symmetry. - Standard_EXPORT gp_Hypr2d Mirrored (const gp_Ax2d& A) const; + Standard_EXPORT Standard_NODISCARD gp_Hypr2d Mirrored (const gp_Ax2d& A) const; void Rotate (const gp_Pnt2d& P, const Standard_Real Ang); //! Rotates an hyperbola. P is the center of the rotation. //! Ang is the angular value of the rotation in radians. - gp_Hypr2d Rotated (const gp_Pnt2d& P, const Standard_Real Ang) const; + Standard_NODISCARD gp_Hypr2d Rotated (const gp_Pnt2d& P, const Standard_Real Ang) const; void Scale (const gp_Pnt2d& P, const Standard_Real S); @@ -302,27 +302,27 @@ public: //! If is positive only the location point is //! modified. But if is negative the "XAxis" is //! reversed and the "YAxis" too. - gp_Hypr2d Scaled (const gp_Pnt2d& P, const Standard_Real S) const; + Standard_NODISCARD gp_Hypr2d Scaled (const gp_Pnt2d& P, const Standard_Real S) const; void Transform (const gp_Trsf2d& T); //! Transforms an hyperbola with the transformation T from //! class Trsf2d. - gp_Hypr2d Transformed (const gp_Trsf2d& T) const; + Standard_NODISCARD gp_Hypr2d Transformed (const gp_Trsf2d& T) const; void Translate (const gp_Vec2d& V); //! Translates an hyperbola in the direction of the vector V. //! The magnitude of the translation is the vector's magnitude. - gp_Hypr2d Translated (const gp_Vec2d& V) const; + Standard_NODISCARD gp_Hypr2d Translated (const gp_Vec2d& V) const; void Translate (const gp_Pnt2d& P1, const gp_Pnt2d& P2); //! Translates an hyperbola from the point P1 to the point P2. - gp_Hypr2d Translated (const gp_Pnt2d& P1, const gp_Pnt2d& P2) const; + Standard_NODISCARD gp_Hypr2d Translated (const gp_Pnt2d& P1, const gp_Pnt2d& P2) const; diff --git a/src/gp/gp_Lin.hxx b/src/gp/gp_Lin.hxx index e7b143f4d8..20c2bbb321 100644 --- a/src/gp/gp_Lin.hxx +++ b/src/gp/gp_Lin.hxx @@ -71,7 +71,7 @@ public: //! Note: //! - Reverse assigns the result to this line, while //! - Reversed creates a new one. - gp_Lin Reversed() const; + Standard_NODISCARD gp_Lin Reversed() const; //! Changes the direction of the line. void SetDirection (const gp_Dir& V); @@ -132,7 +132,7 @@ public: //! Performs the symmetrical transformation of a line //! with respect to the point P which is the center of //! the symmetry. - Standard_EXPORT gp_Lin Mirrored (const gp_Pnt& P) const; + Standard_EXPORT Standard_NODISCARD gp_Lin Mirrored (const gp_Pnt& P) const; Standard_EXPORT void Mirror (const gp_Ax1& A1); @@ -140,7 +140,7 @@ public: //! Performs the symmetrical transformation of a line //! with respect to an axis placement which is the axis //! of the symmetry. - Standard_EXPORT gp_Lin Mirrored (const gp_Ax1& A1) const; + Standard_EXPORT Standard_NODISCARD gp_Lin Mirrored (const gp_Ax1& A1) const; Standard_EXPORT void Mirror (const gp_Ax2& A2); @@ -149,14 +149,14 @@ public: //! with respect to a plane. The axis placement //! locates the plane of the symmetry : //! (Location, XDirection, YDirection). - Standard_EXPORT gp_Lin Mirrored (const gp_Ax2& A2) const; + Standard_EXPORT Standard_NODISCARD gp_Lin Mirrored (const gp_Ax2& A2) const; void Rotate (const gp_Ax1& A1, const Standard_Real Ang); //! Rotates a line. A1 is the axis of the rotation. //! Ang is the angular value of the rotation in radians. - gp_Lin Rotated (const gp_Ax1& A1, const Standard_Real Ang) const; + Standard_NODISCARD gp_Lin Rotated (const gp_Ax1& A1, const Standard_Real Ang) const; void Scale (const gp_Pnt& P, const Standard_Real S); @@ -164,26 +164,26 @@ public: //! Scales a line. S is the scaling value. //! The "Location" point (origin) of the line is modified. //! The "Direction" is reversed if the scale is negative. - gp_Lin Scaled (const gp_Pnt& P, const Standard_Real S) const; + Standard_NODISCARD gp_Lin Scaled (const gp_Pnt& P, const Standard_Real S) const; void Transform (const gp_Trsf& T); //! Transforms a line with the transformation T from class Trsf. - gp_Lin Transformed (const gp_Trsf& T) const; + Standard_NODISCARD gp_Lin Transformed (const gp_Trsf& T) const; void Translate (const gp_Vec& V); //! Translates a line in the direction of the vector V. //! The magnitude of the translation is the vector's magnitude. - gp_Lin Translated (const gp_Vec& V) const; + Standard_NODISCARD gp_Lin Translated (const gp_Vec& V) const; void Translate (const gp_Pnt& P1, const gp_Pnt& P2); //! Translates a line from the point P1 to the point P2. - gp_Lin Translated (const gp_Pnt& P1, const gp_Pnt& P2) const; + Standard_NODISCARD gp_Lin Translated (const gp_Pnt& P1, const gp_Pnt& P2) const; diff --git a/src/gp/gp_Lin2d.hxx b/src/gp/gp_Lin2d.hxx index d8064342b0..681b343faf 100644 --- a/src/gp/gp_Lin2d.hxx +++ b/src/gp/gp_Lin2d.hxx @@ -79,7 +79,7 @@ public: //! Note: //! - Reverse assigns the result to this line, while //! - Reversed creates a new one. - gp_Lin2d Reversed() const; + Standard_NODISCARD gp_Lin2d Reversed() const; //! Changes the direction of the line. void SetDirection (const gp_Dir2d& V); @@ -143,7 +143,7 @@ public: //! Performs the symmetrical transformation of a line //! with respect to the point

which is the center //! of the symmetry - Standard_EXPORT gp_Lin2d Mirrored (const gp_Pnt2d& P) const; + Standard_EXPORT Standard_NODISCARD gp_Lin2d Mirrored (const gp_Pnt2d& P) const; Standard_EXPORT void Mirror (const gp_Ax2d& A); @@ -151,40 +151,40 @@ public: //! Performs the symmetrical transformation of a line //! with respect to an axis placement which is the axis //! of the symmetry. - Standard_EXPORT gp_Lin2d Mirrored (const gp_Ax2d& A) const; + Standard_EXPORT Standard_NODISCARD gp_Lin2d Mirrored (const gp_Ax2d& A) const; void Rotate (const gp_Pnt2d& P, const Standard_Real Ang); //! Rotates a line. P is the center of the rotation. //! Ang is the angular value of the rotation in radians. - gp_Lin2d Rotated (const gp_Pnt2d& P, const Standard_Real Ang) const; + Standard_NODISCARD gp_Lin2d Rotated (const gp_Pnt2d& P, const Standard_Real Ang) const; void Scale (const gp_Pnt2d& P, const Standard_Real S); //! Scales a line. S is the scaling value. Only the //! origin of the line is modified. - gp_Lin2d Scaled (const gp_Pnt2d& P, const Standard_Real S) const; + Standard_NODISCARD gp_Lin2d Scaled (const gp_Pnt2d& P, const Standard_Real S) const; void Transform (const gp_Trsf2d& T); //! Transforms a line with the transformation T from class Trsf2d. - gp_Lin2d Transformed (const gp_Trsf2d& T) const; + Standard_NODISCARD gp_Lin2d Transformed (const gp_Trsf2d& T) const; void Translate (const gp_Vec2d& V); //! Translates a line in the direction of the vector V. //! The magnitude of the translation is the vector's magnitude. - gp_Lin2d Translated (const gp_Vec2d& V) const; + Standard_NODISCARD gp_Lin2d Translated (const gp_Vec2d& V) const; void Translate (const gp_Pnt2d& P1, const gp_Pnt2d& P2); //! Translates a line from the point P1 to the point P2. - gp_Lin2d Translated (const gp_Pnt2d& P1, const gp_Pnt2d& P2) const; + Standard_NODISCARD gp_Lin2d Translated (const gp_Pnt2d& P1, const gp_Pnt2d& P2) const; diff --git a/src/gp/gp_Mat.hxx b/src/gp/gp_Mat.hxx index 956efbc3a4..16fc2f2144 100644 --- a/src/gp/gp_Mat.hxx +++ b/src/gp/gp_Mat.hxx @@ -159,8 +159,8 @@ public: //! Computes the sum of this matrix and //! the matrix Other for each coefficient of the matrix : //! .Coef(i,j) + .Coef(i,j) - gp_Mat Added (const gp_Mat& Other) const; - gp_Mat operator + (const gp_Mat& Other) const + Standard_NODISCARD gp_Mat Added (const gp_Mat& Other) const; + Standard_NODISCARD gp_Mat operator + (const gp_Mat& Other) const { return Added(Other); } @@ -172,8 +172,8 @@ public: } //! Divides all the coefficients of the matrix by Scalar - gp_Mat Divided (const Standard_Real Scalar) const; - gp_Mat operator / (const Standard_Real Scalar) const + Standard_NODISCARD gp_Mat Divided (const Standard_Real Scalar) const; + Standard_NODISCARD gp_Mat operator / (const Standard_Real Scalar) const { return Divided(Scalar); } @@ -191,12 +191,12 @@ public: //! Exceptions //! Standard_ConstructionError if this matrix is singular, //! and therefore cannot be inverted. - Standard_EXPORT gp_Mat Inverted() const; + Standard_NODISCARD Standard_EXPORT gp_Mat Inverted() const; //! Computes the product of two matrices * - gp_Mat Multiplied (const gp_Mat& Other) const; - gp_Mat operator * (const gp_Mat& Other) const + Standard_NODISCARD gp_Mat Multiplied (const gp_Mat& Other) const; + Standard_NODISCARD gp_Mat operator * (const gp_Mat& Other) const { return Multiplied(Other); } @@ -210,8 +210,8 @@ public: void PreMultiply (const gp_Mat& Other); - gp_Mat Multiplied (const Standard_Real Scalar) const; - gp_Mat operator * (const Standard_Real Scalar) const + Standard_NODISCARD gp_Mat Multiplied (const Standard_Real Scalar) const; + Standard_NODISCARD gp_Mat operator * (const Standard_Real Scalar) const { return Multiplied(Scalar); } @@ -232,7 +232,7 @@ public: //! if N < 0 = .Invert() *...........* .Invert(). //! If N < 0 an exception will be raised if the matrix is not //! inversible - gp_Mat Powered (const Standard_Integer N) const; + Standard_NODISCARD gp_Mat Powered (const Standard_Integer N) const; void Subtract (const gp_Mat& Other); void operator -= (const gp_Mat& Other) @@ -243,8 +243,8 @@ public: //! cOmputes for each coefficient of the matrix : //! .Coef(i,j) - .Coef(i,j) - gp_Mat Subtracted (const gp_Mat& Other) const; - gp_Mat operator - (const gp_Mat& Other) const + Standard_NODISCARD gp_Mat Subtracted (const gp_Mat& Other) const; + Standard_NODISCARD gp_Mat operator - (const gp_Mat& Other) const { return Subtracted(Other); } @@ -253,7 +253,7 @@ public: //! Transposes the matrix. A(j, i) -> A (i, j) - gp_Mat Transposed() const; + Standard_NODISCARD gp_Mat Transposed() const; friend class gp_XYZ; diff --git a/src/gp/gp_Mat2d.hxx b/src/gp/gp_Mat2d.hxx index ffa4ecaa35..f4a1dc69bd 100644 --- a/src/gp/gp_Mat2d.hxx +++ b/src/gp/gp_Mat2d.hxx @@ -139,8 +139,8 @@ public: //! Note: //! - operator += assigns the result to this matrix, while //! - operator + creates a new one. - gp_Mat2d Added (const gp_Mat2d& Other) const; - gp_Mat2d operator + (const gp_Mat2d& Other) const + Standard_NODISCARD gp_Mat2d Added (const gp_Mat2d& Other) const; + Standard_NODISCARD gp_Mat2d operator + (const gp_Mat2d& Other) const { return Added(Other); } @@ -153,8 +153,8 @@ public: //! Divides all the coefficients of the matrix by a scalar. - gp_Mat2d Divided (const Standard_Real Scalar) const; - gp_Mat2d operator / (const Standard_Real Scalar) const + Standard_NODISCARD gp_Mat2d Divided (const Standard_Real Scalar) const; + Standard_NODISCARD gp_Mat2d operator / (const Standard_Real Scalar) const { return Divided(Scalar); } @@ -164,10 +164,10 @@ public: //! Inverses the matrix and raises exception if the matrix //! is singular. - gp_Mat2d Inverted() const; + Standard_NODISCARD gp_Mat2d Inverted() const; - gp_Mat2d Multiplied (const gp_Mat2d& Other) const; - gp_Mat2d operator * (const gp_Mat2d& Other) const + Standard_NODISCARD gp_Mat2d Multiplied (const gp_Mat2d& Other) const; + Standard_NODISCARD gp_Mat2d operator * (const gp_Mat2d& Other) const { return Multiplied(Other); } @@ -180,8 +180,8 @@ public: //! = Other * . void PreMultiply (const gp_Mat2d& Other); - gp_Mat2d Multiplied (const Standard_Real Scalar) const; - gp_Mat2d operator * (const Standard_Real Scalar) const + Standard_NODISCARD gp_Mat2d Multiplied (const Standard_Real Scalar) const; + Standard_NODISCARD gp_Mat2d operator * (const Standard_Real Scalar) const { return Multiplied(Scalar); } @@ -202,7 +202,7 @@ public: //! if N < 0 = .Invert() *...........* .Invert(). //! If N < 0 an exception can be raised if the matrix is not //! inversible - gp_Mat2d Powered (const Standard_Integer N) const; + Standard_NODISCARD gp_Mat2d Powered (const Standard_Integer N) const; void Subtract (const gp_Mat2d& Other); void operator -= (const gp_Mat2d& Other) @@ -213,8 +213,8 @@ public: //! Computes for each coefficient of the matrix : //! .Coef(i,j) - .Coef(i,j) - gp_Mat2d Subtracted (const gp_Mat2d& Other) const; - gp_Mat2d operator - (const gp_Mat2d& Other) const + Standard_NODISCARD gp_Mat2d Subtracted (const gp_Mat2d& Other) const; + Standard_NODISCARD gp_Mat2d operator - (const gp_Mat2d& Other) const { return Subtracted(Other); } @@ -223,7 +223,7 @@ public: //! Transposes the matrix. A(j, i) -> A (i, j) - gp_Mat2d Transposed() const; + Standard_NODISCARD gp_Mat2d Transposed() const; friend class gp_Trsf2d; diff --git a/src/gp/gp_Parab.hxx b/src/gp/gp_Parab.hxx index 8b7b3e488e..eb1e78cf73 100644 --- a/src/gp/gp_Parab.hxx +++ b/src/gp/gp_Parab.hxx @@ -165,7 +165,7 @@ public: //! Performs the symmetrical transformation of a parabola //! with respect to the point P which is the center of the //! symmetry. - Standard_EXPORT gp_Parab Mirrored (const gp_Pnt& P) const; + Standard_EXPORT Standard_NODISCARD gp_Parab Mirrored (const gp_Pnt& P) const; Standard_EXPORT void Mirror (const gp_Ax1& A1); @@ -173,7 +173,7 @@ public: //! Performs the symmetrical transformation of a parabola //! with respect to an axis placement which is the axis of //! the symmetry. - Standard_EXPORT gp_Parab Mirrored (const gp_Ax1& A1) const; + Standard_EXPORT Standard_NODISCARD gp_Parab Mirrored (const gp_Ax1& A1) const; Standard_EXPORT void Mirror (const gp_Ax2& A2); @@ -181,14 +181,14 @@ public: //! Performs the symmetrical transformation of a parabola //! with respect to a plane. The axis placement A2 locates //! the plane of the symmetry (Location, XDirection, YDirection). - Standard_EXPORT gp_Parab Mirrored (const gp_Ax2& A2) const; + Standard_EXPORT Standard_NODISCARD gp_Parab Mirrored (const gp_Ax2& A2) const; void Rotate (const gp_Ax1& A1, const Standard_Real Ang); //! Rotates a parabola. A1 is the axis of the rotation. //! Ang is the angular value of the rotation in radians. - gp_Parab Rotated (const gp_Ax1& A1, const Standard_Real Ang) const; + Standard_NODISCARD gp_Parab Rotated (const gp_Ax1& A1, const Standard_Real Ang) const; void Scale (const gp_Pnt& P, const Standard_Real S); @@ -196,26 +196,26 @@ public: //! Scales a parabola. S is the scaling value. //! If S is negative the direction of the symmetry axis //! XAxis is reversed and the direction of the YAxis too. - gp_Parab Scaled (const gp_Pnt& P, const Standard_Real S) const; + Standard_NODISCARD gp_Parab Scaled (const gp_Pnt& P, const Standard_Real S) const; void Transform (const gp_Trsf& T); //! Transforms a parabola with the transformation T from class Trsf. - gp_Parab Transformed (const gp_Trsf& T) const; + Standard_NODISCARD gp_Parab Transformed (const gp_Trsf& T) const; void Translate (const gp_Vec& V); //! Translates a parabola in the direction of the vector V. //! The magnitude of the translation is the vector's magnitude. - gp_Parab Translated (const gp_Vec& V) const; + Standard_NODISCARD gp_Parab Translated (const gp_Vec& V) const; void Translate (const gp_Pnt& P1, const gp_Pnt& P2); //! Translates a parabola from the point P1 to the point P2. - gp_Parab Translated (const gp_Pnt& P1, const gp_Pnt& P2) const; + Standard_NODISCARD gp_Parab Translated (const gp_Pnt& P1, const gp_Pnt& P2) const; diff --git a/src/gp/gp_Parab2d.hxx b/src/gp/gp_Parab2d.hxx index f7661cec56..2f5ca6ffb9 100644 --- a/src/gp/gp_Parab2d.hxx +++ b/src/gp/gp_Parab2d.hxx @@ -177,7 +177,7 @@ public: //! Note: //! - Reverse assigns the result to this parabola, while //! - Reversed creates a new one. - gp_Parab2d Reversed() const; + Standard_NODISCARD gp_Parab2d Reversed() const; //! Returns true if the local coordinate system is direct //! and false in the other case. @@ -188,21 +188,21 @@ public: //! Performs the symmetrical transformation of a parabola with respect //! to the point P which is the center of the symmetry - Standard_EXPORT gp_Parab2d Mirrored (const gp_Pnt2d& P) const; + Standard_EXPORT Standard_NODISCARD gp_Parab2d Mirrored (const gp_Pnt2d& P) const; Standard_EXPORT void Mirror (const gp_Ax2d& A); //! Performs the symmetrical transformation of a parabola with respect //! to an axis placement which is the axis of the symmetry. - Standard_EXPORT gp_Parab2d Mirrored (const gp_Ax2d& A) const; + Standard_EXPORT Standard_NODISCARD gp_Parab2d Mirrored (const gp_Ax2d& A) const; void Rotate (const gp_Pnt2d& P, const Standard_Real Ang); //! Rotates a parabola. P is the center of the rotation. //! Ang is the angular value of the rotation in radians. - gp_Parab2d Rotated (const gp_Pnt2d& P, const Standard_Real Ang) const; + Standard_NODISCARD gp_Parab2d Rotated (const gp_Pnt2d& P, const Standard_Real Ang) const; void Scale (const gp_Pnt2d& P, const Standard_Real S); @@ -210,26 +210,26 @@ public: //! Scales a parabola. S is the scaling value. //! If S is negative the direction of the symmetry axis //! "XAxis" is reversed and the direction of the "YAxis" too. - gp_Parab2d Scaled (const gp_Pnt2d& P, const Standard_Real S) const; + Standard_NODISCARD gp_Parab2d Scaled (const gp_Pnt2d& P, const Standard_Real S) const; void Transform (const gp_Trsf2d& T); //! Transforms an parabola with the transformation T from class Trsf2d. - gp_Parab2d Transformed (const gp_Trsf2d& T) const; + Standard_NODISCARD gp_Parab2d Transformed (const gp_Trsf2d& T) const; void Translate (const gp_Vec2d& V); //! Translates a parabola in the direction of the vector V. //! The magnitude of the translation is the vector's magnitude. - gp_Parab2d Translated (const gp_Vec2d& V) const; + Standard_NODISCARD gp_Parab2d Translated (const gp_Vec2d& V) const; void Translate (const gp_Pnt2d& P1, const gp_Pnt2d& P2); //! Translates a parabola from the point P1 to the point P2. - gp_Parab2d Translated (const gp_Pnt2d& P1, const gp_Pnt2d& P2) const; + Standard_NODISCARD gp_Parab2d Translated (const gp_Pnt2d& P1, const gp_Pnt2d& P2) const; diff --git a/src/gp/gp_Pln.hxx b/src/gp/gp_Pln.hxx index 17009abf9d..7306114afa 100644 --- a/src/gp/gp_Pln.hxx +++ b/src/gp/gp_Pln.hxx @@ -178,7 +178,7 @@ public: //! Warnings : //! The normal direction to the plane is not changed. //! The "XAxis" and the "YAxis" are reversed. - Standard_EXPORT gp_Pln Mirrored (const gp_Pnt& P) const; + Standard_EXPORT Standard_NODISCARD gp_Pln Mirrored (const gp_Pnt& P) const; Standard_EXPORT void Mirror (const gp_Ax1& A1); @@ -190,7 +190,7 @@ public: //! the "XDirection" and the "YDirection" after transformation //! if the initial plane was right handed, else it is the //! opposite. - Standard_EXPORT gp_Pln Mirrored (const gp_Ax1& A1) const; + Standard_EXPORT Standard_NODISCARD gp_Pln Mirrored (const gp_Ax1& A1) const; Standard_EXPORT void Mirror (const gp_Ax2& A2); @@ -202,20 +202,20 @@ public: //! direction is the cross product between the "XDirection" //! and the "YDirection" after transformation if the initial //! plane was right handed, else it is the opposite. - Standard_EXPORT gp_Pln Mirrored (const gp_Ax2& A2) const; + Standard_EXPORT Standard_NODISCARD gp_Pln Mirrored (const gp_Ax2& A2) const; void Rotate (const gp_Ax1& A1, const Standard_Real Ang); //! rotates a plane. A1 is the axis of the rotation. //! Ang is the angular value of the rotation in radians. - gp_Pln Rotated (const gp_Ax1& A1, const Standard_Real Ang) const; + Standard_NODISCARD gp_Pln Rotated (const gp_Ax1& A1, const Standard_Real Ang) const; void Scale (const gp_Pnt& P, const Standard_Real S); //! Scales a plane. S is the scaling value. - gp_Pln Scaled (const gp_Pnt& P, const Standard_Real S) const; + Standard_NODISCARD gp_Pln Scaled (const gp_Pnt& P, const Standard_Real S) const; void Transform (const gp_Trsf& T); @@ -225,20 +225,20 @@ public: //! point, on the "XAxis" and the "YAxis". //! The resulting normal direction is the cross product between //! the "XDirection" and the "YDirection" after transformation. - gp_Pln Transformed (const gp_Trsf& T) const; + Standard_NODISCARD gp_Pln Transformed (const gp_Trsf& T) const; void Translate (const gp_Vec& V); //! Translates a plane in the direction of the vector V. //! The magnitude of the translation is the vector's magnitude. - gp_Pln Translated (const gp_Vec& V) const; + Standard_NODISCARD gp_Pln Translated (const gp_Vec& V) const; void Translate (const gp_Pnt& P1, const gp_Pnt& P2); //! Translates a plane from the point P1 to the point P2. - gp_Pln Translated (const gp_Pnt& P1, const gp_Pnt& P2) const; + Standard_NODISCARD gp_Pln Translated (const gp_Pnt& P1, const gp_Pnt& P2) const; diff --git a/src/gp/gp_Pnt.hxx b/src/gp/gp_Pnt.hxx index 5b1f71abeb..509600961c 100644 --- a/src/gp/gp_Pnt.hxx +++ b/src/gp/gp_Pnt.hxx @@ -129,7 +129,7 @@ public: //! Performs the symmetrical transformation of a point //! with respect to an axis placement which is the axis //! of the symmetry. - Standard_EXPORT gp_Pnt Mirrored (const gp_Pnt& P) const; + Standard_EXPORT Standard_NODISCARD gp_Pnt Mirrored (const gp_Pnt& P) const; Standard_EXPORT void Mirror (const gp_Ax1& A1); @@ -137,41 +137,41 @@ public: //! Performs the symmetrical transformation of a point //! with respect to a plane. The axis placement A2 locates //! the plane of the symmetry : (Location, XDirection, YDirection). - Standard_EXPORT gp_Pnt Mirrored (const gp_Ax1& A1) const; + Standard_EXPORT Standard_NODISCARD gp_Pnt Mirrored (const gp_Ax1& A1) const; Standard_EXPORT void Mirror (const gp_Ax2& A2); //! Rotates a point. A1 is the axis of the rotation. //! Ang is the angular value of the rotation in radians. - Standard_EXPORT gp_Pnt Mirrored (const gp_Ax2& A2) const; + Standard_EXPORT Standard_NODISCARD gp_Pnt Mirrored (const gp_Ax2& A2) const; void Rotate (const gp_Ax1& A1, const Standard_Real Ang); //! Scales a point. S is the scaling value. - gp_Pnt Rotated (const gp_Ax1& A1, const Standard_Real Ang) const; + Standard_NODISCARD gp_Pnt Rotated (const gp_Ax1& A1, const Standard_Real Ang) const; void Scale (const gp_Pnt& P, const Standard_Real S); //! Transforms a point with the transformation T. - gp_Pnt Scaled (const gp_Pnt& P, const Standard_Real S) const; + Standard_NODISCARD gp_Pnt Scaled (const gp_Pnt& P, const Standard_Real S) const; Standard_EXPORT void Transform (const gp_Trsf& T); //! Translates a point in the direction of the vector V. //! The magnitude of the translation is the vector's magnitude. - gp_Pnt Transformed (const gp_Trsf& T) const; + Standard_NODISCARD gp_Pnt Transformed (const gp_Trsf& T) const; void Translate (const gp_Vec& V); //! Translates a point from the point P1 to the point P2. - gp_Pnt Translated (const gp_Vec& V) const; + Standard_NODISCARD gp_Pnt Translated (const gp_Vec& V) const; void Translate (const gp_Pnt& P1, const gp_Pnt& P2); - gp_Pnt Translated (const gp_Pnt& P1, const gp_Pnt& P2) const; + Standard_NODISCARD gp_Pnt Translated (const gp_Pnt& P1, const gp_Pnt& P2) const; diff --git a/src/gp/gp_Pnt2d.hxx b/src/gp/gp_Pnt2d.hxx index d6073ec337..f991621ae1 100644 --- a/src/gp/gp_Pnt2d.hxx +++ b/src/gp/gp_Pnt2d.hxx @@ -114,41 +114,41 @@ public: //! Performs the symmetrical transformation of a point //! with respect to an axis placement which is the axis - Standard_EXPORT gp_Pnt2d Mirrored (const gp_Pnt2d& P) const; + Standard_EXPORT Standard_NODISCARD gp_Pnt2d Mirrored (const gp_Pnt2d& P) const; Standard_EXPORT void Mirror (const gp_Ax2d& A); //! Rotates a point. A1 is the axis of the rotation. //! Ang is the angular value of the rotation in radians. - Standard_EXPORT gp_Pnt2d Mirrored (const gp_Ax2d& A) const; + Standard_EXPORT Standard_NODISCARD gp_Pnt2d Mirrored (const gp_Ax2d& A) const; void Rotate (const gp_Pnt2d& P, const Standard_Real Ang); //! Scales a point. S is the scaling value. - gp_Pnt2d Rotated (const gp_Pnt2d& P, const Standard_Real Ang) const; + Standard_NODISCARD gp_Pnt2d Rotated (const gp_Pnt2d& P, const Standard_Real Ang) const; void Scale (const gp_Pnt2d& P, const Standard_Real S); //! Transforms a point with the transformation T. - gp_Pnt2d Scaled (const gp_Pnt2d& P, const Standard_Real S) const; + Standard_NODISCARD gp_Pnt2d Scaled (const gp_Pnt2d& P, const Standard_Real S) const; Standard_EXPORT void Transform (const gp_Trsf2d& T); //! Translates a point in the direction of the vector V. //! The magnitude of the translation is the vector's magnitude. - gp_Pnt2d Transformed (const gp_Trsf2d& T) const; + Standard_NODISCARD gp_Pnt2d Transformed (const gp_Trsf2d& T) const; void Translate (const gp_Vec2d& V); //! Translates a point from the point P1 to the point P2. - gp_Pnt2d Translated (const gp_Vec2d& V) const; + Standard_NODISCARD gp_Pnt2d Translated (const gp_Vec2d& V) const; void Translate (const gp_Pnt2d& P1, const gp_Pnt2d& P2); - gp_Pnt2d Translated (const gp_Pnt2d& P1, const gp_Pnt2d& P2) const; + Standard_NODISCARD gp_Pnt2d Translated (const gp_Pnt2d& P1, const gp_Pnt2d& P2) const; diff --git a/src/gp/gp_Quaternion.hxx b/src/gp/gp_Quaternion.hxx index 9a84169e2c..6b1ebdb5ad 100644 --- a/src/gp/gp_Quaternion.hxx +++ b/src/gp/gp_Quaternion.hxx @@ -128,13 +128,13 @@ public: void Reverse(); //! Return rotation with reversed direction (conjugated quaternion) - gp_Quaternion Reversed() const; + Standard_NODISCARD gp_Quaternion Reversed() const; //! Inverts quaternion (both rotation direction and norm) void Invert(); //! Return inversed quaternion q^-1 - gp_Quaternion Inverted() const; + Standard_NODISCARD gp_Quaternion Inverted() const; //! Returns square norm of quaternion Standard_Real SquareNorm() const; @@ -151,8 +151,8 @@ void operator *= (const Standard_Real theScale) } //! Returns scaled quaternion - gp_Quaternion Scaled (const Standard_Real theScale) const; -gp_Quaternion operator * (const Standard_Real theScale) const +Standard_NODISCARD gp_Quaternion Scaled (const Standard_Real theScale) const; +Standard_NODISCARD gp_Quaternion operator * (const Standard_Real theScale) const { return Scaled(theScale); } @@ -168,27 +168,27 @@ gp_Quaternion operator * (const Standard_Real theScale) const Standard_EXPORT void Normalize(); //! Returns quaternion scaled so that its norm goes to 1. - gp_Quaternion Normalized() const; + Standard_NODISCARD gp_Quaternion Normalized() const; //! Returns quaternion with all components negated. //! Note that this operation does not affect neither //! rotation operator defined by quaternion nor its norm. - gp_Quaternion Negated() const; -gp_Quaternion operator -() const + Standard_NODISCARD gp_Quaternion Negated() const; +Standard_NODISCARD gp_Quaternion operator -() const { return Negated(); } //! Makes sum of quaternion components; result is "rotations mix" - gp_Quaternion Added (const gp_Quaternion& theOther) const; -gp_Quaternion operator + (const gp_Quaternion& theOther) const +Standard_NODISCARD gp_Quaternion Added (const gp_Quaternion& theOther) const; +Standard_NODISCARD gp_Quaternion operator + (const gp_Quaternion& theOther) const { return Added(theOther); } //! Makes difference of quaternion components; result is "rotations mix" - gp_Quaternion Subtracted (const gp_Quaternion& theOther) const; -gp_Quaternion operator - (const gp_Quaternion& theOther) const +Standard_NODISCARD gp_Quaternion Subtracted (const gp_Quaternion& theOther) const; +Standard_NODISCARD gp_Quaternion operator - (const gp_Quaternion& theOther) const { return Subtracted(theOther); } @@ -199,8 +199,8 @@ gp_Quaternion operator - (const gp_Quaternion& theOther) const //! Notices than: //! qq' != q'q; //! qq^-1 = q; - gp_Quaternion Multiplied (const gp_Quaternion& theOther) const; -gp_Quaternion operator * (const gp_Quaternion& theOther) const +Standard_NODISCARD gp_Quaternion Multiplied (const gp_Quaternion& theOther) const; +Standard_NODISCARD gp_Quaternion operator * (const gp_Quaternion& theOther) const { return Multiplied(theOther); } diff --git a/src/gp/gp_Sphere.hxx b/src/gp/gp_Sphere.hxx index af8a05bef4..83e07984da 100644 --- a/src/gp/gp_Sphere.hxx +++ b/src/gp/gp_Sphere.hxx @@ -132,7 +132,7 @@ public: //! Performs the symmetrical transformation of a sphere //! with respect to the point P which is the center of the //! symmetry. - Standard_EXPORT gp_Sphere Mirrored (const gp_Pnt& P) const; + Standard_EXPORT Standard_NODISCARD gp_Sphere Mirrored (const gp_Pnt& P) const; Standard_EXPORT void Mirror (const gp_Ax1& A1); @@ -140,7 +140,7 @@ public: //! Performs the symmetrical transformation of a sphere with //! respect to an axis placement which is the axis of the //! symmetry. - Standard_EXPORT gp_Sphere Mirrored (const gp_Ax1& A1) const; + Standard_EXPORT Standard_NODISCARD gp_Sphere Mirrored (const gp_Ax1& A1) const; Standard_EXPORT void Mirror (const gp_Ax2& A2); @@ -148,40 +148,40 @@ public: //! Performs the symmetrical transformation of a sphere with respect //! to a plane. The axis placement A2 locates the plane of the //! of the symmetry : (Location, XDirection, YDirection). - Standard_EXPORT gp_Sphere Mirrored (const gp_Ax2& A2) const; + Standard_EXPORT Standard_NODISCARD gp_Sphere Mirrored (const gp_Ax2& A2) const; void Rotate (const gp_Ax1& A1, const Standard_Real Ang); //! Rotates a sphere. A1 is the axis of the rotation. //! Ang is the angular value of the rotation in radians. - gp_Sphere Rotated (const gp_Ax1& A1, const Standard_Real Ang) const; + Standard_NODISCARD gp_Sphere Rotated (const gp_Ax1& A1, const Standard_Real Ang) const; void Scale (const gp_Pnt& P, const Standard_Real S); //! Scales a sphere. S is the scaling value. //! The absolute value of S is used to scale the sphere - gp_Sphere Scaled (const gp_Pnt& P, const Standard_Real S) const; + Standard_NODISCARD gp_Sphere Scaled (const gp_Pnt& P, const Standard_Real S) const; void Transform (const gp_Trsf& T); //! Transforms a sphere with the transformation T from class Trsf. - gp_Sphere Transformed (const gp_Trsf& T) const; + Standard_NODISCARD gp_Sphere Transformed (const gp_Trsf& T) const; void Translate (const gp_Vec& V); //! Translates a sphere in the direction of the vector V. //! The magnitude of the translation is the vector's magnitude. - gp_Sphere Translated (const gp_Vec& V) const; + Standard_NODISCARD gp_Sphere Translated (const gp_Vec& V) const; void Translate (const gp_Pnt& P1, const gp_Pnt& P2); //! Translates a sphere from the point P1 to the point P2. - gp_Sphere Translated (const gp_Pnt& P1, const gp_Pnt& P2) const; + Standard_NODISCARD gp_Sphere Translated (const gp_Pnt& P1, const gp_Pnt& P2) const; diff --git a/src/gp/gp_Torus.hxx b/src/gp/gp_Torus.hxx index 69279b3a31..a9900f87b2 100644 --- a/src/gp/gp_Torus.hxx +++ b/src/gp/gp_Torus.hxx @@ -174,7 +174,7 @@ public: //! Performs the symmetrical transformation of a torus //! with respect to the point P which is the center of the //! symmetry. - Standard_EXPORT gp_Torus Mirrored (const gp_Pnt& P) const; + Standard_EXPORT Standard_NODISCARD gp_Torus Mirrored (const gp_Pnt& P) const; Standard_EXPORT void Mirror (const gp_Ax1& A1); @@ -182,7 +182,7 @@ public: //! Performs the symmetrical transformation of a torus with //! respect to an axis placement which is the axis of the //! symmetry. - Standard_EXPORT gp_Torus Mirrored (const gp_Ax1& A1) const; + Standard_EXPORT Standard_NODISCARD gp_Torus Mirrored (const gp_Ax1& A1) const; Standard_EXPORT void Mirror (const gp_Ax2& A2); @@ -190,40 +190,40 @@ public: //! Performs the symmetrical transformation of a torus with respect //! to a plane. The axis placement A2 locates the plane of the //! of the symmetry : (Location, XDirection, YDirection). - Standard_EXPORT gp_Torus Mirrored (const gp_Ax2& A2) const; + Standard_EXPORT Standard_NODISCARD gp_Torus Mirrored (const gp_Ax2& A2) const; void Rotate (const gp_Ax1& A1, const Standard_Real Ang); //! Rotates a torus. A1 is the axis of the rotation. //! Ang is the angular value of the rotation in radians. - gp_Torus Rotated (const gp_Ax1& A1, const Standard_Real Ang) const; + Standard_NODISCARD gp_Torus Rotated (const gp_Ax1& A1, const Standard_Real Ang) const; void Scale (const gp_Pnt& P, const Standard_Real S); //! Scales a torus. S is the scaling value. //! The absolute value of S is used to scale the torus - gp_Torus Scaled (const gp_Pnt& P, const Standard_Real S) const; + Standard_NODISCARD gp_Torus Scaled (const gp_Pnt& P, const Standard_Real S) const; void Transform (const gp_Trsf& T); //! Transforms a torus with the transformation T from class Trsf. - gp_Torus Transformed (const gp_Trsf& T) const; + Standard_NODISCARD gp_Torus Transformed (const gp_Trsf& T) const; void Translate (const gp_Vec& V); //! Translates a torus in the direction of the vector V. //! The magnitude of the translation is the vector's magnitude. - gp_Torus Translated (const gp_Vec& V) const; + Standard_NODISCARD gp_Torus Translated (const gp_Vec& V) const; void Translate (const gp_Pnt& P1, const gp_Pnt& P2); //! Translates a torus from the point P1 to the point P2. - gp_Torus Translated (const gp_Pnt& P1, const gp_Pnt& P2) const; + Standard_NODISCARD gp_Torus Translated (const gp_Pnt& P1, const gp_Pnt& P2) const; diff --git a/src/gp/gp_Trsf.hxx b/src/gp/gp_Trsf.hxx index 7965f0f93e..ebb05bfbd3 100644 --- a/src/gp/gp_Trsf.hxx +++ b/src/gp/gp_Trsf.hxx @@ -282,10 +282,10 @@ public: //! Pnt P2 = P1.Transformed(Tcomp); //using Tcomp //! Pnt P3 = P1.Transformed(T1); //using T1 then T2 //! P3.Transform(T2); // P3 = P2 !!! - gp_Trsf Inverted() const; + Standard_NODISCARD gp_Trsf Inverted() const; - gp_Trsf Multiplied (const gp_Trsf& T) const; - gp_Trsf operator * (const gp_Trsf& T) const + Standard_NODISCARD gp_Trsf Multiplied (const gp_Trsf& T) const; + Standard_NODISCARD gp_Trsf operator * (const gp_Trsf& T) const { return Multiplied(T); } @@ -314,7 +314,7 @@ void operator *= (const gp_Trsf& T) //! //! Raises if N < 0 and if the matrix of the transformation not //! inversible. - gp_Trsf Powered (const Standard_Integer N) const; + Standard_NODISCARD gp_Trsf Powered (const Standard_Integer N) const; void Transforms (Standard_Real& X, Standard_Real& Y, Standard_Real& Z) const; diff --git a/src/gp/gp_Trsf2d.hxx b/src/gp/gp_Trsf2d.hxx index 1890739d8b..acc60edb86 100644 --- a/src/gp/gp_Trsf2d.hxx +++ b/src/gp/gp_Trsf2d.hxx @@ -164,10 +164,10 @@ public: //! Raises an exception if the matrix of the transformation //! is not inversible, it means that the scale factor is lower //! or equal to Resolution from package gp. - gp_Trsf2d Inverted() const; + Standard_NODISCARD gp_Trsf2d Inverted() const; - gp_Trsf2d Multiplied (const gp_Trsf2d& T) const; - gp_Trsf2d operator * (const gp_Trsf2d& T) const + Standard_NODISCARD gp_Trsf2d Multiplied (const gp_Trsf2d& T) const; + Standard_NODISCARD gp_Trsf2d operator * (const gp_Trsf2d& T) const { return Multiplied(T); } diff --git a/src/gp/gp_Vec.hxx b/src/gp/gp_Vec.hxx index 50cbfa94c1..689c2ece92 100644 --- a/src/gp/gp_Vec.hxx +++ b/src/gp/gp_Vec.hxx @@ -173,8 +173,8 @@ public: } //! Adds two vectors - gp_Vec Added (const gp_Vec& Other) const; - gp_Vec operator + (const gp_Vec& Other) const + Standard_NODISCARD gp_Vec Added (const gp_Vec& Other) const; + Standard_NODISCARD gp_Vec operator + (const gp_Vec& Other) const { return Added(Other); } @@ -187,8 +187,8 @@ public: } //! Subtracts two vectors - gp_Vec Subtracted (const gp_Vec& Right) const; - gp_Vec operator - (const gp_Vec& Right) const + Standard_NODISCARD gp_Vec Subtracted (const gp_Vec& Right) const; + Standard_NODISCARD gp_Vec operator - (const gp_Vec& Right) const { return Subtracted(Right); } @@ -201,8 +201,8 @@ public: } //! Multiplies a vector by a scalar - gp_Vec Multiplied (const Standard_Real Scalar) const; - gp_Vec operator * (const Standard_Real Scalar) const + Standard_NODISCARD gp_Vec Multiplied (const Standard_Real Scalar) const; + Standard_NODISCARD gp_Vec operator * (const Standard_Real Scalar) const { return Multiplied(Scalar); } @@ -215,8 +215,8 @@ public: } //! Divides a vector by a scalar - gp_Vec Divided (const Standard_Real Scalar) const; - gp_Vec operator / (const Standard_Real Scalar) const + Standard_NODISCARD gp_Vec Divided (const Standard_Real Scalar) const; + Standard_NODISCARD gp_Vec operator / (const Standard_Real Scalar) const { return Divided(Scalar); } @@ -229,8 +229,8 @@ public: } //! computes the cross product between two vectors - gp_Vec Crossed (const gp_Vec& Right) const; - gp_Vec operator ^ (const gp_Vec& Right) const + Standard_NODISCARD gp_Vec Crossed (const gp_Vec& Right) const; + Standard_NODISCARD gp_Vec operator ^ (const gp_Vec& Right) const { return Crossed(Right); } @@ -253,7 +253,7 @@ public: //! Computes the triple vector product. //! ^ (V1 ^ V2) - gp_Vec CrossCrossed (const gp_Vec& V1, const gp_Vec& V2) const; + Standard_NODISCARD gp_Vec CrossCrossed (const gp_Vec& V1, const gp_Vec& V2) const; //! computes the scalar product Standard_Real Dot (const gp_Vec& Other) const; @@ -273,14 +273,14 @@ public: //! normalizes a vector //! Raises an exception if the magnitude of the vector is //! lower or equal to Resolution from gp. - gp_Vec Normalized() const; + Standard_NODISCARD gp_Vec Normalized() const; //! Reverses the direction of a vector void Reverse(); //! Reverses the direction of a vector - gp_Vec Reversed() const; - gp_Vec operator -() const + Standard_NODISCARD gp_Vec Reversed() const; + Standard_NODISCARD gp_Vec operator -() const { return Reversed(); } @@ -319,7 +319,7 @@ public: //! Performs the symmetrical transformation of a vector //! with respect to the vector V which is the center of //! the symmetry. - Standard_EXPORT gp_Vec Mirrored (const gp_Vec& V) const; + Standard_EXPORT Standard_NODISCARD gp_Vec Mirrored (const gp_Vec& V) const; Standard_EXPORT void Mirror (const gp_Ax1& A1); @@ -327,7 +327,7 @@ public: //! Performs the symmetrical transformation of a vector //! with respect to an axis placement which is the axis //! of the symmetry. - Standard_EXPORT gp_Vec Mirrored (const gp_Ax1& A1) const; + Standard_EXPORT Standard_NODISCARD gp_Vec Mirrored (const gp_Ax1& A1) const; Standard_EXPORT void Mirror (const gp_Ax2& A2); @@ -335,25 +335,25 @@ public: //! Performs the symmetrical transformation of a vector //! with respect to a plane. The axis placement A2 locates //! the plane of the symmetry : (Location, XDirection, YDirection). - Standard_EXPORT gp_Vec Mirrored (const gp_Ax2& A2) const; + Standard_EXPORT Standard_NODISCARD gp_Vec Mirrored (const gp_Ax2& A2) const; void Rotate (const gp_Ax1& A1, const Standard_Real Ang); //! Rotates a vector. A1 is the axis of the rotation. //! Ang is the angular value of the rotation in radians. - gp_Vec Rotated (const gp_Ax1& A1, const Standard_Real Ang) const; + Standard_NODISCARD gp_Vec Rotated (const gp_Ax1& A1, const Standard_Real Ang) const; void Scale (const Standard_Real S); //! Scales a vector. S is the scaling value. - gp_Vec Scaled (const Standard_Real S) const; + Standard_NODISCARD gp_Vec Scaled (const Standard_Real S) const; //! Transforms a vector with the transformation T. Standard_EXPORT void Transform (const gp_Trsf& T); //! Transforms a vector with the transformation T. - gp_Vec Transformed (const gp_Trsf& T) const; + Standard_NODISCARD gp_Vec Transformed (const gp_Trsf& T) const; diff --git a/src/gp/gp_Vec2d.hxx b/src/gp/gp_Vec2d.hxx index f405ceed6c..7ade24a8ca 100644 --- a/src/gp/gp_Vec2d.hxx +++ b/src/gp/gp_Vec2d.hxx @@ -147,15 +147,15 @@ public: } //! Adds two vectors - gp_Vec2d Added (const gp_Vec2d& Other) const; - gp_Vec2d operator + (const gp_Vec2d& Other) const + Standard_NODISCARD gp_Vec2d Added (const gp_Vec2d& Other) const; + Standard_NODISCARD gp_Vec2d operator + (const gp_Vec2d& Other) const { return Added(Other); } //! Computes the crossing product between two vectors - Standard_Real Crossed (const gp_Vec2d& Right) const; - Standard_Real operator ^ (const gp_Vec2d& Right) const + Standard_NODISCARD Standard_Real Crossed (const gp_Vec2d& Right) const; + Standard_NODISCARD Standard_Real operator ^ (const gp_Vec2d& Right) const { return Crossed(Right); } @@ -177,8 +177,8 @@ public: } //! divides a vector by a scalar - gp_Vec2d Divided (const Standard_Real Scalar) const; - gp_Vec2d operator / (const Standard_Real Scalar) const + Standard_NODISCARD gp_Vec2d Divided (const Standard_Real Scalar) const; + Standard_NODISCARD gp_Vec2d operator / (const Standard_Real Scalar) const { return Divided(Scalar); } @@ -201,8 +201,8 @@ public: //! Normalizes a vector //! Raises an exception if the magnitude of the vector is //! lower or equal to Resolution from package gp. - gp_Vec2d Multiplied (const Standard_Real Scalar) const; - gp_Vec2d operator * (const Standard_Real Scalar) const + Standard_NODISCARD gp_Vec2d Multiplied (const Standard_Real Scalar) const; + Standard_NODISCARD gp_Vec2d operator * (const Standard_Real Scalar) const { return Multiplied(Scalar); } @@ -213,13 +213,13 @@ public: //! Raises an exception if the magnitude of the vector is //! lower or equal to Resolution from package gp. //! Reverses the direction of a vector - gp_Vec2d Normalized() const; + Standard_NODISCARD gp_Vec2d Normalized() const; void Reverse(); //! Reverses the direction of a vector - gp_Vec2d Reversed() const; - gp_Vec2d operator -() const + Standard_NODISCARD gp_Vec2d Reversed() const; + Standard_NODISCARD gp_Vec2d operator -() const { return Reversed(); } @@ -232,8 +232,8 @@ public: } //! Subtracts two vectors - gp_Vec2d Subtracted (const gp_Vec2d& Right) const; - gp_Vec2d operator - (const gp_Vec2d& Right) const + Standard_NODISCARD gp_Vec2d Subtracted (const gp_Vec2d& Right) const; + Standard_NODISCARD gp_Vec2d operator - (const gp_Vec2d& Right) const { return Subtracted(Right); } @@ -265,7 +265,7 @@ public: //! Performs the symmetrical transformation of a vector //! with respect to the vector V which is the center of //! the symmetry. - Standard_EXPORT gp_Vec2d Mirrored (const gp_Vec2d& V) const; + Standard_EXPORT Standard_NODISCARD gp_Vec2d Mirrored (const gp_Vec2d& V) const; //! Performs the symmetrical transformation of a vector @@ -277,24 +277,24 @@ public: //! Performs the symmetrical transformation of a vector //! with respect to an axis placement which is the axis //! of the symmetry. - Standard_EXPORT gp_Vec2d Mirrored (const gp_Ax2d& A1) const; + Standard_EXPORT Standard_NODISCARD gp_Vec2d Mirrored (const gp_Ax2d& A1) const; void Rotate (const Standard_Real Ang); //! Rotates a vector. Ang is the angular value of the //! rotation in radians. - gp_Vec2d Rotated (const Standard_Real Ang) const; + Standard_NODISCARD gp_Vec2d Rotated (const Standard_Real Ang) const; void Scale (const Standard_Real S); //! Scales a vector. S is the scaling value. - gp_Vec2d Scaled (const Standard_Real S) const; + Standard_NODISCARD gp_Vec2d Scaled (const Standard_Real S) const; Standard_EXPORT void Transform (const gp_Trsf2d& T); //! Transforms a vector with a Trsf from gp. - gp_Vec2d Transformed (const gp_Trsf2d& T) const; + Standard_NODISCARD gp_Vec2d Transformed (const gp_Trsf2d& T) const; diff --git a/src/gp/gp_XY.hxx b/src/gp/gp_XY.hxx index 70ffa21f58..254fce65f9 100644 --- a/src/gp/gp_XY.hxx +++ b/src/gp/gp_XY.hxx @@ -109,16 +109,16 @@ public: //! Computes the sum of this number pair and number pair Other //! new.X() = .X() + Other.X() //! new.Y() = .Y() + Other.Y() - gp_XY Added (const gp_XY& Other) const; - gp_XY operator + (const gp_XY& Other) const + Standard_NODISCARD gp_XY Added (const gp_XY& Other) const; + Standard_NODISCARD gp_XY operator + (const gp_XY& Other) const { return Added(Other); } //! Real D = .X() * Other.Y() - .Y() * Other.X() - Standard_Real Crossed (const gp_XY& Right) const; - Standard_Real operator ^ (const gp_XY& Right) const + Standard_NODISCARD Standard_Real Crossed (const gp_XY& Right) const; + Standard_NODISCARD Standard_Real operator ^ (const gp_XY& Right) const { return Crossed(Right); } @@ -141,8 +141,8 @@ public: } //! Divides by a real. - gp_XY Divided (const Standard_Real Scalar) const; - gp_XY operator / (const Standard_Real Scalar) const + Standard_NODISCARD gp_XY Divided (const Standard_Real Scalar) const; + Standard_NODISCARD gp_XY operator / (const Standard_Real Scalar) const { return Divided(Scalar); } @@ -182,8 +182,8 @@ public: //! New.X() = .X() * Scalar; //! New.Y() = .Y() * Scalar; - gp_XY Multiplied (const Standard_Real Scalar) const; - gp_XY operator * (const Standard_Real Scalar) const + Standard_NODISCARD gp_XY Multiplied (const Standard_Real Scalar) const; + Standard_NODISCARD gp_XY operator * (const Standard_Real Scalar) const { return Multiplied(Scalar); } @@ -191,11 +191,11 @@ public: //! new.X() = .X() * Other.X(); //! new.Y() = .Y() * Other.Y(); - gp_XY Multiplied (const gp_XY& Other) const; + Standard_NODISCARD gp_XY Multiplied (const gp_XY& Other) const; //! New = Matrix * - gp_XY Multiplied (const gp_Mat2d& Matrix) const; - gp_XY operator * (const gp_Mat2d& Matrix) const + Standard_NODISCARD gp_XY Multiplied (const gp_Mat2d& Matrix) const; + Standard_NODISCARD gp_XY operator * (const gp_Mat2d& Matrix) const { return Multiplied(Matrix); } @@ -210,7 +210,7 @@ public: //! New.X() = .X()/ .Modulus() //! New.Y() = .Y()/ .Modulus() //! Raises ConstructionError if .Modulus() <= Resolution from gp - gp_XY Normalized() const; + Standard_NODISCARD gp_XY Normalized() const; //! .X() = -.X() @@ -220,8 +220,8 @@ public: //! New.X() = -.X() //! New.Y() = -.Y() - gp_XY Reversed() const; - gp_XY operator -() const + Standard_NODISCARD gp_XY Reversed() const; + Standard_NODISCARD gp_XY operator -() const { return Reversed(); } @@ -262,8 +262,8 @@ public: //! new.X() = .X() - Other.X() //! new.Y() = .Y() - Other.Y() - gp_XY Subtracted (const gp_XY& Right) const; - gp_XY operator - (const gp_XY& Right) const + Standard_NODISCARD gp_XY Subtracted (const gp_XY& Right) const; + Standard_NODISCARD gp_XY operator - (const gp_XY& Right) const { return Subtracted(Right); } diff --git a/src/gp/gp_XYZ.hxx b/src/gp/gp_XYZ.hxx index ccb0373c09..1ecb7d2605 100644 --- a/src/gp/gp_XYZ.hxx +++ b/src/gp/gp_XYZ.hxx @@ -129,8 +129,8 @@ public: //! new.X() = .X() + Other.X() //! new.Y() = .Y() + Other.Y() //! new.Z() = .Z() + Other.Z() - gp_XYZ Added (const gp_XYZ& Other) const; - gp_XYZ operator + (const gp_XYZ& Other) const + Standard_NODISCARD gp_XYZ Added (const gp_XYZ& Other) const; + Standard_NODISCARD gp_XYZ operator + (const gp_XYZ& Other) const { return Added(Other); } @@ -149,8 +149,8 @@ public: //! new.X() = .Y() * Other.Z() - .Z() * Other.Y() //! new.Y() = .Z() * Other.X() - .X() * Other.Z() //! new.Z() = .X() * Other.Y() - .Y() * Other.X() - gp_XYZ Crossed (const gp_XYZ& Right) const; - gp_XYZ operator ^ (const gp_XYZ& Right) const + Standard_NODISCARD gp_XYZ Crossed (const gp_XYZ& Right) const; + Standard_NODISCARD gp_XYZ operator ^ (const gp_XYZ& Right) const { return Crossed(Right); } @@ -171,7 +171,7 @@ public: //! Triple vector product //! computes New = .Cross(Coord1.Cross(Coord2)) - gp_XYZ CrossCrossed (const gp_XYZ& Coord1, const gp_XYZ& Coord2) const; + Standard_NODISCARD gp_XYZ CrossCrossed (const gp_XYZ& Coord1, const gp_XYZ& Coord2) const; //! divides by a real. void Divide (const Standard_Real Scalar); @@ -181,8 +181,8 @@ public: } //! divides by a real. - gp_XYZ Divided (const Standard_Real Scalar) const; - gp_XYZ operator / (const Standard_Real Scalar) const + Standard_NODISCARD gp_XYZ Divided (const Standard_Real Scalar) const; + Standard_NODISCARD gp_XYZ operator / (const Standard_Real Scalar) const { return Divided(Scalar); } @@ -228,8 +228,8 @@ public: //! New.X() = .X() * Scalar; //! New.Y() = .Y() * Scalar; //! New.Z() = .Z() * Scalar; - gp_XYZ Multiplied (const Standard_Real Scalar) const; - gp_XYZ operator * (const Standard_Real Scalar) const + Standard_NODISCARD gp_XYZ Multiplied (const Standard_Real Scalar) const; + Standard_NODISCARD gp_XYZ operator * (const Standard_Real Scalar) const { return Multiplied(Scalar); } @@ -238,11 +238,11 @@ public: //! new.X() = .X() * Other.X(); //! new.Y() = .Y() * Other.Y(); //! new.Z() = .Z() * Other.Z(); - gp_XYZ Multiplied (const gp_XYZ& Other) const; + Standard_NODISCARD gp_XYZ Multiplied (const gp_XYZ& Other) const; //! New = Matrix * - gp_XYZ Multiplied (const gp_Mat& Matrix) const; - gp_XYZ operator * (const gp_Mat& Matrix) const + Standard_NODISCARD gp_XYZ Multiplied (const gp_Mat& Matrix) const; + Standard_NODISCARD gp_XYZ operator * (const gp_Mat& Matrix) const { return Multiplied(Matrix); } @@ -259,7 +259,7 @@ public: //! New.Y() = .Y()/ .Modulus() //! New.Z() = .Z()/ .Modulus() //! Raised if .Modulus() <= Resolution from gp - gp_XYZ Normalized() const; + Standard_NODISCARD gp_XYZ Normalized() const; //! .X() = -.X() @@ -271,7 +271,7 @@ public: //! New.X() = -.X() //! New.Y() = -.Y() //! New.Z() = -.Z() - gp_XYZ Reversed() const; + Standard_NODISCARD gp_XYZ Reversed() const; //! .X() = .X() - Other.X() @@ -287,8 +287,8 @@ public: //! new.X() = .X() - Other.X() //! new.Y() = .Y() - Other.Y() //! new.Z() = .Z() - Other.Z() - gp_XYZ Subtracted (const gp_XYZ& Right) const; - gp_XYZ operator - (const gp_XYZ& Right) const + Standard_NODISCARD gp_XYZ Subtracted (const gp_XYZ& Right) const; + Standard_NODISCARD gp_XYZ operator - (const gp_XYZ& Right) const { return Subtracted(Right); } diff --git a/src/math/math_IntegerVector.hxx b/src/math/math_IntegerVector.hxx index dfe8ad61bc..3b52ed2520 100644 --- a/src/math/math_IntegerVector.hxx +++ b/src/math/math_IntegerVector.hxx @@ -132,15 +132,15 @@ public: } //! returns the product of an IntegerVector by an integer value. - Standard_EXPORT math_IntegerVector Multiplied(const Standard_Integer theRight) const; + Standard_EXPORT Standard_NODISCARD math_IntegerVector Multiplied(const Standard_Integer theRight) const; - math_IntegerVector operator*(const Standard_Integer theRight) const + Standard_NODISCARD math_IntegerVector operator*(const Standard_Integer theRight) const { return Multiplied(theRight); } //! returns the product of a vector and a real value. - Standard_EXPORT math_IntegerVector TMultiplied(const Standard_Integer theRight) const; + Standard_EXPORT Standard_NODISCARD math_IntegerVector TMultiplied(const Standard_Integer theRight) const; friend inline math_IntegerVector operator* (const Standard_Integer theLeft, const math_IntegerVector& theRight) { @@ -160,9 +160,9 @@ public: //! adds the IntegerVector "theRight" to an IntegerVector. //! An exception is raised if the IntegerVectors have not the same length. //! An exception is raised if the lengths are not equal. - Standard_EXPORT math_IntegerVector Added(const math_IntegerVector& theRight) const; + Standard_EXPORT Standard_NODISCARD math_IntegerVector Added(const math_IntegerVector& theRight) const; - math_IntegerVector operator+(const math_IntegerVector& theRight) const + Standard_NODISCARD math_IntegerVector operator+(const math_IntegerVector& theRight) const { return Added(theRight); } @@ -199,9 +199,9 @@ public: //! returns the inner product of 2 IntegerVectors. //! An exception is raised if the lengths are not equal. - Standard_EXPORT Standard_Integer Multiplied(const math_IntegerVector& theRight) const; + Standard_EXPORT Standard_NODISCARD Standard_Integer Multiplied(const math_IntegerVector& theRight) const; - Standard_Integer operator*(const math_IntegerVector& theRight) const + Standard_NODISCARD Standard_Integer operator*(const math_IntegerVector& theRight) const { return Multiplied(theRight); } @@ -225,9 +225,9 @@ public: //! returns the subtraction of "theRight" from "me". //! An exception is raised if the IntegerVectors have not the same length. - Standard_EXPORT math_IntegerVector Subtracted(const math_IntegerVector& theRight) const; + Standard_EXPORT Standard_NODISCARD math_IntegerVector Subtracted(const math_IntegerVector& theRight) const; - math_IntegerVector operator-(const math_IntegerVector& theRight) const + Standard_NODISCARD math_IntegerVector operator-(const math_IntegerVector& theRight) const { return Subtracted(theRight); } diff --git a/src/math/math_Matrix.hxx b/src/math/math_Matrix.hxx index b5edbb4e0b..413f655e70 100644 --- a/src/math/math_Matrix.hxx +++ b/src/math/math_Matrix.hxx @@ -170,8 +170,8 @@ void operator*= (const Standard_Real Right) //! multiplies all the elements of a matrix by the //! value . - Standard_EXPORT math_Matrix Multiplied (const Standard_Real Right) const; -math_Matrix operator* (const Standard_Real Right) const + Standard_EXPORT Standard_NODISCARD math_Matrix Multiplied (const Standard_Real Right) const; +Standard_NODISCARD math_Matrix operator* (const Standard_Real Right) const { return Multiplied(Right); } @@ -194,7 +194,7 @@ math_Matrix operator* (const Standard_Real Right) const //! rows of this matrix, or //! - the number of columns of matrix Right is not equal to //! the number of columns of this matrix. - Standard_EXPORT math_Matrix TMultiplied (const Standard_Real Right) const; + Standard_EXPORT Standard_NODISCARD math_Matrix TMultiplied (const Standard_Real Right) const; friend math_Matrix operator *(const Standard_Real Left,const math_Matrix& Right); //! divides all the elements of a matrix by the value . @@ -207,8 +207,8 @@ void operator/= (const Standard_Real Right) //! divides all the elements of a matrix by the value . //! An exception is raised if = 0. - Standard_EXPORT math_Matrix Divided (const Standard_Real Right) const; -math_Matrix operator/ (const Standard_Real Right) const + Standard_EXPORT Standard_NODISCARD math_Matrix Divided (const Standard_Real Right) const; +Standard_NODISCARD math_Matrix operator/ (const Standard_Real Right) const { return Divided(Right); } @@ -227,8 +227,8 @@ void operator+= (const math_Matrix& Right) //! adds the matrix to a matrix. //! An exception is raised if the dimensions are different. - Standard_EXPORT math_Matrix Added (const math_Matrix& Right) const; -math_Matrix operator+ (const math_Matrix& Right) const + Standard_EXPORT Standard_NODISCARD math_Matrix Added (const math_Matrix& Right) const; +Standard_NODISCARD math_Matrix operator+ (const math_Matrix& Right) const { return Added(Right); } @@ -251,8 +251,8 @@ void operator-= (const math_Matrix& Right) //! Returns the result of the subtraction of from . //! An exception is raised if the dimensions are different. - Standard_EXPORT math_Matrix Subtracted (const math_Matrix& Right) const; -math_Matrix operator- (const math_Matrix& Right) const + Standard_EXPORT Standard_NODISCARD math_Matrix Subtracted (const math_Matrix& Right) const; +Standard_NODISCARD math_Matrix operator- (const math_Matrix& Right) const { return Subtracted(Right); } @@ -304,7 +304,7 @@ math_Matrix operator- (const math_Matrix& Right) const //! Teturns the transposed of a matrix. //! An exception is raised if the matrix is not a square matrix. - Standard_EXPORT math_Matrix Transposed() const; + Standard_EXPORT Standard_NODISCARD math_Matrix Transposed() const; //! Returns the inverse of a matrix. //! Exception NotSquare is raised if the matrix is not square. @@ -363,16 +363,16 @@ void operator*= (const math_Matrix& Right) //! Returns the product of 2 matrices. //! An exception is raised if the dimensions are different. - Standard_EXPORT math_Matrix Multiplied (const math_Matrix& Right) const; -math_Matrix operator* (const math_Matrix& Right) const + Standard_EXPORT Standard_NODISCARD math_Matrix Multiplied (const math_Matrix& Right) const; +Standard_NODISCARD math_Matrix operator* (const math_Matrix& Right) const { return Multiplied(Right); } //! Returns the product of a matrix by a vector. //! An exception is raised if the dimensions are different. - Standard_EXPORT math_Vector Multiplied (const math_Vector& Right) const; -math_Vector operator* (const math_Vector& Right) const + Standard_EXPORT Standard_NODISCARD math_Vector Multiplied (const math_Vector& Right) const; +Standard_NODISCARD math_Vector operator* (const math_Vector& Right) const { return Multiplied(Right); } diff --git a/src/math/math_Vector.hxx b/src/math/math_Vector.hxx index e73ff37b94..e5625f7def 100644 --- a/src/math/math_Vector.hxx +++ b/src/math/math_Vector.hxx @@ -127,7 +127,7 @@ public: //! Exceptions //! Standard_NullValue if this vector is null (i.e. if its norm is //! less than or equal to Standard_Real::RealEpsilon(). - Standard_EXPORT math_Vector Normalized() const; + Standard_EXPORT Standard_NODISCARD math_Vector Normalized() const; //! Inverts this vector and assigns the result to this vector. Standard_EXPORT void Invert(); @@ -156,15 +156,15 @@ public: } //! returns the product of a vector and a real value. - Standard_EXPORT math_Vector Multiplied(const Standard_Real theRight) const; + Standard_EXPORT Standard_NODISCARD math_Vector Multiplied(const Standard_Real theRight) const; - math_Vector operator*(const Standard_Real theRight) const + Standard_NODISCARD math_Vector operator*(const Standard_Real theRight) const { return Multiplied(theRight); } //! returns the product of a vector and a real value. - Standard_EXPORT math_Vector TMultiplied(const Standard_Real theRight) const; + Standard_EXPORT Standard_NODISCARD math_Vector TMultiplied(const Standard_Real theRight) const; friend inline math_Vector operator* (const Standard_Real theLeft, const math_Vector& theRight) { @@ -182,9 +182,9 @@ public: //! divides a vector by the value "theRight". //! An exception is raised if "theRight" = 0. - Standard_EXPORT math_Vector Divided(const Standard_Real theRight) const; + Standard_EXPORT Standard_NODISCARD math_Vector Divided(const Standard_Real theRight) const; - math_Vector operator/(const Standard_Real theRight) const + Standard_NODISCARD math_Vector operator/(const Standard_Real theRight) const { return Divided(theRight); } @@ -204,9 +204,9 @@ public: //! adds the vector theRight to a vector. //! An exception is raised if the vectors have not the same length. //! An exception is raised if the lengths are not equal. - Standard_EXPORT math_Vector Added(const math_Vector& theRight) const; + Standard_EXPORT Standard_NODISCARD math_Vector Added(const math_Vector& theRight) const; - math_Vector operator+(const math_Vector& theRight) const + Standard_NODISCARD math_Vector operator+(const math_Vector& theRight) const { return Added(theRight); } @@ -264,16 +264,16 @@ public: //! returns the inner product of 2 vectors. //! An exception is raised if the lengths are not equal. - Standard_EXPORT Standard_Real Multiplied(const math_Vector& theRight) const; - Standard_Real operator*(const math_Vector& theRight) const + Standard_EXPORT Standard_NODISCARD Standard_Real Multiplied(const math_Vector& theRight) const; + Standard_NODISCARD Standard_Real operator*(const math_Vector& theRight) const { return Multiplied(theRight); } //! returns the product of a vector by a matrix. - Standard_EXPORT math_Vector Multiplied(const math_Matrix& theRight) const; + Standard_EXPORT Standard_NODISCARD math_Vector Multiplied(const math_Matrix& theRight) const; - math_Vector operator*(const math_Matrix& theRight) const + Standard_NODISCARD math_Vector operator*(const math_Matrix& theRight) const { return Multiplied(theRight); } @@ -297,9 +297,9 @@ public: //! returns the subtraction of "theRight" from "me". //! An exception is raised if the vectors have not the same length. - Standard_EXPORT math_Vector Subtracted(const math_Vector& theRight) const; + Standard_EXPORT Standard_NODISCARD math_Vector Subtracted(const math_Vector& theRight) const; - math_Vector operator-(const math_Vector& theRight) const + Standard_NODISCARD math_Vector operator-(const math_Vector& theRight) const { return Subtracted(theRight); }