mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-08-14 13:30:48 +03:00
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())
This commit is contained in:
@@ -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);
|
||||
|
@@ -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 :
|
||||
|
@@ -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;
|
||||
|
||||
|
@@ -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 <me>.
|
||||
//! <me> * 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);
|
||||
}
|
||||
|
@@ -46,7 +46,7 @@ public:
|
||||
Standard_EXPORT void Reverse();
|
||||
|
||||
//! Returns a copy of <me> 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
|
||||
|
@@ -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);
|
||||
}
|
||||
|
||||
|
@@ -80,8 +80,9 @@ void operator += (const Handle(Geom2d_Vector)& Other)
|
||||
|
||||
|
||||
//! Adds the vector Other to <me>.
|
||||
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 <me> 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 <me> 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 <me>.
|
||||
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 <me>. 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);
|
||||
}
|
||||
|
Reference in New Issue
Block a user