mirror of
https://github.com/Open-Cascade-SAS/OCCT.git
synced 2026-09-05 04:07:58 +08:00
Coding - Clang-Tidy apply with refactoring (#965)
- Replacing empty constructor/destructor implementations with `= default` - Removing redundant `virtual` keywords from override methods - Replacing `NULL` and `0` with `nullptr` - Replacing C headers with C++ equivalents (`<cstdio>`, `<cstring>`, etc.) - Marking copy constructors/assignment operators as `= delete` for non-copyable classes - Converting `void` parameter lists to empty parameter lists - Replacing integer literals with appropriate boolean values
This commit is contained in:
@@ -54,7 +54,7 @@
|
||||
#include <TopoDS_Vertex.hxx>
|
||||
#include <TopoDS_Wire.hxx>
|
||||
#include <GeomLib_CheckCurveOnSurface.hxx>
|
||||
#include <errno.h>
|
||||
#include <cerrno>
|
||||
#include <BRepTools_Modifier.hxx>
|
||||
#include <TopTools_ShapeMapHasher.hxx>
|
||||
#include <NCollection_IndexedMap.hxx>
|
||||
@@ -646,7 +646,7 @@ bool BRepTools::Write(const TopoDS_Shape& theShape,
|
||||
const occ::handle<OSD_FileSystem>& aFileSystem = OSD_FileSystem::DefaultFileSystem();
|
||||
std::shared_ptr<std::ostream> aStream =
|
||||
aFileSystem->OpenOStream(theFile, std::ios::out | std::ios::binary);
|
||||
if (aStream.get() == NULL || !aStream->good())
|
||||
if (aStream.get() == nullptr || !aStream->good())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
@@ -685,7 +685,7 @@ bool BRepTools::Read(TopoDS_Shape& Sh,
|
||||
{
|
||||
const occ::handle<OSD_FileSystem>& aFileSystem = OSD_FileSystem::DefaultFileSystem();
|
||||
std::shared_ptr<std::istream> aStream = aFileSystem->OpenIStream(File, std::ios::in);
|
||||
if (aStream.get() == NULL)
|
||||
if (aStream.get() == nullptr)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
@@ -1415,7 +1415,7 @@ static bool removeInternals(
|
||||
|
||||
void BRepTools::RemoveInternals(TopoDS_Shape& theS, const bool theForce)
|
||||
{
|
||||
NCollection_Map<TopoDS_Shape, TopTools_ShapeMapHasher>*pMKeep = NULL, aMKeep;
|
||||
NCollection_Map<TopoDS_Shape, TopTools_ShapeMapHasher>*pMKeep = nullptr, aMKeep;
|
||||
if (!theForce)
|
||||
{
|
||||
// Find all internal sub-shapes which has to be kept to preserve topological connectivity.
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
//! Save shape to file
|
||||
const char* BRepTools_Write(const char* theFileStr, void* theShapePtr)
|
||||
{
|
||||
if (theFileStr == 0 || theShapePtr == 0)
|
||||
if (theFileStr == nullptr || theShapePtr == nullptr)
|
||||
{
|
||||
return "Error: name or shape is null";
|
||||
}
|
||||
@@ -46,7 +46,7 @@ const char* BRepTools_Write(const char* theFileStr, void* theShapePtr)
|
||||
//! Dump shape to cout
|
||||
const char* BRepTools_Dump(void* theShapePtr)
|
||||
{
|
||||
if (theShapePtr == 0)
|
||||
if (theShapePtr == nullptr)
|
||||
{
|
||||
return "Error: name or shape is null";
|
||||
}
|
||||
@@ -69,7 +69,7 @@ const char* BRepTools_Dump(void* theShapePtr)
|
||||
//! Dump shape location to cout
|
||||
const char* BRepTools_DumpLoc(void* theLocationPtr)
|
||||
{
|
||||
if (theLocationPtr == 0)
|
||||
if (theLocationPtr == nullptr)
|
||||
{
|
||||
return "Error: name or shape is null";
|
||||
}
|
||||
|
||||
@@ -64,7 +64,7 @@ void BRepTools_History::AddGenerated(const TopoDS_Shape& theInitial,
|
||||
}
|
||||
|
||||
NCollection_List<TopoDS_Shape>* aGenerations = myShapeToGenerated.ChangeSeek(theInitial);
|
||||
if (aGenerations == NULL)
|
||||
if (aGenerations == nullptr)
|
||||
{
|
||||
aGenerations = myShapeToGenerated.Bound(theInitial, NCollection_List<TopoDS_Shape>());
|
||||
}
|
||||
@@ -85,7 +85,7 @@ void BRepTools_History::AddModified(const TopoDS_Shape& theInitial, const TopoDS
|
||||
}
|
||||
|
||||
NCollection_List<TopoDS_Shape>* aModifications = myShapeToModified.ChangeSeek(theInitial);
|
||||
if (aModifications == NULL)
|
||||
if (aModifications == nullptr)
|
||||
{
|
||||
aModifications = myShapeToModified.Bound(theInitial, NCollection_List<TopoDS_Shape>());
|
||||
}
|
||||
@@ -101,7 +101,7 @@ void BRepTools_History::AddModified(const TopoDS_Shape& theInitial, const TopoDS
|
||||
void BRepTools_History::Remove(const TopoDS_Shape& theRemoved)
|
||||
{
|
||||
// Apply the limitations.
|
||||
Standard_ASSERT_RETURN(IsSupportedType(theRemoved), myMsgUnsupportedType, );
|
||||
Standard_ASSERT_RETURN(IsSupportedType(theRemoved), myMsgUnsupportedType, Standard_VOID_RETURN);
|
||||
|
||||
if (myShapeToModified.UnBind(theRemoved))
|
||||
{
|
||||
@@ -153,7 +153,7 @@ const NCollection_List<TopoDS_Shape>& BRepTools_History::Generated(
|
||||
|
||||
//
|
||||
const NCollection_List<TopoDS_Shape>* aGenerations = myShapeToGenerated.Seek(theInitial);
|
||||
return (aGenerations != NULL) ? *aGenerations : emptyList();
|
||||
return (aGenerations != nullptr) ? *aGenerations : emptyList();
|
||||
}
|
||||
|
||||
//=================================================================================================
|
||||
@@ -166,7 +166,7 @@ const NCollection_List<TopoDS_Shape>& BRepTools_History::Modified(
|
||||
|
||||
//
|
||||
const NCollection_List<TopoDS_Shape>* aModifications = myShapeToModified.Seek(theInitial);
|
||||
return (aModifications != NULL) ? *aModifications : emptyList();
|
||||
return (aModifications != nullptr) ? *aModifications : emptyList();
|
||||
}
|
||||
|
||||
//=================================================================================================
|
||||
@@ -251,7 +251,7 @@ void BRepTools_History::Merge(const BRepTools_History& theHistory23)
|
||||
{
|
||||
const TopoDS_Shape& aS1 = aMIt1.Key();
|
||||
NCollection_List<TopoDS_Shape>* aGAndM = aS1ToGAndM[0]->ChangeSeek(aS1);
|
||||
if (aGAndM == NULL)
|
||||
if (aGAndM == nullptr)
|
||||
{
|
||||
aGAndM = aS1ToGAndM[0]->Bound(aS1, NCollection_List<TopoDS_Shape>());
|
||||
}
|
||||
|
||||
@@ -90,7 +90,7 @@ class BRepTools_History : public Standard_Transient
|
||||
{
|
||||
public: //! @name Constructors for History creation
|
||||
//! Empty constructor
|
||||
BRepTools_History() {}
|
||||
BRepTools_History() = default;
|
||||
|
||||
//! Template constructor for History creation from the algorithm having
|
||||
//! standard history methods such as IsDeleted(), Modified() and Generated().
|
||||
|
||||
@@ -224,7 +224,7 @@ static bool newUV(const gp_Pnt& thePoint,
|
||||
|
||||
//=================================================================================================
|
||||
|
||||
BRepTools_NurbsConvertModification::BRepTools_NurbsConvertModification() {}
|
||||
BRepTools_NurbsConvertModification::BRepTools_NurbsConvertModification() = default;
|
||||
|
||||
//=================================================================================================
|
||||
|
||||
|
||||
@@ -424,7 +424,7 @@ TopoDS_Shape BRepTools_ReShape::Apply(const TopoDS_Shape& shape, const TopAbs_Sh
|
||||
{
|
||||
if (myStatus & EncodeStatus(4)) // ShapeExtend::DecodeStatus ( myStatus, ShapeExtend_DONE4 ) )
|
||||
locStatus |= EncodeStatus(4); //|= ShapeExtend::EncodeStatus ( ShapeExtend_DONE4 );
|
||||
modif = 1;
|
||||
modif = true;
|
||||
}
|
||||
if (newsh.IsNull())
|
||||
{
|
||||
@@ -548,7 +548,7 @@ occ::handle<BRepTools_History> BRepTools_ReShape::History() const
|
||||
{
|
||||
const TopoDS_Shape& aIntermediate = aIntermediates(aI);
|
||||
const TReplacement* aReplacement = myShapeToReplacement.Seek(aIntermediate);
|
||||
if (aReplacement == NULL)
|
||||
if (aReplacement == nullptr)
|
||||
{
|
||||
Add(aModified, aIntermediate);
|
||||
}
|
||||
|
||||
@@ -1253,7 +1253,7 @@ void BRepTools_ShapeSet::ReadPolygonOnTriangulation(Standard_IStream&
|
||||
{
|
||||
char buffer[255];
|
||||
IS >> buffer;
|
||||
if (strstr(buffer, "PolygonOnTriangulations") == NULL)
|
||||
if (strstr(buffer, "PolygonOnTriangulations") == nullptr)
|
||||
return;
|
||||
int i, j, val, nbpol = 0, nbnodes = 0;
|
||||
int hasparameters;
|
||||
@@ -1398,7 +1398,7 @@ void BRepTools_ShapeSet::ReadPolygon3D(Standard_IStream& IS,
|
||||
double d, x, y, z;
|
||||
|
||||
IS >> buffer;
|
||||
if (strstr(buffer, "Polygon3D") == NULL)
|
||||
if (strstr(buffer, "Polygon3D") == nullptr)
|
||||
return;
|
||||
occ::handle<Poly_Polygon3D> P;
|
||||
IS >> nbpol;
|
||||
@@ -1606,7 +1606,7 @@ void BRepTools_ShapeSet::ReadTriangulation(Standard_IStream& IS,
|
||||
occ::handle<Poly_Triangulation> T;
|
||||
|
||||
IS >> buffer;
|
||||
if (strstr(buffer, "Triangulations") == NULL)
|
||||
if (strstr(buffer, "Triangulations") == nullptr)
|
||||
return;
|
||||
|
||||
IS >> nbtri;
|
||||
|
||||
@@ -54,7 +54,7 @@ public:
|
||||
const bool theWithTriangles = true,
|
||||
const bool theWithNormals = false);
|
||||
|
||||
Standard_EXPORT virtual ~BRepTools_ShapeSet();
|
||||
Standard_EXPORT ~BRepTools_ShapeSet() override;
|
||||
|
||||
//! Return true if shape should be stored with triangles.
|
||||
bool IsWithTriangles() const { return myWithTriangles; }
|
||||
@@ -71,46 +71,44 @@ public:
|
||||
void SetWithNormals(const bool theWithNormals) { myWithNormals = theWithNormals; }
|
||||
|
||||
//! Clears the content of the set.
|
||||
Standard_EXPORT virtual void Clear() override;
|
||||
Standard_EXPORT void Clear() override;
|
||||
|
||||
//! Stores the geometry of <S>.
|
||||
Standard_EXPORT virtual void AddGeometry(const TopoDS_Shape& S) override;
|
||||
Standard_EXPORT void AddGeometry(const TopoDS_Shape& S) override;
|
||||
|
||||
//! Dumps the geometry of me on the stream <OS>.
|
||||
Standard_EXPORT virtual void DumpGeometry(Standard_OStream& OS) const override;
|
||||
Standard_EXPORT void DumpGeometry(Standard_OStream& OS) const override;
|
||||
|
||||
//! Writes the geometry of me on the stream <OS> in a
|
||||
//! format that can be read back by Read.
|
||||
Standard_EXPORT virtual void WriteGeometry(
|
||||
Standard_EXPORT void WriteGeometry(
|
||||
Standard_OStream& OS,
|
||||
const Message_ProgressRange& theProgress = Message_ProgressRange()) override;
|
||||
|
||||
//! Reads the geometry of me from the stream <IS>.
|
||||
Standard_EXPORT virtual void ReadGeometry(
|
||||
Standard_EXPORT void ReadGeometry(
|
||||
Standard_IStream& IS,
|
||||
const Message_ProgressRange& theProgress = Message_ProgressRange()) override;
|
||||
|
||||
//! Dumps the geometry of <S> on the stream <OS>.
|
||||
Standard_EXPORT virtual void DumpGeometry(const TopoDS_Shape& S,
|
||||
Standard_OStream& OS) const override;
|
||||
Standard_EXPORT void DumpGeometry(const TopoDS_Shape& S, Standard_OStream& OS) const override;
|
||||
|
||||
//! Writes the geometry of <S> on the stream <OS> in a
|
||||
//! format that can be read back by Read.
|
||||
Standard_EXPORT virtual void WriteGeometry(const TopoDS_Shape& S,
|
||||
Standard_OStream& OS) const override;
|
||||
Standard_EXPORT void WriteGeometry(const TopoDS_Shape& S, Standard_OStream& OS) const override;
|
||||
|
||||
//! Reads the geometry of a shape of type <T> from the
|
||||
//! stream <IS> and returns it in <S>.
|
||||
Standard_EXPORT virtual void ReadGeometry(const TopAbs_ShapeEnum T,
|
||||
Standard_IStream& IS,
|
||||
TopoDS_Shape& S) override;
|
||||
Standard_EXPORT void ReadGeometry(const TopAbs_ShapeEnum T,
|
||||
Standard_IStream& IS,
|
||||
TopoDS_Shape& S) override;
|
||||
|
||||
//! Inserts the shape <S2> in the shape <S1>. This
|
||||
//! method must be redefined to use the correct
|
||||
//! builder.
|
||||
Standard_EXPORT virtual void AddShapes(TopoDS_Shape& S1, const TopoDS_Shape& S2) override;
|
||||
Standard_EXPORT void AddShapes(TopoDS_Shape& S1, const TopoDS_Shape& S2) override;
|
||||
|
||||
Standard_EXPORT virtual void Check(const TopAbs_ShapeEnum T, TopoDS_Shape& S) override;
|
||||
Standard_EXPORT void Check(const TopAbs_ShapeEnum T, TopoDS_Shape& S) override;
|
||||
|
||||
//! Reads the 3d polygons of me
|
||||
//! from the stream <IS>.
|
||||
|
||||
@@ -28,7 +28,7 @@
|
||||
|
||||
//=================================================================================================
|
||||
|
||||
BRepTools_Substitution::BRepTools_Substitution() {}
|
||||
BRepTools_Substitution::BRepTools_Substitution() = default;
|
||||
|
||||
//=================================================================================================
|
||||
|
||||
|
||||
@@ -717,10 +717,10 @@ bool SelectDouble(NCollection_Map<TopoDS_Shape, TopTools_ShapeMapHasher>& Double
|
||||
{
|
||||
E = TopoDS::Edge(CE);
|
||||
L.Remove(it);
|
||||
return 1;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
return false;
|
||||
}
|
||||
|
||||
//=================================================================================================
|
||||
@@ -736,12 +736,12 @@ bool SelectDegenerated(NCollection_List<TopoDS_Shape>& L, TopoDS_Edge& E)
|
||||
if (BRep_Tool::Degenerated(E))
|
||||
{
|
||||
L.Remove(it);
|
||||
return 1;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
it.Next();
|
||||
}
|
||||
return 0;
|
||||
return false;
|
||||
}
|
||||
|
||||
//=================================================================================================
|
||||
|
||||
Reference in New Issue
Block a user