Surface: modernize C++11

* use nullptr
This commit is contained in:
wmayer
2022-03-23 19:09:21 +01:00
parent fb4e8e871b
commit f19ab55b48
12 changed files with 24 additions and 24 deletions

View File

@@ -65,7 +65,7 @@ PyMOD_INIT_FUNC(Surface)
}
catch(const Base::Exception& e) {
PyErr_SetString(PyExc_ImportError, e.what());
PyMOD_Return(0);
PyMOD_Return(nullptr);
}
PyObject* mod = Surface::initModule();

View File

@@ -43,7 +43,7 @@ PROPERTY_SOURCE(Surface::Cut, Part::Feature)
Cut::Cut()
{
ADD_PROPERTY(ShapeList,(0,"TopoDS_Shape"));
ADD_PROPERTY(ShapeList,(nullptr,"TopoDS_Shape"));
ShapeList.setScope(App::LinkScope::Global);
}
@@ -95,7 +95,7 @@ App::DocumentObjectExecReturn *Cut::execute(void)
}
this->Shape.setValue(aCutShape);
return 0;
return nullptr;
}
catch (Standard_Failure& e) {

View File

@@ -48,7 +48,7 @@ PROPERTY_SOURCE(Surface::Extend, Part::Spline)
Extend::Extend() : lockOnChangeMutex(false)
{
ADD_PROPERTY(Face,(0));
ADD_PROPERTY(Face,(nullptr));
Face.setScope(App::LinkScope::Global);
ADD_PROPERTY(Tolerance, (0.1));
Tolerance.setConstraints(&ToleranceRange);

View File

@@ -47,19 +47,19 @@ PROPERTY_SOURCE(Surface::Filling, Part::Spline)
Filling::Filling()
{
ADD_PROPERTY_TYPE(BoundaryEdges,(0,""), "Filling", App::Prop_None, "Boundary Edges (C0 is required for edges without a corresponding face)");
ADD_PROPERTY_TYPE(BoundaryEdges,(nullptr,""), "Filling", App::Prop_None, "Boundary Edges (C0 is required for edges without a corresponding face)");
ADD_PROPERTY_TYPE(BoundaryFaces,(""), "Filling", App::Prop_None, "Boundary Faces");
ADD_PROPERTY_TYPE(BoundaryOrder,(-1), "Filling", App::Prop_None, "Order of constraint on boundary faces (C0, G1 and G2 are possible)");
ADD_PROPERTY_TYPE(UnboundEdges,(0,""), "Filling", App::Prop_None, "Unbound constraint edges (C0 is required for edges without a corresponding face)");
ADD_PROPERTY_TYPE(UnboundEdges,(nullptr,""), "Filling", App::Prop_None, "Unbound constraint edges (C0 is required for edges without a corresponding face)");
ADD_PROPERTY_TYPE(UnboundFaces,(""), "Filling", App::Prop_None, "Unbound constraint faces");
ADD_PROPERTY_TYPE(UnboundOrder,(-1), "Filling", App::Prop_None, "Order of constraint on curve faces (C0, G1 and G2 are possible)");
ADD_PROPERTY_TYPE(FreeFaces,(0,""), "Filling", App::Prop_None, "Free constraint on a face");
ADD_PROPERTY_TYPE(FreeFaces,(nullptr,""), "Filling", App::Prop_None, "Free constraint on a face");
ADD_PROPERTY_TYPE(FreeOrder,(0), "Filling", App::Prop_None, "Order of constraint on free faces");
ADD_PROPERTY_TYPE(Points,(0,""), "Filling", App::Prop_None, "Constraint Points (on Surface)");
ADD_PROPERTY_TYPE(InitialFace,(0), "Filling", App::Prop_None, "Initial surface to use");
ADD_PROPERTY_TYPE(Points,(nullptr,""), "Filling", App::Prop_None, "Constraint Points (on Surface)");
ADD_PROPERTY_TYPE(InitialFace,(nullptr), "Filling", App::Prop_None, "Initial surface to use");
ADD_PROPERTY_TYPE(Degree,(3), "Filling", App::Prop_None, "Starting degree");
ADD_PROPERTY_TYPE(PointsOnCurve,(15), "Filling", App::Prop_None, "Number of points on an edge for constraint");

View File

@@ -94,7 +94,7 @@ void ShapeValidator::checkEdge(const TopoDS_Shape& shape)
void ShapeValidator::checkAndAdd(const TopoDS_Shape &shape, Handle(ShapeExtend_WireData) *aWD)
{
checkEdge(shape);
if (aWD != NULL) {
if (aWD != nullptr) {
BRepBuilderAPI_Copy copier(shape);
// make a copy of the shape and the underlying geometry to avoid to affect the input shapes
(*aWD)->Add(TopoDS::Edge(copier.Shape()));
@@ -104,7 +104,7 @@ void ShapeValidator::checkAndAdd(const TopoDS_Shape &shape, Handle(ShapeExtend_W
void ShapeValidator::checkAndAdd(const Part::TopoShape &ts, const char *subName, Handle(ShapeExtend_WireData) *aWD)
{
try {
if (subName != NULL && *subName != '\0') {
if (subName != nullptr && *subName != '\0') {
//we want only the subshape which is linked
checkAndAdd(ts.getSubShape(subName), aWD);
}
@@ -126,12 +126,12 @@ void ShapeValidator::checkAndAdd(const Part::TopoShape &ts, const char *subName,
PROPERTY_SOURCE(Surface::GeomFillSurface, Part::Spline)
const char* GeomFillSurface::FillTypeEnums[] = {"Stretched", "Coons", "Curved", NULL};
const char* GeomFillSurface::FillTypeEnums[] = {"Stretched", "Coons", "Curved", nullptr};
GeomFillSurface::GeomFillSurface(): Spline()
{
ADD_PROPERTY(FillType, ((long)0));
ADD_PROPERTY(BoundaryList, (0, "Dummy"));
ADD_PROPERTY(BoundaryList, (nullptr, "Dummy"));
ADD_PROPERTY(ReversedList, (false));
FillType.setEnums(FillTypeEnums);
BoundaryList.setScope(App::LinkScope::Global);

View File

@@ -46,8 +46,8 @@ public:
ShapeValidator();
void initValidator(void);
void checkEdge(const TopoDS_Shape& shape);
void checkAndAdd(const TopoDS_Shape &shape, Handle(ShapeExtend_WireData) *aWD = NULL);
void checkAndAdd(const Part::TopoShape &ts, const char *subName, Handle(ShapeExtend_WireData) *aWire = NULL);
void checkAndAdd(const TopoDS_Shape &shape, Handle(ShapeExtend_WireData) *aWD = nullptr);
void checkAndAdd(const Part::TopoShape &ts, const char *subName, Handle(ShapeExtend_WireData) *aWire = nullptr);
bool isBezier() const {
return willBezier;

View File

@@ -43,7 +43,7 @@ PROPERTY_SOURCE(Surface::Sewing, Part::Feature)
Sewing::Sewing()
{
ADD_PROPERTY_TYPE(ShapeList,(0,""), "Sewing", App::Prop_None, "Input shapes");
ADD_PROPERTY_TYPE(ShapeList,(nullptr,""), "Sewing", App::Prop_None, "Input shapes");
ADD_PROPERTY_TYPE(Tolerance,(Precision::Confusion()), "Sewing", App::Prop_None, "Sewing tolerance");
ADD_PROPERTY_TYPE(SewingOption,(true), "Sewing", App::Prop_None, "Sewing option");
ADD_PROPERTY_TYPE(DegenerateShape,(true), "Sewing", App::Prop_None, "Analysis of degenerated shapes");

View File

@@ -65,7 +65,7 @@ PyMOD_INIT_FUNC(SurfaceGui)
{
if (!Gui::Application::Instance) {
PyErr_SetString(PyExc_ImportError, "Cannot load Gui module in console application.");
PyMOD_Return(0);
PyMOD_Return(nullptr);
}
Base::Interpreter().runString("import Surface");

View File

@@ -533,7 +533,7 @@ void FillingPanel::on_listBoundary_itemDoubleClicked(QListWidgetItem* item)
const TopTools_ListOfShape& adj_faces = edge2Face.FindFromKey(edge);
if (adj_faces.Extent() > 0) {
int n = adj_faces.Extent();
ui->statusLabel->setText(tr("Edge has %n adjacent faces", 0, n));
ui->statusLabel->setText(tr("Edge has %n adjacent faces", nullptr, n));
// fill up the combo boxes
modifyBoundary(true);
@@ -859,14 +859,14 @@ TaskFilling::TaskFilling(ViewProviderFilling* vp, Surface::Filling* obj)
widget1 = new FillingPanel(vp, obj);
Gui::TaskView::TaskBox* taskbox1 = new Gui::TaskView::TaskBox(
Gui::BitmapFactory().pixmap("Surface_Filling"),
widget1->windowTitle(), true, 0);
widget1->windowTitle(), true, nullptr);
taskbox1->groupLayout()->addWidget(widget1);
Content.push_back(taskbox1);
// second task box
widget2 = new FillingEdgePanel(vp, obj);
Gui::TaskView::TaskBox* taskbox2 = new Gui::TaskView::TaskBox(
QPixmap(), widget2->windowTitle(), true, 0);
QPixmap(), widget2->windowTitle(), true, nullptr);
taskbox2->groupLayout()->addWidget(widget2);
Content.push_back(taskbox2);
taskbox2->hideGroupBox();
@@ -874,7 +874,7 @@ TaskFilling::TaskFilling(ViewProviderFilling* vp, Surface::Filling* obj)
// third task box
widget3 = new FillingVertexPanel(vp, obj);
Gui::TaskView::TaskBox* taskbox3 = new Gui::TaskView::TaskBox(
QPixmap(), widget3->windowTitle(), true, 0);
QPixmap(), widget3->windowTitle(), true, nullptr);
taskbox3->groupLayout()->addWidget(widget3);
Content.push_back(taskbox3);
taskbox3->hideGroupBox();

View File

@@ -330,7 +330,7 @@ void FillingEdgePanel::on_listUnbound_itemDoubleClicked(QListWidgetItem* item)
const TopTools_ListOfShape& adj_faces = edge2Face.FindFromKey(edge);
if (adj_faces.Extent() > 0) {
int n = adj_faces.Extent();
ui->statusLabel->setText(tr("Edge has %n adjacent face(s)", 0, n));
ui->statusLabel->setText(tr("Edge has %n adjacent face(s)", nullptr, n));
// fill up the combo boxes
modifyBoundary(true);

View File

@@ -587,7 +587,7 @@ TaskGeomFillSurface::TaskGeomFillSurface(ViewProviderGeomFillSurface* vp, Surfac
widget->setWindowTitle(QObject::tr("Surface"));
taskbox = new Gui::TaskView::TaskBox(
Gui::BitmapFactory().pixmap("Surface_BSplineSurface"),
widget->windowTitle(), true, 0);
widget->windowTitle(), true, nullptr);
taskbox->groupLayout()->addWidget(widget);
Content.push_back(taskbox);
}

View File

@@ -555,7 +555,7 @@ TaskSections::TaskSections(ViewProviderSections* vp, Surface::Sections* obj)
widget1 = new SectionsPanel(vp, obj);
Gui::TaskView::TaskBox* taskbox1 = new Gui::TaskView::TaskBox(
Gui::BitmapFactory().pixmap("Surface_Sections"),
widget1->windowTitle(), true, 0);
widget1->windowTitle(), true, nullptr);
taskbox1->groupLayout()->addWidget(widget1);
Content.push_back(taskbox1);
}