From 53ba98d6366df14390aeb2c99853cf9810959e70 Mon Sep 17 00:00:00 2001 From: berniev Date: Sat, 6 Aug 2022 02:29:31 +1000 Subject: [PATCH] Mod: use empty --- src/Mod/Fem/App/FemConstraint.cpp | 4 +- src/Mod/Fem/App/FemConstraintBearing.cpp | 2 +- src/Mod/Fem/App/FemMesh.cpp | 8 +-- src/Mod/Fem/Gui/TaskFemConstraintBearing.cpp | 4 +- src/Mod/Fem/Gui/TaskFemConstraintContact.cpp | 12 ++-- .../Fem/Gui/TaskFemConstraintDisplacement.cpp | 8 +-- src/Mod/Fem/Gui/TaskFemConstraintFixed.cpp | 8 +-- .../Gui/TaskFemConstraintFluidBoundary.cpp | 12 ++-- src/Mod/Fem/Gui/TaskFemConstraintForce.cpp | 8 +-- src/Mod/Fem/Gui/TaskFemConstraintHeatflux.cpp | 12 ++-- .../Gui/TaskFemConstraintPlaneRotation.cpp | 8 +-- src/Mod/Fem/Gui/TaskFemConstraintPressure.cpp | 8 +-- src/Mod/Fem/Gui/TaskFemConstraintSpring.cpp | 8 +-- .../Fem/Gui/TaskFemConstraintTemperature.cpp | 8 +-- .../Fem/Gui/TaskFemConstraintTransform.cpp | 16 +++--- .../ViewProviderFemConstraintTransform.cpp | 2 +- src/Mod/Fem/Gui/ViewProviderFemMesh.cpp | 2 +- src/Mod/Import/App/ImportOCAF2.cpp | 20 +++---- src/Mod/Inspection/App/InspectionFeature.cpp | 4 +- src/Mod/Mesh/App/Core/Algorithm.cpp | 6 +- src/Mod/Mesh/App/Core/CylinderFit.cpp | 10 ++-- src/Mod/Mesh/App/Core/Elements.cpp | 2 +- src/Mod/Mesh/App/Core/Evaluation.cpp | 6 +- src/Mod/Mesh/App/Core/Grid.cpp | 2 +- src/Mod/Mesh/App/Core/SetOperations.cpp | 2 +- src/Mod/Mesh/App/Core/SphereFit.cpp | 2 +- src/Mod/Mesh/App/Core/Triangulation.cpp | 2 +- src/Mod/Mesh/App/Core/Trim.cpp | 2 +- src/Mod/Mesh/App/Core/Visitor.cpp | 6 +- src/Mod/Mesh/App/Mesh.cpp | 2 +- src/Mod/Mesh/Gui/SoFCMeshObject.cpp | 6 +- src/Mod/MeshPart/App/MeshAlgos.cpp | 2 +- src/Mod/Part/App/AppPartPy.cpp | 6 +- src/Mod/Part/App/AttachEnginePyImp.cpp | 2 +- src/Mod/Part/App/Attacher.cpp | 14 ++--- src/Mod/Part/App/CrossSection.cpp | 2 +- src/Mod/Part/App/FeatureExtrusion.cpp | 2 +- src/Mod/Part/App/FeatureRevolution.cpp | 2 +- src/Mod/Part/App/Geometry.cpp | 6 +- .../Part/App/GeometryBoolExtensionPyImp.cpp | 2 +- .../Part/App/GeometryDoubleExtensionPyImp.cpp | 2 +- src/Mod/Part/App/GeometryExtension.cpp | 2 +- .../Part/App/GeometryIntExtensionPyImp.cpp | 2 +- .../Part/App/GeometryStringExtensionPyImp.cpp | 2 +- src/Mod/Part/App/Part2DObject.cpp | 2 +- src/Mod/Part/App/PartFeature.cpp | 4 +- src/Mod/Part/App/TopoShape.cpp | 12 ++-- src/Mod/Part/App/modelRefine.cpp | 6 +- src/Mod/Part/Gui/Command.cpp | 8 +-- src/Mod/Part/Gui/DlgExtrusion.cpp | 2 +- src/Mod/Part/Gui/DlgProjectionOnSurface.cpp | 16 +++--- src/Mod/Part/Gui/DlgRevolution.cpp | 2 +- src/Mod/Part/Gui/SoBrepEdgeSet.cpp | 10 ++-- src/Mod/Part/Gui/SoBrepFaceSet.cpp | 8 +-- src/Mod/Part/Gui/SoBrepPointSet.cpp | 8 +-- src/Mod/Part/Gui/TaskAttacher.cpp | 10 ++-- src/Mod/Part/Gui/TaskDimension.cpp | 4 +- src/Mod/PartDesign/App/FeatureChamfer.cpp | 2 +- src/Mod/PartDesign/App/FeatureDraft.cpp | 2 +- src/Mod/PartDesign/App/FeatureFillet.cpp | 2 +- src/Mod/PartDesign/App/FeatureMirrored.cpp | 2 +- src/Mod/PartDesign/App/FeatureSketchBased.cpp | 4 +- src/Mod/PartDesign/App/ShapeBinder.cpp | 4 +- src/Mod/PartDesign/Gui/Command.cpp | 10 ++-- src/Mod/PartDesign/Gui/ReferenceSelection.cpp | 2 +- .../PartDesign/Gui/TaskBooleanParameters.cpp | 2 +- .../Gui/TaskMultiTransformParameters.cpp | 2 +- .../Gui/ViewProviderShapeBinder.cpp | 6 +- src/Mod/PartDesign/Gui/Workbench.cpp | 4 +- src/Mod/Path/App/Area.cpp | 18 +++--- src/Mod/Path/App/Path.cpp | 6 +- src/Mod/Path/Gui/Command.cpp | 10 ++-- src/Mod/Path/Gui/ViewProviderPath.cpp | 2 +- src/Mod/Path/libarea/Adaptive.cpp | 56 +++++++++---------- src/Mod/Path/libarea/clipper.cpp | 4 +- src/Mod/Points/App/PointsGrid.cpp | 16 +++--- src/Mod/Raytracing/App/LuxProject.cpp | 2 +- src/Mod/Raytracing/App/RayProject.cpp | 2 +- src/Mod/Raytracing/Gui/Command.cpp | 4 +- src/Mod/Robot/App/Edge2TracObject.cpp | 4 +- src/Mod/Robot/App/Trajectory.cpp | 4 +- .../App/ExternalGeometryExtensionPyImp.cpp | 2 +- .../Sketcher/App/PropertyConstraintList.cpp | 22 ++++---- src/Mod/Sketcher/App/PythonConverter.cpp | 2 +- src/Mod/Sketcher/App/Sketch.cpp | 6 +- .../App/SketchGeometryExtensionPyImp.cpp | 2 +- src/Mod/Sketcher/App/SketchObject.cpp | 10 ++-- src/Mod/Sketcher/App/planegcs/GCS.cpp | 6 +- src/Mod/Sketcher/App/planegcs/SubSystem.cpp | 2 +- src/Mod/Sketcher/Gui/Command.cpp | 2 +- src/Mod/Sketcher/Gui/CommandConstraints.cpp | 30 +++++----- .../Sketcher/Gui/CommandSketcherBSpline.cpp | 2 +- src/Mod/Sketcher/Gui/CommandSketcherTools.cpp | 6 +- src/Mod/Sketcher/Gui/DrawSketchHandler.cpp | 2 +- src/Mod/Sketcher/Gui/DrawSketchHandlerArc.h | 12 ++-- .../Gui/DrawSketchHandlerArcOfEllipse.h | 8 +-- .../Gui/DrawSketchHandlerArcOfHyperbola.h | 8 +-- .../Gui/DrawSketchHandlerArcOfParabola.h | 8 +-- .../Sketcher/Gui/DrawSketchHandlerBSpline.h | 4 +- .../Sketcher/Gui/DrawSketchHandlerCircle.h | 10 ++-- .../Sketcher/Gui/DrawSketchHandlerEllipse.h | 12 ++-- .../Sketcher/Gui/DrawSketchHandlerExtend.h | 2 +- .../Sketcher/Gui/DrawSketchHandlerLineSet.h | 6 +- src/Mod/Sketcher/Gui/DrawSketchHandlerPoint.h | 2 +- .../Sketcher/Gui/DrawSketchHandlerPolygon.h | 4 +- .../Sketcher/Gui/DrawSketchHandlerRectangle.h | 12 ++-- src/Mod/Sketcher/Gui/DrawSketchHandlerSlot.h | 4 +- .../Sketcher/Gui/TaskSketcherValidation.cpp | 2 +- src/Mod/Sketcher/Gui/ViewProviderSketch.cpp | 6 +- src/Mod/Spreadsheet/App/Cell.cpp | 14 ++--- src/Mod/Spreadsheet/App/DisplayUnit.h | 2 +- .../Spreadsheet/App/PropertyColumnWidths.h | 2 +- src/Mod/Spreadsheet/App/PropertySheet.cpp | 8 +-- src/Mod/Spreadsheet/App/Sheet.cpp | 18 +++--- src/Mod/Spreadsheet/App/SheetPyImp.cpp | 6 +- src/Mod/Spreadsheet/App/Utils.cpp | 2 +- src/Mod/Spreadsheet/Gui/Command.cpp | 20 +++---- src/Mod/Spreadsheet/Gui/PropertiesDialog.cpp | 2 +- src/Mod/Spreadsheet/Gui/SheetModel.cpp | 2 +- src/Mod/Spreadsheet/Gui/SheetTableView.cpp | 8 +-- src/Mod/Spreadsheet/Gui/SpreadsheetView.cpp | 8 +-- src/Mod/Spreadsheet/Gui/Workbench.cpp | 8 +-- src/Mod/TechDraw/App/AppTechDrawPy.cpp | 2 +- src/Mod/TechDraw/App/DrawUtil.cpp | 2 +- src/Mod/TechDraw/App/DrawViewDimExtent.cpp | 6 +- src/Mod/TechDraw/App/EdgeWalker.cpp | 2 +- src/Mod/TechDraw/Gui/Command.cpp | 6 +- src/Mod/TechDraw/Gui/CommandCreateDims.cpp | 2 +- src/Mod/TechDraw/Gui/CommandDecorate.cpp | 2 +- src/Mod/TechDraw/Gui/QGIViewAnnotation.cpp | 2 +- src/Mod/TechDraw/Gui/QGIViewDimension.cpp | 4 +- src/Mod/TechDraw/Gui/QGSPage.cpp | 2 +- src/Mod/TechDraw/Gui/QGTracker.cpp | 2 +- src/Mod/TechDraw/Gui/TaskLinkDim.cpp | 2 +- 134 files changed, 419 insertions(+), 419 deletions(-) diff --git a/src/Mod/Fem/App/FemConstraint.cpp b/src/Mod/Fem/App/FemConstraint.cpp index 7b796696e3..d58f8f4286 100644 --- a/src/Mod/Fem/App/FemConstraint.cpp +++ b/src/Mod/Fem/App/FemConstraint.cpp @@ -391,7 +391,7 @@ Base::Vector3d Constraint::getBasePoint(const Base::Vector3d& base, const Base:: // Get the point specified by Location and Distance App::DocumentObject* objLoc = location.getValue(); std::vector names = location.getSubValues(); - if (names.size() == 0) + if (names.empty()) return Base::Vector3d(0,0,0); std::string subName = names.front(); Part::Feature* featLoc = static_cast(objLoc); @@ -458,7 +458,7 @@ const Base::Vector3d Constraint::getDirection(const App::PropertyLinkSub &direct } std::vector names = direction.getSubValues(); - if (names.size() == 0) + if (names.empty()) return Base::Vector3d(0,0,0); std::string subName = names.front(); Part::Feature* feat = static_cast(obj); diff --git a/src/Mod/Fem/App/FemConstraintBearing.cpp b/src/Mod/Fem/App/FemConstraintBearing.cpp index d789acb562..dd0cb0bb95 100644 --- a/src/Mod/Fem/App/FemConstraintBearing.cpp +++ b/src/Mod/Fem/App/FemConstraintBearing.cpp @@ -88,7 +88,7 @@ void ConstraintBearing::onChanged(const App::Property* prop) } else if ((prop == &Location) || (prop == &Dist)) { App::DocumentObject* obj = Location.getValue(); std::vector names = Location.getSubValues(); - if (names.size() == 0) { + if (names.empty()) { return; } std::string subName = names.front(); diff --git a/src/Mod/Fem/App/FemMesh.cpp b/src/Mod/Fem/App/FemMesh.cpp index 1995291c55..567ab86d04 100644 --- a/src/Mod/Fem/App/FemMesh.cpp +++ b/src/Mod/Fem/App/FemMesh.cpp @@ -1560,7 +1560,7 @@ void FemMesh::readNastran(const std::string &Filename) do { std::getline(inputfile,line1); - if (line1.size() == 0) + if (line1.empty()) continue; if (line1.find(',') != std::string::npos) nastranFormat = Format::FreeField; @@ -1650,7 +1650,7 @@ void FemMesh::readNastran95(const std::string &Filename) NastranElementPtr elem; std::getline(inputfile, line1); //cout << line1 << endl; - if (line1.size() == 0) + if (line1.empty()) continue; tcard = line1.substr(0, 8).c_str(); @@ -2199,7 +2199,7 @@ void FemMesh::writeABAQUS(const std::string &Filename, int elemParam, bool group anABAQUS_Output << std::endl; } } - if (elsetname == "") + if (elsetname.empty()) elsetname += "Efaces"; else elsetname += ", Efaces"; @@ -2219,7 +2219,7 @@ void FemMesh::writeABAQUS(const std::string &Filename, int elemParam, bool group anABAQUS_Output << std::endl; } } - if (elsetname == "") + if (elsetname.empty()) elsetname += "Eedges"; else elsetname += ", Eedges"; diff --git a/src/Mod/Fem/Gui/TaskFemConstraintBearing.cpp b/src/Mod/Fem/Gui/TaskFemConstraintBearing.cpp index e7b2c38f62..ccbe2bb237 100644 --- a/src/Mod/Fem/Gui/TaskFemConstraintBearing.cpp +++ b/src/Mod/Fem/Gui/TaskFemConstraintBearing.cpp @@ -94,7 +94,7 @@ TaskFemConstraintBearing::TaskFemConstraintBearing(ViewProviderFemConstraint *Co ui->listReferences->clear(); for (std::size_t i = 0; i < Objects.size(); i++) ui->listReferences->addItem(makeRefText(Objects[i], SubElements[i])); - if (Objects.size() > 0) + if (!Objects.empty()) ui->listReferences->setCurrentRow(0, QItemSelectionModel::ClearAndSelect); ui->lineLocation->setText(loc); ui->checkAxial->setChecked(axialfree); @@ -152,7 +152,7 @@ void TaskFemConstraintBearing::onSelectionChanged(const Gui::SelectionChanges& m std::vector Objects = pcConstraint->References.getValues(); std::vector SubElements = pcConstraint->References.getSubValues(); - if (Objects.size() > 0) { + if (!Objects.empty()) { QMessageBox::warning(this, tr("Selection error"), tr("Please use only a single reference for bearing constraint")); return; } diff --git a/src/Mod/Fem/Gui/TaskFemConstraintContact.cpp b/src/Mod/Fem/Gui/TaskFemConstraintContact.cpp index 88c1bfe36f..d9ed7dc2ab 100644 --- a/src/Mod/Fem/Gui/TaskFemConstraintContact.cpp +++ b/src/Mod/Fem/Gui/TaskFemConstraintContact.cpp @@ -141,7 +141,7 @@ void TaskFemConstraintContact::addToSelectionSlave() Gui::Selection().clearSelection(); return; } - if (selection.size() == 0){ + if (selection.empty()){ QMessageBox::warning(this, tr("Selection error"), tr("Nothing selected!")); return; } @@ -197,7 +197,7 @@ void TaskFemConstraintContact::addToSelectionSlave() void TaskFemConstraintContact::removeFromSelectionSlave() { std::vector selection = Gui::Selection().getSelectionEx(); //gets vector of selected objects of active document - if (selection.size() == 0){ + if (selection.empty()){ QMessageBox::warning(this, tr("Selection error"), tr("Nothing selected!")); return; } @@ -225,7 +225,7 @@ void TaskFemConstraintContact::removeFromSelectionSlave() } } std::sort(itemsToDel.begin(), itemsToDel.end()); - while (itemsToDel.size() > 0){ + while (!itemsToDel.empty()){ Objects.erase(Objects.begin() + itemsToDel.back()); SubElements.erase(SubElements.begin() + itemsToDel.back()); itemsToDel.pop_back(); @@ -248,7 +248,7 @@ void TaskFemConstraintContact::addToSelectionMaster() Gui::Selection().clearSelection(); return; } - if (selection.size() == 0){ + if (selection.empty()){ QMessageBox::warning(this, tr("Selection error"), tr("Nothing selected!")); return; } @@ -303,7 +303,7 @@ void TaskFemConstraintContact::addToSelectionMaster() void TaskFemConstraintContact::removeFromSelectionMaster() { std::vector selection = Gui::Selection().getSelectionEx(); //gets vector of selected objects of active document - if (selection.size() == 0){ + if (selection.empty()){ QMessageBox::warning(this, tr("Selection error"), tr("Nothing selected!")); return; } @@ -331,7 +331,7 @@ void TaskFemConstraintContact::removeFromSelectionMaster() } } std::sort(itemsToDel.begin(), itemsToDel.end()); - while (itemsToDel.size() > 0){ + while (!itemsToDel.empty()){ Objects.erase(Objects.begin() + itemsToDel.back()); SubElements.erase(SubElements.begin() + itemsToDel.back()); itemsToDel.pop_back(); diff --git a/src/Mod/Fem/Gui/TaskFemConstraintDisplacement.cpp b/src/Mod/Fem/Gui/TaskFemConstraintDisplacement.cpp index 5cf222c7f6..b3270cbfa3 100644 --- a/src/Mod/Fem/Gui/TaskFemConstraintDisplacement.cpp +++ b/src/Mod/Fem/Gui/TaskFemConstraintDisplacement.cpp @@ -127,7 +127,7 @@ TaskFemConstraintDisplacement::TaskFemConstraintDisplacement(ViewProviderFemCons for (std::size_t i = 0; i < Objects.size(); i++) { ui->lw_references->addItem(makeRefText(Objects[i], SubElements[i])); } - if (Objects.size() > 0) { + if (!Objects.empty()) { ui->lw_references->setCurrentRow(0, QItemSelectionModel::ClearAndSelect); } @@ -369,7 +369,7 @@ void TaskFemConstraintDisplacement::rotfreez(int val) { void TaskFemConstraintDisplacement::addToSelection() { std::vector selection = Gui::Selection().getSelectionEx(); //gets vector of selected objects of active document - if (selection.size() == 0) { + if (selection.empty()) { QMessageBox::warning(this, tr("Selection error"), tr("Nothing selected!")); return; } @@ -426,7 +426,7 @@ void TaskFemConstraintDisplacement::addToSelection() void TaskFemConstraintDisplacement::removeFromSelection() { std::vector selection = Gui::Selection().getSelectionEx(); //gets vector of selected objects of active document - if (selection.size() == 0) { + if (selection.empty()) { QMessageBox::warning(this, tr("Selection error"), tr("Nothing selected!")); return; } @@ -454,7 +454,7 @@ void TaskFemConstraintDisplacement::removeFromSelection() } } std::sort(itemsToDel.begin(), itemsToDel.end()); - while (itemsToDel.size() > 0) { + while (!itemsToDel.empty()) { Objects.erase(Objects.begin() + itemsToDel.back()); SubElements.erase(SubElements.begin() + itemsToDel.back()); itemsToDel.pop_back(); diff --git a/src/Mod/Fem/Gui/TaskFemConstraintFixed.cpp b/src/Mod/Fem/Gui/TaskFemConstraintFixed.cpp index 10097ffeea..eb392c88ac 100644 --- a/src/Mod/Fem/Gui/TaskFemConstraintFixed.cpp +++ b/src/Mod/Fem/Gui/TaskFemConstraintFixed.cpp @@ -75,7 +75,7 @@ TaskFemConstraintFixed::TaskFemConstraintFixed(ViewProviderFemConstraintFixed* C for (std::size_t i = 0; i < Objects.size(); i++) { ui->lw_references->addItem(makeRefText(Objects[i], SubElements[i])); } - if (Objects.size() > 0) { + if (!Objects.empty()) { ui->lw_references->setCurrentRow(0, QItemSelectionModel::ClearAndSelect); } @@ -103,7 +103,7 @@ void TaskFemConstraintFixed::updateUI() void TaskFemConstraintFixed::addToSelection() { std::vector selection = Gui::Selection().getSelectionEx(); //gets vector of selected objects of active document - if (selection.size() == 0) { + if (selection.empty()) { QMessageBox::warning(this, tr("Selection error"), tr("Nothing selected!")); return; } @@ -160,7 +160,7 @@ void TaskFemConstraintFixed::addToSelection() void TaskFemConstraintFixed::removeFromSelection() { std::vector selection = Gui::Selection().getSelectionEx(); //gets vector of selected objects of active document - if (selection.size() == 0) { + if (selection.empty()) { QMessageBox::warning(this, tr("Selection error"), tr("Nothing selected!")); return; } @@ -188,7 +188,7 @@ void TaskFemConstraintFixed::removeFromSelection() } } std::sort(itemsToDel.begin(), itemsToDel.end()); - while (itemsToDel.size() > 0) { + while (!itemsToDel.empty()) { Objects.erase(Objects.begin() + itemsToDel.back()); SubElements.erase(SubElements.begin() + itemsToDel.back()); itemsToDel.pop_back(); diff --git a/src/Mod/Fem/Gui/TaskFemConstraintFluidBoundary.cpp b/src/Mod/Fem/Gui/TaskFemConstraintFluidBoundary.cpp index 1419953fe3..7cc5549537 100644 --- a/src/Mod/Fem/Gui/TaskFemConstraintFluidBoundary.cpp +++ b/src/Mod/Fem/Gui/TaskFemConstraintFluidBoundary.cpp @@ -178,7 +178,7 @@ TaskFemConstraintFluidBoundary::TaskFemConstraintFluidBoundary(ViewProviderFemCo else { App::Document* aDoc = pcConstraint->getDocument(); std::vector fem = aDoc->getObjectsOfType(Fem::FemAnalysis::getClassTypeId()); - if (fem.size() >= 1) { + if (!fem.empty()) { pcAnalysis = static_cast(fem[0]); // get the first } } @@ -298,7 +298,7 @@ TaskFemConstraintFluidBoundary::TaskFemConstraintFluidBoundary(ViewProviderFemCo ui->listReferences->clear(); for (std::size_t i = 0; i < Objects.size(); i++) ui->listReferences->addItem(makeRefText(Objects[i], SubElements[i])); - if (Objects.size() > 0) + if (!Objects.empty()) ui->listReferences->setCurrentRow(0, QItemSelectionModel::ClearAndSelect); ui->lineDirection->setText(dir.isEmpty() ? tr("") : dir); ui->checkReverse->setVisible(true); // it is still useful to swap direction of an edge @@ -551,7 +551,7 @@ void TaskFemConstraintFluidBoundary::onButtonDirection(const bool pressed) //get vector of selected objects of active document std::vector selection = Gui::Selection().getSelectionEx(); - if (selection.size() == 0) { + if (selection.empty()) { QMessageBox::warning(this, tr("Empty selection"), tr("Select an edge or a face, please.")); return; } @@ -726,7 +726,7 @@ TaskFemConstraintFluidBoundary::~TaskFemConstraintFluidBoundary() void TaskFemConstraintFluidBoundary::addToSelection() { std::vector selection = Gui::Selection().getSelectionEx(); //gets vector of selected objects of active document - if (selection.size() == 0) { + if (selection.empty()) { QMessageBox::warning(this, tr("Selection error"), tr("Nothing selected!")); return; } @@ -784,7 +784,7 @@ void TaskFemConstraintFluidBoundary::addToSelection() void TaskFemConstraintFluidBoundary::removeFromSelection() { std::vector selection = Gui::Selection().getSelectionEx(); //gets vector of selected objects of active document - if (selection.size() == 0) { + if (selection.empty()) { QMessageBox::warning(this, tr("Selection error"), tr("Nothing selected!")); return; } @@ -812,7 +812,7 @@ void TaskFemConstraintFluidBoundary::removeFromSelection() } } std::sort(itemsToDel.begin(), itemsToDel.end()); - while (itemsToDel.size() > 0) { + while (!itemsToDel.empty()) { Objects.erase(Objects.begin() + itemsToDel.back()); SubElements.erase(SubElements.begin() + itemsToDel.back()); itemsToDel.pop_back(); diff --git a/src/Mod/Fem/Gui/TaskFemConstraintForce.cpp b/src/Mod/Fem/Gui/TaskFemConstraintForce.cpp index 8ecac686b3..97047dc090 100644 --- a/src/Mod/Fem/Gui/TaskFemConstraintForce.cpp +++ b/src/Mod/Fem/Gui/TaskFemConstraintForce.cpp @@ -95,7 +95,7 @@ TaskFemConstraintForce::TaskFemConstraintForce(ViewProviderFemConstraintForce* C ui->listReferences->clear(); for (std::size_t i = 0; i < Objects.size(); i++) ui->listReferences->addItem(makeRefText(Objects[i], SubElements[i])); - if (Objects.size() > 0) + if (!Objects.empty()) ui->listReferences->setCurrentRow(0, QItemSelectionModel::ClearAndSelect); ui->lineDirection->setText(dir.isEmpty() ? QString() : dir); ui->checkReverse->setChecked(reversed); @@ -124,7 +124,7 @@ void TaskFemConstraintForce::updateUI() void TaskFemConstraintForce::addToSelection() { std::vector selection = Gui::Selection().getSelectionEx(); //gets vector of selected objects of active document - if (selection.size() == 0) { + if (selection.empty()) { QMessageBox::warning(this, tr("Selection error"), tr("Nothing selected!")); return; } @@ -182,7 +182,7 @@ void TaskFemConstraintForce::addToSelection() void TaskFemConstraintForce::removeFromSelection() { std::vector selection = Gui::Selection().getSelectionEx(); //gets vector of selected objects of active document - if (selection.size() == 0) { + if (selection.empty()) { QMessageBox::warning(this, tr("Selection error"), tr("Nothing selected!")); return; } @@ -210,7 +210,7 @@ void TaskFemConstraintForce::removeFromSelection() } } std::sort(itemsToDel.begin(), itemsToDel.end()); - while (itemsToDel.size() > 0) { + while (!itemsToDel.empty()) { Objects.erase(Objects.begin() + itemsToDel.back()); SubElements.erase(SubElements.begin() + itemsToDel.back()); itemsToDel.pop_back(); diff --git a/src/Mod/Fem/Gui/TaskFemConstraintHeatflux.cpp b/src/Mod/Fem/Gui/TaskFemConstraintHeatflux.cpp index c5b99de74b..87a207567d 100644 --- a/src/Mod/Fem/Gui/TaskFemConstraintHeatflux.cpp +++ b/src/Mod/Fem/Gui/TaskFemConstraintHeatflux.cpp @@ -112,7 +112,7 @@ TaskFemConstraintHeatflux::TaskFemConstraintHeatflux(ViewProviderFemConstraintHe for (std::size_t i = 0; i < Objects.size(); i++) { ui->lw_references->addItem(makeRefText(Objects[i], SubElements[i])); } - if (Objects.size() > 0) { + if (!Objects.empty()) { ui->lw_references->setCurrentRow(0, QItemSelectionModel::ClearAndSelect); } @@ -197,7 +197,7 @@ void TaskFemConstraintHeatflux::Flux() void TaskFemConstraintHeatflux::addToSelection() { std::vector selection = Gui::Selection().getSelectionEx(); //gets vector of selected objects of active document - if (selection.size() == 0) { + if (selection.empty()) { QMessageBox::warning(this, tr("Selection error"), tr("Nothing selected!")); return; } @@ -213,7 +213,7 @@ void TaskFemConstraintHeatflux::addToSelection() const std::vector& subNames = it->getSubNames(); App::DocumentObject* obj = it->getObject(); - if (subNames.size() > 0) { + if (!subNames.empty()) { for (size_t subIt = 0; subIt < (subNames.size()); ++subIt) { if (subNames[subIt].substr(0, 4) != "Face") { QMessageBox::warning(this, tr("Selection error"), tr("Selection must only consist of faces!")); @@ -250,7 +250,7 @@ void TaskFemConstraintHeatflux::addToSelection() void TaskFemConstraintHeatflux::removeFromSelection() { std::vector selection = Gui::Selection().getSelectionEx(); //gets vector of selected objects of active document - if (selection.size() == 0) { + if (selection.empty()) { QMessageBox::warning(this, tr("Selection error"), tr("Nothing selected!")); return; } @@ -267,7 +267,7 @@ void TaskFemConstraintHeatflux::removeFromSelection() const std::vector& subNames = it->getSubNames(); App::DocumentObject* obj = it->getObject(); - if (subNames.size() > 0) { + if (!subNames.empty()) { for (size_t subIt = 0; subIt < (subNames.size()); ++subIt) { if (subNames[subIt].substr(0, 4) != "Face") { QMessageBox::warning(this, tr("Selection error"), tr("Selection must only consist of faces!")); @@ -290,7 +290,7 @@ void TaskFemConstraintHeatflux::removeFromSelection() } } std::sort(itemsToDel.begin(), itemsToDel.end()); - while (itemsToDel.size() > 0) { + while (!itemsToDel.empty()) { Objects.erase(Objects.begin() + itemsToDel.back()); SubElements.erase(SubElements.begin() + itemsToDel.back()); itemsToDel.pop_back(); diff --git a/src/Mod/Fem/Gui/TaskFemConstraintPlaneRotation.cpp b/src/Mod/Fem/Gui/TaskFemConstraintPlaneRotation.cpp index 6e27409c46..e60798d4e4 100644 --- a/src/Mod/Fem/Gui/TaskFemConstraintPlaneRotation.cpp +++ b/src/Mod/Fem/Gui/TaskFemConstraintPlaneRotation.cpp @@ -81,7 +81,7 @@ TaskFemConstraintPlaneRotation::TaskFemConstraintPlaneRotation(ViewProviderFemCo for (std::size_t i = 0; i < Objects.size(); i++) { ui->lw_references->addItem(makeRefText(Objects[i], SubElements[i])); } - if (Objects.size() > 0) { + if (!Objects.empty()) { ui->lw_references->setCurrentRow(0, QItemSelectionModel::ClearAndSelect); } @@ -116,7 +116,7 @@ void TaskFemConstraintPlaneRotation::addToSelection() } else { std::vector selection = Gui::Selection().getSelectionEx(); //gets vector of selected objects of active document - if (selection.size() == 0) { + if (selection.empty()) { QMessageBox::warning(this, tr("Selection error"), tr("Nothing selected!")); return; } @@ -177,7 +177,7 @@ void TaskFemConstraintPlaneRotation::addToSelection() void TaskFemConstraintPlaneRotation::removeFromSelection() { std::vector selection = Gui::Selection().getSelectionEx(); //gets vector of selected objects of active document - if (selection.size() == 0) { + if (selection.empty()) { QMessageBox::warning(this, tr("Selection error"), tr("Nothing selected!")); return; } @@ -205,7 +205,7 @@ void TaskFemConstraintPlaneRotation::removeFromSelection() } } std::sort(itemsToDel.begin(), itemsToDel.end()); - while (itemsToDel.size() > 0) { + while (!itemsToDel.empty()) { Objects.erase(Objects.begin() + itemsToDel.back()); SubElements.erase(SubElements.begin() + itemsToDel.back()); itemsToDel.pop_back(); diff --git a/src/Mod/Fem/Gui/TaskFemConstraintPressure.cpp b/src/Mod/Fem/Gui/TaskFemConstraintPressure.cpp index 791428f521..512438772a 100644 --- a/src/Mod/Fem/Gui/TaskFemConstraintPressure.cpp +++ b/src/Mod/Fem/Gui/TaskFemConstraintPressure.cpp @@ -84,7 +84,7 @@ TaskFemConstraintPressure::TaskFemConstraintPressure(ViewProviderFemConstraintPr for (std::size_t i = 0; i < Objects.size(); i++) { ui->lw_references->addItem(makeRefText(Objects[i], SubElements[i])); } - if (Objects.size() > 0) { + if (!Objects.empty()) { ui->lw_references->setCurrentRow(0, QItemSelectionModel::ClearAndSelect); } @@ -118,7 +118,7 @@ void TaskFemConstraintPressure::onCheckReverse(const bool pressed) void TaskFemConstraintPressure::addToSelection() { std::vector selection = Gui::Selection().getSelectionEx(); //gets vector of selected objects of active document - if (selection.size() == 0) { + if (selection.empty()) { QMessageBox::warning(this, tr("Selection error"), tr("Nothing selected!")); return; } @@ -164,7 +164,7 @@ void TaskFemConstraintPressure::addToSelection() void TaskFemConstraintPressure::removeFromSelection() { std::vector selection = Gui::Selection().getSelectionEx(); //gets vector of selected objects of active document - if (selection.size() == 0) { + if (selection.empty()) { QMessageBox::warning(this, tr("Selection error"), tr("Nothing selected!")); return; } @@ -192,7 +192,7 @@ void TaskFemConstraintPressure::removeFromSelection() } } std::sort(itemsToDel.begin(), itemsToDel.end()); - while (itemsToDel.size() > 0) { + while (!itemsToDel.empty()) { Objects.erase(Objects.begin() + itemsToDel.back()); SubElements.erase(SubElements.begin() + itemsToDel.back()); itemsToDel.pop_back(); diff --git a/src/Mod/Fem/Gui/TaskFemConstraintSpring.cpp b/src/Mod/Fem/Gui/TaskFemConstraintSpring.cpp index 373915a17f..1ec9e3b085 100644 --- a/src/Mod/Fem/Gui/TaskFemConstraintSpring.cpp +++ b/src/Mod/Fem/Gui/TaskFemConstraintSpring.cpp @@ -87,7 +87,7 @@ TaskFemConstraintSpring::TaskFemConstraintSpring(ViewProviderFemConstraintSpring for (std::size_t i = 0; i < Objects.size(); i++) { ui->lw_references->addItem(makeRefText(Objects[i], SubElements[i])); } - if (Objects.size() > 0) { + if (!Objects.empty()) { ui->lw_references->setCurrentRow(0, QItemSelectionModel::ClearAndSelect); } @@ -116,7 +116,7 @@ void TaskFemConstraintSpring::updateUI() void TaskFemConstraintSpring::addToSelection() { std::vector selection = Gui::Selection().getSelectionEx(); //gets vector of selected objects of active document - if (selection.size() == 0) { + if (selection.empty()) { QMessageBox::warning(this, tr("Selection error"), tr("Nothing selected!")); return; } @@ -162,7 +162,7 @@ void TaskFemConstraintSpring::addToSelection() void TaskFemConstraintSpring::removeFromSelection() { std::vector selection = Gui::Selection().getSelectionEx(); //gets vector of selected objects of active document - if (selection.size() == 0) { + if (selection.empty()) { QMessageBox::warning(this, tr("Selection error"), tr("Nothing selected!")); return; } @@ -190,7 +190,7 @@ void TaskFemConstraintSpring::removeFromSelection() } } std::sort(itemsToDel.begin(), itemsToDel.end()); - while (itemsToDel.size() > 0) { + while (!itemsToDel.empty()) { Objects.erase(Objects.begin() + itemsToDel.back()); SubElements.erase(SubElements.begin() + itemsToDel.back()); itemsToDel.pop_back(); diff --git a/src/Mod/Fem/Gui/TaskFemConstraintTemperature.cpp b/src/Mod/Fem/Gui/TaskFemConstraintTemperature.cpp index 49bceba6d3..397e06e346 100644 --- a/src/Mod/Fem/Gui/TaskFemConstraintTemperature.cpp +++ b/src/Mod/Fem/Gui/TaskFemConstraintTemperature.cpp @@ -101,7 +101,7 @@ TaskFemConstraintTemperature::TaskFemConstraintTemperature(ViewProviderFemConstr for (std::size_t i = 0; i < Objects.size(); i++) { ui->lw_references->addItem(makeRefText(Objects[i], SubElements[i])); } - if (Objects.size() > 0) { + if (!Objects.empty()) { ui->lw_references->setCurrentRow(0, QItemSelectionModel::ClearAndSelect); } @@ -166,7 +166,7 @@ void TaskFemConstraintTemperature::Flux() void TaskFemConstraintTemperature::addToSelection() { std::vector selection = Gui::Selection().getSelectionEx(); //gets vector of selected objects of active document - if (selection.size() == 0) { + if (selection.empty()) { QMessageBox::warning(this, tr("Selection error"), tr("Nothing selected!")); return; } @@ -207,7 +207,7 @@ void TaskFemConstraintTemperature::addToSelection() void TaskFemConstraintTemperature::removeFromSelection() { std::vector selection = Gui::Selection().getSelectionEx(); //gets vector of selected objects of active document - if (selection.size() == 0) { + if (selection.empty()) { QMessageBox::warning(this, tr("Selection error"), tr("Nothing selected!")); return; } @@ -235,7 +235,7 @@ void TaskFemConstraintTemperature::removeFromSelection() } } std::sort(itemsToDel.begin(), itemsToDel.end()); - while (itemsToDel.size() > 0) { + while (!itemsToDel.empty()) { Objects.erase(Objects.begin() + itemsToDel.back()); SubElements.erase(SubElements.begin() + itemsToDel.back()); itemsToDel.pop_back(); diff --git a/src/Mod/Fem/Gui/TaskFemConstraintTransform.cpp b/src/Mod/Fem/Gui/TaskFemConstraintTransform.cpp index 8dd05fe1b3..66e1f5198d 100644 --- a/src/Mod/Fem/Gui/TaskFemConstraintTransform.cpp +++ b/src/Mod/Fem/Gui/TaskFemConstraintTransform.cpp @@ -119,7 +119,7 @@ TaskFemConstraintTransform::TaskFemConstraintTransform(ViewProviderFemConstraint ui->lw_dis_cylin->addItem(makeText(nDispl[i])); } - if (Objects.size() > 0) { + if (!Objects.empty()) { for (std::size_t i = 0; i < Objects.size(); i++) { ui->lw_Rect->addItem(makeRefText(Objects[i], SubElements[i])); } @@ -137,7 +137,7 @@ TaskFemConstraintTransform::TaskFemConstraintTransform(ViewProviderFemConstraint connect(ui->btnRemove, SIGNAL(clicked()), this, SLOT(removeFromSelection())); updateUI(); - if ((p == 0) && (Objects.size() > 0)) { + if ((p == 0) && (!Objects.empty())) { QMessageBox::warning(this, tr("Constraint update error"), tr("The transformable faces have changed. Please add only the transformable faces and remove non-transformable faces!")); return; } @@ -201,7 +201,7 @@ void TaskFemConstraintTransform::Rect() { Gui::Command::doCommand(Gui::Command::Doc, "App.ActiveDocument.%s.TransformType = %s", name.c_str(), get_transform_type().c_str()); Fem::ConstraintTransform* pcConstraint = static_cast(ConstraintView->getObject()); std::vector Objects = pcConstraint->References.getValues(); - if (Objects.size() > 0) { + if (!Objects.empty()) { setSelection(ui->lw_Rect->item(0)); removeFromSelection(); } @@ -216,7 +216,7 @@ void TaskFemConstraintTransform::Cyl() { Gui::Command::doCommand(Gui::Command::Doc, "App.ActiveDocument.%s.TransformType = %s", name.c_str(), get_transform_type().c_str()); Fem::ConstraintTransform* pcConstraint = static_cast(ConstraintView->getObject()); std::vector Objects = pcConstraint->References.getValues(); - if (Objects.size() > 0) { + if (!Objects.empty()) { setSelection(ui->lw_Rect->item(0)); removeFromSelection(); } @@ -227,7 +227,7 @@ void TaskFemConstraintTransform::addToSelection() { int rows = ui->lw_Rect->model()->rowCount(); std::vector selection = Gui::Selection().getSelectionEx(); //gets vector of selected objects of active document - if (selection.size() == 0) { + if (selection.empty()) { QMessageBox::warning(this, tr("Selection error"), tr("Nothing selected!")); return; } @@ -299,7 +299,7 @@ void TaskFemConstraintTransform::addToSelection() this, SLOT(setSelection(QListWidgetItem*))); } } - if (Objects.size() == 0) { + if (Objects.empty()) { QMessageBox::warning(this, tr("Selection error"), tr("Only transformable faces can be selected! Apply displacement constraint to surface first then apply constraint to surface")); Gui::Selection().clearSelection(); return; @@ -347,7 +347,7 @@ void TaskFemConstraintTransform::addToSelection() void TaskFemConstraintTransform::removeFromSelection() { std::vector selection = Gui::Selection().getSelectionEx(); //gets vector of selected objects of active document - if (selection.size() == 0) { + if (selection.empty()) { QMessageBox::warning(this, tr("Selection error"), tr("Nothing selected!")); return; } @@ -375,7 +375,7 @@ void TaskFemConstraintTransform::removeFromSelection() } } std::sort(itemsToDel.begin(), itemsToDel.end()); - while (itemsToDel.size() > 0) { + while (!itemsToDel.empty()) { Objects.erase(Objects.begin() + itemsToDel.back()); SubElements.erase(SubElements.begin() + itemsToDel.back()); itemsToDel.pop_back(); diff --git a/src/Mod/Fem/Gui/ViewProviderFemConstraintTransform.cpp b/src/Mod/Fem/Gui/ViewProviderFemConstraintTransform.cpp index 49bb6e448a..1bb17c6b0e 100644 --- a/src/Mod/Fem/Gui/ViewProviderFemConstraintTransform.cpp +++ b/src/Mod/Fem/Gui/ViewProviderFemConstraintTransform.cpp @@ -276,7 +276,7 @@ void ViewProviderFemConstraintTransform::updateData(const App::Property* prop) return; std::vector::const_iterator n = normals.begin(); - if (points.size() > 0) { + if (!points.empty()) { Base::Vector3d base = pcConstraint->BasePoint.getValue(); Base::Vector3d axis = pcConstraint->Axis.getValue(); diff --git a/src/Mod/Fem/Gui/ViewProviderFemMesh.cpp b/src/Mod/Fem/Gui/ViewProviderFemMesh.cpp index 36d5329c63..c0bae73065 100644 --- a/src/Mod/Fem/Gui/ViewProviderFemMesh.cpp +++ b/src/Mod/Fem/Gui/ViewProviderFemMesh.cpp @@ -604,7 +604,7 @@ void ViewProviderFemMesh::resetDisplacementByNodeId(void) /// reaply the node displacement with a certain factor and do a redraw void ViewProviderFemMesh::applyDisplacementToNodes(double factor) { - if(DisplacementVector.size() == 0) + if(DisplacementVector.empty()) return; float x,y,z; diff --git a/src/Mod/Import/App/ImportOCAF2.cpp b/src/Mod/Import/App/ImportOCAF2.cpp index 92de1cb9df..f3d111418e 100644 --- a/src/Mod/Import/App/ImportOCAF2.cpp +++ b/src/Mod/Import/App/ImportOCAF2.cpp @@ -245,7 +245,7 @@ void ImportOCAF2::setObjectName(Info &info, TDF_Label label) { if(!info.obj) return; info.baseName = getLabelName(label); - if(info.baseName.size()) + if(!info.baseName.empty()) info.obj->Label.setValue(info.baseName.c_str()); else{ auto linked = info.obj->getLinkedObject(false); @@ -400,7 +400,7 @@ bool ImportOCAF2::createObject(App::Document *doc, TDF_Label label, if(aColorTool->GetColor(l, XCAFDoc_ColorCurv, aColor)) { edgeColor = convertColor(aColor); foundEdgeColor = true; - if(j==0 && foundFaceColor && faceColors.size() && edgeColor==faceColor) { + if(j==0 && foundFaceColor && !faceColors.empty() && edgeColor==faceColor) { // Do not set edge the same color as face foundEdgeColor = false; } @@ -659,7 +659,7 @@ void ImportOCAF2::getSHUOColors(TDF_Label label, ss.str(""); break; } - if(it->second.size()) + if(!it->second.empty()) ss << it->second << '.'; } if(!shuo->NbChildren()) @@ -721,7 +721,7 @@ App::DocumentObject *ImportOCAF2::loadShape(App::Document *doc, auto name = getLabelName(label); if(info.faceColor!=it->second.faceColor || info.edgeColor!=it->second.edgeColor || - (name.size() && info.baseName.size() && name!=info.baseName)) + (!name.empty() && !info.baseName.empty() && name!=info.baseName)) { auto compound = static_cast(doc->addObject("Part::Compound2","Compound")); compound->Links.setValue(info.obj); @@ -749,7 +749,7 @@ App::DocumentObject *ImportOCAF2::loadShape(App::Document *doc, applyLinkColor(link,-1,info.faceColor); myNames.emplace(label,link->getNameInDocument()); - if(shuoColors.size()) + if(!shuoColors.empty()) applyElementColors(link,shuoColors); return link; } @@ -872,7 +872,7 @@ bool ImportOCAF2::createAssembly(App::Document *_doc, if(!createGroup(doc,info,shape,children,visibilities,shuoColors.empty())) return false; - if(shuoColors.size()) + if(!shuoColors.empty()) applyElementColors(info.obj,shuoColors); return true; } @@ -1042,7 +1042,7 @@ void ExportOCAF2::setupObject(TDF_Label label, App::DocumentObject *obj, for(auto &v : colors) { TDF_Label nodeLabel = label; - if(v.first.size()) { + if(!v.first.empty()) { TDF_LabelSequence labels; if(aShapeTool->IsComponent(label)) labels.Append(label); @@ -1286,7 +1286,7 @@ TDF_Label ExportOCAF2::exportObject(App::DocumentObject* parentObj, } int vis = -1; if(parentGrp) { - if(groupLinks.size() + if(!groupLinks.empty() && parentGrp->getExtensionByType(true,false)) { vis = groupLinks.back()->isElementVisible(childName.c_str()); @@ -1331,7 +1331,7 @@ TDF_Label ExportOCAF2::exportObject(App::DocumentObject* parentObj, } } - if (groupLinks.size() && groupLinks.back()==obj) + if (!groupLinks.empty() && groupLinks.back()==obj) groupLinks.pop_back(); // Finished adding components. Now retrieve the computed non-located shape @@ -1342,7 +1342,7 @@ TDF_Label ExportOCAF2::exportObject(App::DocumentObject* parentObj, for(auto link : links) myObjects.emplace(link, label); - if(!parent.IsNull() && links.size()) + if(!parent.IsNull() && !links.empty()) linked = links.back(); else linked = obj; diff --git a/src/Mod/Inspection/App/InspectionFeature.cpp b/src/Mod/Inspection/App/InspectionFeature.cpp index e39b95f8e5..2fe469fcc8 100644 --- a/src/Mod/Inspection/App/InspectionFeature.cpp +++ b/src/Mod/Inspection/App/InspectionFeature.cpp @@ -374,9 +374,9 @@ float InspectNominalFastMesh::getDistance(const Base::Vector3f& point) const unsigned long ulX, ulY, ulZ; _pGrid->Position(point, ulX, ulY, ulZ); unsigned long ulLevel = 0; - while (indices.size() == 0 && ulLevel <= max_level) + while (indices.empty() && ulLevel <= max_level) _pGrid->GetHull(ulX, ulY, ulZ, ulLevel++, indices); - if (indices.size() == 0 || ulLevel==1) + if (indices.empty() || ulLevel==1) _pGrid->GetHull(ulX, ulY, ulZ, ulLevel, indices); #endif diff --git a/src/Mod/Mesh/App/Core/Algorithm.cpp b/src/Mod/Mesh/App/Core/Algorithm.cpp index 99587fe246..23627423d2 100644 --- a/src/Mod/Mesh/App/Core/Algorithm.cpp +++ b/src/Mod/Mesh/App/Core/Algorithm.cpp @@ -360,7 +360,7 @@ void MeshAlgorithm::GetFacetBorders (const std::vector &raulInd, } } - if (aclEdges.size() == 0) + if (aclEdges.empty()) return; // no borders found (=> solid) // search for edges in the unsorted list @@ -373,7 +373,7 @@ void MeshAlgorithm::GetFacetBorders (const std::vector &raulInd, clBorder.push_back(ulFirst); clBorder.push_back(ulLast); - while (aclEdges.size() > 0) { + while (!aclEdges.empty()) { // get adjacent edge std::list >::iterator pEI; for (pEI = aclEdges.begin(); pEI != aclEdges.end(); ++pEI) { @@ -417,7 +417,7 @@ void MeshAlgorithm::GetFacetBorders (const std::vector &raulInd, rclBorders.emplace_back(clBorder.begin(), clBorder.end()); clBorder.clear(); - if (aclEdges.size() > 0) { + if (!aclEdges.empty()) { // start new boundary ulFirst = aclEdges.begin()->first; ulLast = aclEdges.begin()->second; diff --git a/src/Mod/Mesh/App/Core/CylinderFit.cpp b/src/Mod/Mesh/App/Core/CylinderFit.cpp index 81b5db65f2..3a9422d649 100644 --- a/src/Mod/Mesh/App/Core/CylinderFit.cpp +++ b/src/Mod/Mesh/App/Core/CylinderFit.cpp @@ -106,7 +106,7 @@ void CylinderFit::SetApproximations(const Base::Vector3d &base, const Base::Vect _vAxis = axis; _vAxis.Normalize(); _dRadius = 0.0; - if (_vPoints.size() > 0) + if (!_vPoints.empty()) { for (std::list< Base::Vector3f >::const_iterator cIt = _vPoints.begin(); cIt != _vPoints.end(); ++cIt) _dRadius += Base::Vector3d(cIt->x, cIt->y, cIt->z).DistanceToLine(_vBase, _vAxis); @@ -238,7 +238,7 @@ void CylinderFit::ComputeApproximationsLine() _vBase.Set(0.0, 0.0, 0.0); _vAxis.Set(0.0, 0.0, 0.0); _dRadius = 0.0; - if (_vPoints.size() > 0) + if (!_vPoints.empty()) { std::vector input; std::transform(_vPoints.begin(), _vPoints.end(), std::back_inserter(input), @@ -388,7 +388,7 @@ void CylinderFit::findBestSolDirection(SolutionD &solDir) double CylinderFit::meanXObs() { double mx = 0.0; - if (_vPoints.size() > 0) + if (!_vPoints.empty()) { for (std::list::const_iterator cIt = _vPoints.begin(); cIt != _vPoints.end(); ++cIt) mx += cIt->x; @@ -400,7 +400,7 @@ double CylinderFit::meanXObs() double CylinderFit::meanYObs() { double my = 0.0; - if (_vPoints.size() > 0) + if (!_vPoints.empty()) { for (std::list::const_iterator cIt = _vPoints.begin(); cIt != _vPoints.end(); ++cIt) my += cIt->y; @@ -412,7 +412,7 @@ double CylinderFit::meanYObs() double CylinderFit::meanZObs() { double mz = 0.0; - if (_vPoints.size() > 0) + if (!_vPoints.empty()) { for (std::list::const_iterator cIt = _vPoints.begin(); cIt != _vPoints.end(); ++cIt) mz += cIt->z; diff --git a/src/Mod/Mesh/App/Core/Elements.cpp b/src/Mod/Mesh/App/Core/Elements.cpp index a10ca0a416..f3580aeb28 100644 --- a/src/Mod/Mesh/App/Core/Elements.cpp +++ b/src/Mod/Mesh/App/Core/Elements.cpp @@ -1030,7 +1030,7 @@ void MeshGeomFacet::SubSample (float fStep, std::vector &rclPoin } // if couldn't subsample the facet take gravity center - if (clPoints.size() == 0) + if (clPoints.empty()) clPoints.push_back(this->GetGravityPoint()); rclPoints.insert(rclPoints.end(), clPoints.begin(), clPoints.end()); diff --git a/src/Mod/Mesh/App/Core/Evaluation.cpp b/src/Mod/Mesh/App/Core/Evaluation.cpp index 4070b1b090..3c97275700 100644 --- a/src/Mod/Mesh/App/Core/Evaluation.cpp +++ b/src/Mod/Mesh/App/Core/Evaluation.cpp @@ -572,7 +572,7 @@ bool MeshEvalSingleFacet::Evaluate () _aclManifoldList.push_back(aulManifolds); } */ - return (nonManifoldList.size() == 0); + return (nonManifoldList.empty()); } bool MeshFixSingleFacet::Fixup () @@ -619,7 +619,7 @@ bool MeshEvalSelfIntersection::Evaluate () clGridIter.GetElements(aulGridElements); seq.next(); - if (aulGridElements.size()==0) + if (aulGridElements.empty()) continue; MeshGeomFacet facet1, facet2; @@ -716,7 +716,7 @@ void MeshEvalSelfIntersection::GetIntersections(std::vector &raclInd) const { const std::set &rclSet = _aulGrid[ulX][ulY][ulZ]; - if (rclSet.size() > 0) + if (!rclSet.empty()) { raclInd.insert(rclSet.begin(), rclSet.end()); return rclSet.size(); diff --git a/src/Mod/Mesh/App/Core/SetOperations.cpp b/src/Mod/Mesh/App/Core/SetOperations.cpp index 463b6fb620..140c50d73e 100644 --- a/src/Mod/Mesh/App/Core/SetOperations.cpp +++ b/src/Mod/Mesh/App/Core/SetOperations.cpp @@ -192,7 +192,7 @@ void SetOperations::Cut (std::set& facetsCuttingEdge0, std::set vecFacets2; grid2.Inside(grid1.GetBoundBox(gx1, gy1, gz1), vecFacets2); - if (vecFacets2.size() > 0) + if (!vecFacets2.empty()) { std::set vecFacets1; grid1.GetElements(gx1, gy1, gz1, vecFacets1); diff --git a/src/Mod/Mesh/App/Core/SphereFit.cpp b/src/Mod/Mesh/App/Core/SphereFit.cpp index 473e0237e7..0ea17c9ab4 100644 --- a/src/Mod/Mesh/App/Core/SphereFit.cpp +++ b/src/Mod/Mesh/App/Core/SphereFit.cpp @@ -162,7 +162,7 @@ void SphereFit::ComputeApproximations() _numIter = 0; _vCenter.Set(0.0, 0.0, 0.0); _dRadius = 0.0; - if (_vPoints.size() > 0) + if (!_vPoints.empty()) { std::list< Base::Vector3f >::const_iterator cIt; for (cIt = _vPoints.begin(); cIt != _vPoints.end(); ++cIt) diff --git a/src/Mod/Mesh/App/Core/Triangulation.cpp b/src/Mod/Mesh/App/Core/Triangulation.cpp index 8adfc38c2c..e51787b94f 100644 --- a/src/Mod/Mesh/App/Core/Triangulation.cpp +++ b/src/Mod/Mesh/App/Core/Triangulation.cpp @@ -102,7 +102,7 @@ void AbstractPolygonTriangulator::SetVerifier(TriangulationVerifier* v) void AbstractPolygonTriangulator::SetPolygon(const std::vector& raclPoints) { this->_points = raclPoints; - if (this->_points.size() > 0) { + if (!this->_points.empty()) { if (this->_points.front() == this->_points.back()) this->_points.pop_back(); } diff --git a/src/Mod/Mesh/App/Core/Trim.cpp b/src/Mod/Mesh/App/Core/Trim.cpp index 3f3722dd88..08331fb9a8 100644 --- a/src/Mod/Mesh/App/Core/Trim.cpp +++ b/src/Mod/Mesh/App/Core/Trim.cpp @@ -342,7 +342,7 @@ bool MeshTrimming::CreateFacets(FacetIndex ulFacetPos, int iSide, const std::vec return false; // no intersection point found => triangle is only touched at a corner point - if (raclPoints.size() == 0) { + if (raclPoints.empty()) { MeshFacet& facet = myMesh._aclFacetArray[ulFacetPos]; int iCtPtsIn=0; int iCtPtsOn=0; diff --git a/src/Mod/Mesh/App/Core/Visitor.cpp b/src/Mod/Mesh/App/Core/Visitor.cpp index d5da1438bc..6346ca7ce5 100644 --- a/src/Mod/Mesh/App/Core/Visitor.cpp +++ b/src/Mod/Mesh/App/Core/Visitor.cpp @@ -44,7 +44,7 @@ unsigned long MeshKernel::VisitNeighbourFacets (MeshFacetVisitor &rclFVisitor, F _aclFacetArray[ulStartFacet].SetFlag(MeshFacet::VISIT); // as long as free neighbours - while (clCurrentLevel.size() > 0) { + while (!clCurrentLevel.empty()) { // visit all neighbours of the current level for (clCurrIter = clCurrentLevel.begin(); clCurrIter < clCurrentLevel.end(); ++clCurrIter) { clCurrFacet = _aclFacetArray.begin() + *clCurrIter; @@ -94,7 +94,7 @@ unsigned long MeshKernel::VisitNeighbourFacetsOverCorners (MeshFacetVisitor &rcl aclCurrentLevel.push_back(ulStartFacet); raclFAry[ulStartFacet].SetFlag(MeshFacet::VISIT); - while (aclCurrentLevel.size() > 0) { + while (!aclCurrentLevel.empty()) { // visit all neighbours of the current level for (std::vector::iterator pCurrFacet = aclCurrentLevel.begin(); pCurrFacet < aclCurrentLevel.end(); ++pCurrFacet) { for (int i = 0; i < 3; i++) { @@ -132,7 +132,7 @@ unsigned long MeshKernel::VisitNeighbourPoints (MeshPointVisitor &rclPVisitor, P aclCurrentLevel.push_back(ulStartPoint); (pPBegin + ulStartPoint)->SetFlag(MeshPoint::VISIT); - while (aclCurrentLevel.size() > 0) { + while (!aclCurrentLevel.empty()) { // visit all neighbours of the current level for (clCurrIter = aclCurrentLevel.begin(); clCurrIter < aclCurrentLevel.end(); ++clCurrIter) { const std::set& raclNB = clNPs[*clCurrIter]; diff --git a/src/Mod/Mesh/App/Mesh.cpp b/src/Mod/Mesh/App/Mesh.cpp index 79fd28f70b..8b47ea49aa 100644 --- a/src/Mod/Mesh/App/Mesh.cpp +++ b/src/Mod/Mesh/App/Mesh.cpp @@ -1004,7 +1004,7 @@ void MeshObject::offsetSpecial2(float fSize) // if there are no flipped triangles -> stop //int f =fliped.size(); - if (fliped.size() == 0) + if (fliped.empty()) break; for( std::set::iterator It= fliped.begin();It!=fliped.end();++It) diff --git a/src/Mod/Mesh/Gui/SoFCMeshObject.cpp b/src/Mod/Mesh/Gui/SoFCMeshObject.cpp index c656bbc302..073fbb2479 100644 --- a/src/Mod/Mesh/Gui/SoFCMeshObject.cpp +++ b/src/Mod/Mesh/Gui/SoFCMeshObject.cpp @@ -1132,7 +1132,7 @@ void SoFCMeshObjectShape::generatePrimitives(SoAction* action) const MeshCore::MeshFacetArray & rFacets = mesh->getKernel().GetFacets(); if (rPoints.size() < 3) return; - if (rFacets.size() < 1) + if (rFacets.empty()) return; // get material binding @@ -1544,7 +1544,7 @@ void SoFCMeshSegmentShape::generatePrimitives(SoAction* action) const MeshCore::MeshFacetArray & rFacets = mesh->getKernel().GetFacets(); if (rPoints.size() < 3) return; - if (rFacets.size() < 1) + if (rFacets.empty()) return; if (mesh->countSegments() <= this->index.getValue()) return; @@ -1788,7 +1788,7 @@ void SoFCMeshObjectBoundary::computeBBox(SoAction *action, SbBox3f &box, SbVec3f if (!mesh) return; const MeshCore::MeshPointArray & rPoints = mesh->getKernel().GetPoints(); - if (rPoints.size() > 0) { + if (!rPoints.empty()) { Base::BoundBox3f cBox; for (MeshCore::MeshPointArray::_TConstIterator it = rPoints.begin(); it != rPoints.end(); ++it) cBox.Add(*it); diff --git a/src/Mod/MeshPart/App/MeshAlgos.cpp b/src/Mod/MeshPart/App/MeshAlgos.cpp index 3551766207..b7f051143d 100644 --- a/src/Mod/MeshPart/App/MeshAlgos.cpp +++ b/src/Mod/MeshPart/App/MeshAlgos.cpp @@ -100,7 +100,7 @@ void MeshAlgos::offsetSpecial2(MeshCore::MeshKernel* Mesh, float fSize) // if there are no flipped triangles -> stop //int f =fliped.size(); - if(fliped.size() == 0) + if(fliped.empty()) break; for(std::set::iterator It= fliped.begin();It!=fliped.end();++It) diff --git a/src/Mod/Part/App/AppPartPy.cpp b/src/Mod/Part/App/AppPartPy.cpp index 5c5bffd538..13bdabd539 100644 --- a/src/Mod/Part/App/AppPartPy.cpp +++ b/src/Mod/Part/App/AppPartPy.cpp @@ -2214,7 +2214,7 @@ private: } Py::List root_list; - while(edges.size()) { + while(!edges.empty()) { std::list sorted = sort_Edges(Precision::Confusion(), edges); Py::List sorted_list; for (std::list::iterator it = sorted.begin(); it != sorted.end(); ++it) { @@ -2338,7 +2338,7 @@ private: if (!PyArg_ParseTuple(args.ptr(), "sss",&sub,&mapped,&element)) throw Py::Exception(); std::string subname(sub); - if (subname.size() && subname[subname.size()-1]!='.') + if (!subname.empty() && subname[subname.size()-1]!='.') subname += '.'; if (mapped && mapped[0]) { if (!Data::ComplexGeoData::isMappedElement(mapped)) @@ -2346,7 +2346,7 @@ private: subname += mapped; } if (element && element[0]) { - if (subname.size() && subname[subname.size()-1]!='.') + if (!subname.empty() && subname[subname.size()-1]!='.') subname += '.'; subname += element; } diff --git a/src/Mod/Part/App/AttachEnginePyImp.cpp b/src/Mod/Part/App/AttachEnginePyImp.cpp index adee423c4f..d5eb9e173d 100644 --- a/src/Mod/Part/App/AttachEnginePyImp.cpp +++ b/src/Mod/Part/App/AttachEnginePyImp.cpp @@ -230,7 +230,7 @@ Py::List AttachEnginePy::getImplementedModes(void) const Py::List ret; AttachEngine &attacher = *(this->getAttachEnginePtr()); for(int imode = 0 ; imode < mmDummy_NumberOfModes ; imode++){ - if(attacher.modeRefTypes[imode].size() > 0){ + if(!attacher.modeRefTypes[imode].empty()){ ret.append(Py::String(attacher.getModeName(eMapMode(imode)))); } } diff --git a/src/Mod/Part/App/Attacher.cpp b/src/Mod/Part/App/Attacher.cpp index 888864207d..5f3289575b 100644 --- a/src/Mod/Part/App/Attacher.cpp +++ b/src/Mod/Part/App/Attacher.cpp @@ -398,7 +398,7 @@ void AttachEngine::suggestMapModes(SuggestResult &result) const } } if (score > 0){ - if(mlist.size() == 0) + if(mlist.empty()) mlist.push_back(eMapMode(iMode)); else if (mlist.back() != eMapMode(iMode)) mlist.push_back(eMapMode(iMode)); @@ -413,7 +413,7 @@ void AttachEngine::EnableAllSupportedModes() this->modeEnabled.resize(mmDummy_NumberOfModes,false); assert(modeRefTypes.size() > 0); for (std::size_t i = 0; i < this->modeEnabled.size(); i++) { - modeEnabled[i] = modeRefTypes[i].size() > 0; + modeEnabled[i] = !modeRefTypes[i].empty(); } } @@ -988,7 +988,7 @@ Base::Placement AttachEngine3D::calculateAttachedPlacement(const Base::Placement std::vector types; readLinks(this->references, parts, shapes, copiedShapeStorage, types); - if (parts.size() == 0) + if (parts.empty()) throw ExceptionCancel(); @@ -1010,7 +1010,7 @@ Base::Placement AttachEngine3D::calculateAttachedPlacement(const Base::Placement //should have been filtered out already! break; case mmTranslate:{ - if (shapes.size() < 1) + if (shapes.empty()) throw Base::ValueError("AttachEngine3D::calculateAttachedPlacement: no subobjects specified (need one vertex)."); const TopoDS_Shape &sh = *shapes[0]; if (sh.IsNull()) @@ -1116,7 +1116,7 @@ Base::Placement AttachEngine3D::calculateAttachedPlacement(const Base::Placement SketchBasePoint = gpr.CentreOfMass(); }break; case mmFlatFace:{ - if (shapes.size() < 1) + if (shapes.empty()) throw Base::ValueError("AttachEngine3D::calculateAttachedPlacement: no subobjects specified (needed one planar face)."); const TopoDS_Face &face = TopoDS::Face(*(shapes[0])); @@ -1222,7 +1222,7 @@ Base::Placement AttachEngine3D::calculateAttachedPlacement(const Base::Placement case mmFrenetTB: case mmRevolutionSection: case mmConcentric: {//all alignments to point on curve - if (shapes.size() < 1) + if (shapes.empty()) throw Base::ValueError("AttachEngine3D::calculateAttachedPlacement: no subshapes specified (need one edge, and an optional vertex)."); bool bThruVertex = false; @@ -1756,7 +1756,7 @@ Base::Placement AttachEngineLine::calculateAttachedPlacement(const Base::Placeme std::vector types; readLinks(this->references, parts, shapes, copiedShapeStorage, types); - if (parts.size() == 0) + if (parts.empty()) throw ExceptionCancel(); diff --git a/src/Mod/Part/App/CrossSection.cpp b/src/Mod/Part/App/CrossSection.cpp index 0a8887823a..88d53dfeb7 100644 --- a/src/Mod/Part/App/CrossSection.cpp +++ b/src/Mod/Part/App/CrossSection.cpp @@ -138,7 +138,7 @@ void CrossSection::connectEdges (const std::list& edges, std::list< { // Hint: Use ShapeAnalysis_FreeBounds::ConnectEdgesToWires() as an alternative std::list edge_list = edges; - while (edge_list.size() > 0) { + while (!edge_list.empty()) { BRepBuilderAPI_MakeWire mkWire; // add and erase first edge mkWire.Add(edge_list.front()); diff --git a/src/Mod/Part/App/FeatureExtrusion.cpp b/src/Mod/Part/App/FeatureExtrusion.cpp index c516e5c509..ed7549b13c 100644 --- a/src/Mod/Part/App/FeatureExtrusion.cpp +++ b/src/Mod/Part/App/FeatureExtrusion.cpp @@ -97,7 +97,7 @@ bool Extrusion::fetchAxisLink(const App::PropertyLinkSub& axisLink, Base::Vector auto linked = axisLink.getValue(); TopoDS_Shape axEdge; - if (axisLink.getSubValues().size() > 0 && axisLink.getSubValues()[0].length() > 0) { + if (!axisLink.getSubValues().empty() && axisLink.getSubValues()[0].length() > 0) { axEdge = Feature::getTopoShape(linked, axisLink.getSubValues()[0].c_str(), true /*need element*/).getShape(); } else { diff --git a/src/Mod/Part/App/FeatureRevolution.cpp b/src/Mod/Part/App/FeatureRevolution.cpp index 5b887169b6..cbd552cb35 100644 --- a/src/Mod/Part/App/FeatureRevolution.cpp +++ b/src/Mod/Part/App/FeatureRevolution.cpp @@ -89,7 +89,7 @@ bool Revolution::fetchAxisLink(const App::PropertyLinkSub &axisLink, auto linked = axisLink.getValue(); TopoDS_Shape axEdge; - if (axisLink.getSubValues().size() > 0 && axisLink.getSubValues()[0].length() > 0){ + if (!axisLink.getSubValues().empty() && axisLink.getSubValues()[0].length() > 0){ axEdge = Feature::getTopoShape(linked, axisLink.getSubValues()[0].c_str(), true /*need element*/).getShape(); } else { axEdge = Feature::getShape(linked); diff --git a/src/Mod/Part/App/Geometry.cpp b/src/Mod/Part/App/Geometry.cpp index 63524e2c43..266a97ce22 100644 --- a/src/Mod/Part/App/Geometry.cpp +++ b/src/Mod/Part/App/Geometry.cpp @@ -757,14 +757,14 @@ bool GeomCurve::intersect(const Handle(Geom_Curve) curve1, const Handle(Geom_Cur } catch (Standard_Failure& e) { // Yes Extrema finding failed, but if we got an intersection then go on with it - if(points.size()>0) - return points.size()>0?true:false; + if(!points.empty()) + return !points.empty()?true:false; else THROWM(Base::CADKernelError,e.GetMessageString()) } - return points.size()>0?true:false; + return !points.empty()?true:false; } bool GeomCurve::closestParameter(const Base::Vector3d& point, double &u) const diff --git a/src/Mod/Part/App/GeometryBoolExtensionPyImp.cpp b/src/Mod/Part/App/GeometryBoolExtensionPyImp.cpp index 4bd64c3b9e..67f09e988e 100644 --- a/src/Mod/Part/App/GeometryBoolExtensionPyImp.cpp +++ b/src/Mod/Part/App/GeometryBoolExtensionPyImp.cpp @@ -35,7 +35,7 @@ std::string GeometryBoolExtensionPy::representation(void) const bool val = getGeometryBoolExtensionPtr()->getValue(); str << "getName().size()>0) + if(!getGeometryBoolExtensionPtr()->getName().empty()) str << "\'" << getGeometryBoolExtensionPtr()->getName() << "\', "; str << (val?"True":"False") << ") >"; diff --git a/src/Mod/Part/App/GeometryDoubleExtensionPyImp.cpp b/src/Mod/Part/App/GeometryDoubleExtensionPyImp.cpp index 0d1a0e23e4..c93d472500 100644 --- a/src/Mod/Part/App/GeometryDoubleExtensionPyImp.cpp +++ b/src/Mod/Part/App/GeometryDoubleExtensionPyImp.cpp @@ -37,7 +37,7 @@ std::string GeometryDoubleExtensionPy::representation(void) const double val = getGeometryDoubleExtensionPtr()->getValue(); str << "getName().size()>0) + if(!getGeometryDoubleExtensionPtr()->getName().empty()) str << "\'" << getGeometryDoubleExtensionPtr()->getName() << "\', "; str << val << ") >"; diff --git a/src/Mod/Part/App/GeometryExtension.cpp b/src/Mod/Part/App/GeometryExtension.cpp index 96c0c8f119..d6cd885324 100644 --- a/src/Mod/Part/App/GeometryExtension.cpp +++ b/src/Mod/Part/App/GeometryExtension.cpp @@ -62,7 +62,7 @@ void GeometryPersistenceExtension::saveAttributes(Base::Writer &writer) const { const std::string name = getName(); - if(name.size() > 0) + if(!name.empty()) writer.Stream() << "\" name=\"" << name; } diff --git a/src/Mod/Part/App/GeometryIntExtensionPyImp.cpp b/src/Mod/Part/App/GeometryIntExtensionPyImp.cpp index d16d44a618..bd3c91b397 100644 --- a/src/Mod/Part/App/GeometryIntExtensionPyImp.cpp +++ b/src/Mod/Part/App/GeometryIntExtensionPyImp.cpp @@ -35,7 +35,7 @@ std::string GeometryIntExtensionPy::representation(void) const long val = getGeometryIntExtensionPtr()->getValue(); str << "getName().size()>0) + if(!getGeometryIntExtensionPtr()->getName().empty()) str << "\'" << getGeometryIntExtensionPtr()->getName() << "\', "; str << val << ") >"; diff --git a/src/Mod/Part/App/GeometryStringExtensionPyImp.cpp b/src/Mod/Part/App/GeometryStringExtensionPyImp.cpp index 294f3a9ce1..8e34ea05da 100644 --- a/src/Mod/Part/App/GeometryStringExtensionPyImp.cpp +++ b/src/Mod/Part/App/GeometryStringExtensionPyImp.cpp @@ -38,7 +38,7 @@ std::string GeometryStringExtensionPy::representation(void) const std::stringstream str; str << "getName().size()>0) + if(!getGeometryStringExtensionPtr()->getName().empty()) str << "\'" << getGeometryStringExtensionPtr()->getName() << "\', "; str << getGeometryStringExtensionPtr()->getValue() << ") >"; diff --git a/src/Mod/Part/App/Part2DObject.cpp b/src/Mod/Part/App/Part2DObject.cpp index 32f83bfac8..43faeffb3f 100644 --- a/src/Mod/Part/App/Part2DObject.cpp +++ b/src/Mod/Part/App/Part2DObject.cpp @@ -75,7 +75,7 @@ App::DocumentObjectExecReturn *Part2DObject::execute(void) void Part2DObject::transformPlacement(const Base::Placement &transform) { - if (Support.getValues().size() > 0) { + if (!Support.getValues().empty()) { //part->transformPlacement(transform); positionBySupport(); } else { diff --git a/src/Mod/Part/App/PartFeature.cpp b/src/Mod/Part/App/PartFeature.cpp index daf29ae5d0..f469ca6867 100644 --- a/src/Mod/Part/App/PartFeature.cpp +++ b/src/Mod/Part/App/PartFeature.cpp @@ -423,7 +423,7 @@ static TopoShape _getTopoShape(const App::DocumentObject *obj, const char *subna subObj = owner->resolve(sub.c_str(), &parent, &childName,nullptr,nullptr,&mat,false); if(!parent || !subObj) continue; - if(linkStack.size() + if(!linkStack.empty() && parent->getExtensionByType(true,false)) { visible = linkStack.back()->isElementVisible(childName.c_str()); @@ -450,7 +450,7 @@ static TopoShape _getTopoShape(const App::DocumentObject *obj, const char *subna shapes.push_back(shape); } - if(linkStack.size() && linkStack.back()==owner) + if(!linkStack.empty() && linkStack.back()==owner) linkStack.pop_back(); if(shapes.empty()) diff --git a/src/Mod/Part/App/TopoShape.cpp b/src/Mod/Part/App/TopoShape.cpp index 1a3c173664..949a45115d 100644 --- a/src/Mod/Part/App/TopoShape.cpp +++ b/src/Mod/Part/App/TopoShape.cpp @@ -469,7 +469,7 @@ TopAbs_ShapeEnum TopoShape::shapeType(const char *type, bool silent) { if(type) { initShapeNameMap(); for(size_t idx=0;idx<_ShapeNames.size();++idx) { - if(_ShapeNames[idx].size() && boost::starts_with(type,_ShapeNames[idx])) + if(!_ShapeNames[idx].empty() && boost::starts_with(type,_ShapeNames[idx])) return (TopAbs_ShapeEnum)idx; } } @@ -507,7 +507,7 @@ TopAbs_ShapeEnum TopoShape::shapeType(bool silent) const { const std::string &TopoShape::shapeName(TopAbs_ShapeEnum type, bool silent) { initShapeNameMap(); - if(type>=0 && type<_ShapeNames.size() && _ShapeNames[type].size()) + if(type>=0 && type<_ShapeNames.size() && !_ShapeNames[type].empty()) return _ShapeNames[type]; if(!silent) FC_THROWM(Base::CADKernelError, "invalid shape type '" << type << "'"); @@ -2800,7 +2800,7 @@ TopoDS_Shape TopoShape::makeOffset2D(double offset, short joinType, bool fill, b shapesToProcess.push_back(this->_Shape); } - if(shapesToProcess.size() > 0) { + if(!shapesToProcess.empty()) { //although 2d offset supports offsetting a face directly, it seems there is //no way to do a collective offset of multiple faces. So, we are doing it @@ -2952,7 +2952,7 @@ TopoDS_Shape TopoShape::makeOffset2D(double offset, short joinType, bool fill, b openWires.push_back(w); wiresForMakingFaces = closedWires; - if (!allowOpenResult || openWires.size() == 0){ + if (!allowOpenResult || openWires.empty()){ //just ignore all open wires } else { @@ -3027,7 +3027,7 @@ TopoDS_Shape TopoShape::makeOffset2D(double offset, short joinType, bool fill, b } //make faces - if (wiresForMakingFaces.size()>0){ + if (!wiresForMakingFaces.empty()){ FaceMakerBullseye mkFace; mkFace.setPlane(workingPlane); for(TopoDS_Wire &w : wiresForMakingFaces){ @@ -4016,7 +4016,7 @@ TopoShape &TopoShape::makeWires(const TopoShape &shape, const char *op, bool fix wires.reserve(edge_list.size()); // sort them together to wires - while (edge_list.size() > 0) { + while (!edge_list.empty()) { BRepBuilderAPI_MakeWire mkWire; // add and erase first edge edges.push_back(edge_list.front()); diff --git a/src/Mod/Part/App/modelRefine.cpp b/src/Mod/Part/App/modelRefine.cpp index 3ae916200e..f941e61273 100644 --- a/src/Mod/Part/App/modelRefine.cpp +++ b/src/Mod/Part/App/modelRefine.cpp @@ -622,7 +622,7 @@ TopoDS_Face FaceTypedCylinder::buildFace(const FaceVectorType &faces) const static TopoDS_Face dummy; std::vector boundaries; boundarySplit(faces, boundaries); - if (boundaries.size() < 1) + if (boundaries.empty()) return dummy; //make wires @@ -638,7 +638,7 @@ TopoDS_Face FaceTypedCylinder::buildFace(const FaceVectorType &faces) const return dummy; allWires.push_back(wireMaker.Wire()); } - if (allWires.size() < 1) + if (allWires.empty()) return dummy; // Sort wires by size, that is, the innermost wire comes last @@ -1089,7 +1089,7 @@ bool FaceUniter::process() } } } - if (facesToSew.size() > 0) + if (!facesToSew.empty()) { modifiedSignal = true; workShell = ModelRefine::removeFaces(workShell, facesToRemove); diff --git a/src/Mod/Part/Gui/Command.cpp b/src/Mod/Part/Gui/Command.cpp index 423780bcdb..d0f9fb93cc 100644 --- a/src/Mod/Part/Gui/Command.cpp +++ b/src/Mod/Part/Gui/Command.cpp @@ -2093,7 +2093,7 @@ void CmdPartRuledSurface::activated(int iMsg) } if (ok && selobjs.size() <= 2) { - if (selobjs.size() >= 1) { + if (!selobjs.empty()) { const std::vector& subnames1= selobjs[0].getSubNames(); docobj1 = selobjs[0].getObject(); obj1 = docobj1->getNameInDocument(); @@ -2103,7 +2103,7 @@ void CmdPartRuledSurface::activated(int iMsg) ok = false; } if (ok && subnames1.size() <= 2) { - if (subnames1.size() >= 1) { + if (!subnames1.empty()) { curve1 = Part::Feature::getTopoShape(docobj1, subnames1[0].c_str(), true /*need element*/).getShape(); link1 = subnames1[0]; } @@ -2111,7 +2111,7 @@ void CmdPartRuledSurface::activated(int iMsg) curve2 = Part::Feature::getTopoShape(docobj1, subnames1[1].c_str(), true /*need element*/).getShape(); link2 = subnames1[1]; } - if (subnames1.size() == 0) { + if (subnames1.empty()) { curve1 = shape1.getShape(); } } else { @@ -2131,7 +2131,7 @@ void CmdPartRuledSurface::activated(int iMsg) curve2 = Part::Feature::getTopoShape(docobj2, subnames2[0].c_str(), true /*need element*/).getShape(); link2 = subnames2[0]; } else { - if (subnames2.size() == 0) { + if (subnames2.empty()) { curve2 = shape2.getShape(); } } diff --git a/src/Mod/Part/Gui/DlgExtrusion.cpp b/src/Mod/Part/Gui/DlgExtrusion.cpp index 47cd8c1130..6f00057502 100644 --- a/src/Mod/Part/Gui/DlgExtrusion.cpp +++ b/src/Mod/Part/Gui/DlgExtrusion.cpp @@ -276,7 +276,7 @@ void DlgExtrusion::onSelectionChanged(const Gui::SelectionChanges& msg) App::DocumentObject& DlgExtrusion::getShapeToExtrude() const { std::vector objs = this->getShapesToExtrude(); - if (objs.size() == 0) + if (objs.empty()) throw Base::ValueError("No shapes selected"); return *(objs[0]); } diff --git a/src/Mod/Part/Gui/DlgProjectionOnSurface.cpp b/src/Mod/Part/Gui/DlgProjectionOnSurface.cpp index 199ba741df..a6cdd36564 100644 --- a/src/Mod/Part/Gui/DlgProjectionOnSurface.cpp +++ b/src/Mod/Part/Gui/DlgProjectionOnSurface.cpp @@ -322,7 +322,7 @@ void PartGui::DlgProjectionOnSurface::onSelectionChanged(const Gui::SelectionCha { m_projectionSurfaceVec.clear(); store_current_selected_parts(m_projectionSurfaceVec, 0xffff0000); - if (m_projectionSurfaceVec.size()) + if (!m_projectionSurfaceVec.empty()) { PartGui::ViewProviderPartExt* vp = dynamic_cast(Gui::Application::Instance->getViewProvider(m_projectionSurfaceVec.back().partFeature)); if (vp) @@ -363,7 +363,7 @@ void PartGui::DlgProjectionOnSurface::store_current_selected_parts(std::vector selObj = Gui::Selection().getSelectionEx(); - if (selObj.size()) + if (!selObj.empty()) { for (auto it = selObj.begin(); it != selObj.end(); ++it) { @@ -383,7 +383,7 @@ void PartGui::DlgProjectionOnSurface::store_current_selected_parts(std::vectorSelectable.getValue(); currentShapeStore.transparency = vp->Transparency.getValue(); } - if (it->getSubNames().size() ) + if (!it->getSubNames().empty() ) { auto parentShape = currentShapeStore.inputShape; for (auto itName = selObj.front().getSubNames().begin(); itName != selObj.front().getSubNames().end(); ++itName) @@ -451,7 +451,7 @@ bool PartGui::DlgProjectionOnSurface::store_part_in_vector(SShapeStore& iCurrent auto valZ = ui->doubleSpinBoxDirZ->value(); iCurrentShape.aProjectionDir = gp_Dir(valX, valY, valZ); - if ( m_projectionSurfaceVec.size() ) + if ( !m_projectionSurfaceVec.empty() ) { iCurrentShape.surfaceToProject = m_projectionSurfaceVec.front().aFace; } @@ -468,9 +468,9 @@ void PartGui::DlgProjectionOnSurface::create_projection_wire(std::vector objs = this->getShapesToRevolve(); - if (objs.size() == 0) + if (objs.empty()) throw Base::ValueError("No shapes selected"); return *(objs[0]); } diff --git a/src/Mod/Part/Gui/SoBrepEdgeSet.cpp b/src/Mod/Part/Gui/SoBrepEdgeSet.cpp index 61ff3369ae..e9e65d2c7b 100644 --- a/src/Mod/Part/Gui/SoBrepEdgeSet.cpp +++ b/src/Mod/Part/Gui/SoBrepEdgeSet.cpp @@ -129,7 +129,7 @@ void SoBrepEdgeSet::GLRender(SoGLRenderAction *action) if(!action->isRenderingDelayedPaths()) renderHighlight(action,ctx); - if(ctx && ctx->selectionIndex.size()) { + if(ctx && !ctx->selectionIndex.empty()) { if(ctx->isSelectAll()) { if(ctx2) { ctx2->selectionColor = ctx->selectionColor; @@ -143,7 +143,7 @@ void SoBrepEdgeSet::GLRender(SoGLRenderAction *action) if(!action->isRenderingDelayedPaths()) renderSelection(action,ctx); } - if(ctx2 && ctx2->selectionIndex.size()) + if(ctx2 && !ctx2->selectionIndex.empty()) renderSelection(action,ctx2,false); else inherited::GLRender(action); @@ -152,7 +152,7 @@ void SoBrepEdgeSet::GLRender(SoGLRenderAction *action) //#if !defined(FC_OS_WIN32) if(!action->isRenderingDelayedPaths()) renderHighlight(action,ctx); - if(ctx && ctx->selectionIndex.size()) + if(ctx && !ctx->selectionIndex.empty()) renderSelection(action,ctx); if(action->isRenderingDelayedPaths()) renderHighlight(action,ctx); @@ -373,7 +373,7 @@ void SoBrepEdgeSet::doAction(SoAction* action) }else if(section == index) ctx->hl.push_back(cindices[i]); } - if(ctx->hl.size()) + if(!ctx->hl.empty()) ctx->highlightIndex = index; else ctx->highlightIndex = -1; @@ -440,7 +440,7 @@ void SoBrepEdgeSet::doAction(SoAction* action) return; } ctx->sl.clear(); - if(ctx->selectionIndex.size()) { + if(!ctx->selectionIndex.empty()) { const int32_t* cindices = this->coordIndex.getValues(0); int numcindices = this->coordIndex.getNum(); auto it = ctx->selectionIndex.begin(); diff --git a/src/Mod/Part/Gui/SoBrepFaceSet.cpp b/src/Mod/Part/Gui/SoBrepFaceSet.cpp index 006486727b..5ebb702337 100644 --- a/src/Mod/Part/Gui/SoBrepFaceSet.cpp +++ b/src/Mod/Part/Gui/SoBrepFaceSet.cpp @@ -536,7 +536,7 @@ void SoBrepFaceSet::GLRender(SoGLRenderAction *action) return; if(selContext2->checkGlobal(ctx)) ctx = selContext2; - if(ctx && (!ctx->selectionIndex.size() && ctx->highlightIndex<0)) + if(ctx && (ctx->selectionIndex.empty() && ctx->highlightIndex<0)) ctx.reset(); auto state = action->getState(); @@ -592,7 +592,7 @@ void SoBrepFaceSet::GLRender(SoGLRenderAction *action) if(!action->isRenderingDelayedPaths()) renderHighlight(action,ctx); - if(ctx && ctx->selectionIndex.size()) { + if(ctx && !ctx->selectionIndex.empty()) { if(ctx->isSelectAll()) { if(ctx2) { ctx2->selectionColor = ctx->selectionColor; @@ -735,7 +735,7 @@ bool SoBrepFaceSet::overrideMaterialBinding(SoGLRenderAction *action, SelContext && ((ctx && Gui::Selection().needPickedList()) || trans0!=0.0 || - (ctx2 && ctx2->colors.size()))) + (ctx2 && !ctx2->colors.empty()))) { state->push(); @@ -857,7 +857,7 @@ bool SoBrepFaceSet::overrideMaterialBinding(SoGLRenderAction *action, SelContext } } - if(ctx && ctx->selectionIndex.size()) { + if(ctx && !ctx->selectionIndex.empty()) { packedColors.push_back(ctx->selectionColor.getPackedValue(trans0)); for(auto idx : ctx->selectionIndex) { if(idx>=0 && idxisRenderingDelayedPaths()) renderHighlight(action,ctx); - if(ctx && ctx->selectionIndex.size()) { + if(ctx && !ctx->selectionIndex.empty()) { if(ctx->isSelectAll()) { - if(ctx2 && ctx2->selectionIndex.size()) { + if(ctx2 && !ctx2->selectionIndex.empty()) { ctx2->selectionColor = ctx->selectionColor; renderSelection(action,ctx2); }else @@ -133,7 +133,7 @@ void SoBrepPointSet::GLRender(SoGLRenderAction *action) if(!action->isRenderingDelayedPaths()) renderSelection(action,ctx); } - if(ctx2 && ctx2->selectionIndex.size()) + if(ctx2 && !ctx2->selectionIndex.empty()) renderSelection(action,ctx2,false); else inherited::GLRender(action); @@ -142,7 +142,7 @@ void SoBrepPointSet::GLRender(SoGLRenderAction *action) //#if !defined(FC_OS_WIN32) if(!action->isRenderingDelayedPaths()) renderHighlight(action,ctx); - if(ctx && ctx->selectionIndex.size()) + if(ctx && !ctx->selectionIndex.empty()) renderSelection(action,ctx); if(action->isRenderingDelayedPaths()) renderHighlight(action,ctx); diff --git a/src/Mod/Part/Gui/TaskAttacher.cpp b/src/Mod/Part/Gui/TaskAttacher.cpp index 37898e15e7..27bbc6066f 100644 --- a/src/Mod/Part/Gui/TaskAttacher.cpp +++ b/src/Mod/Part/Gui/TaskAttacher.cpp @@ -289,7 +289,7 @@ void TaskAttacher::updateReferencesUI() pcAttach->attacher().suggestMapModes(this->lastSuggestResult); if (this->lastSuggestResult.message != SuggestResult::srOK) { - if(this->lastSuggestResult.nextRefTypeHint.size() > 0){ + if(!this->lastSuggestResult.nextRefTypeHint.empty()){ //message = "Need more references"; } } else { @@ -429,7 +429,7 @@ void TaskAttacher::onSelectionChanged(const Gui::SelectionChanges& msg) if (autoNext) { if (iActiveRef == -1){ //nothing to do - } else if (iActiveRef == 4 || this->lastSuggestResult.nextRefTypeHint.size() == 0){ + } else if (iActiveRef == 4 || this->lastSuggestResult.nextRefTypeHint.empty()){ iActiveRef = -1; } else { iActiveRef++; @@ -692,7 +692,7 @@ void TaskAttacher::updateRefButton(int idx) bool enable = true; if (idx > numrefs) enable = false; - if (idx == numrefs && this->lastSuggestResult.nextRefTypeHint.size() == 0) + if (idx == numrefs && this->lastSuggestResult.nextRefTypeHint.empty()) enable = false; b->setEnabled(enable); @@ -806,7 +806,7 @@ void TaskAttacher::updateListOfModes() ui->listOfModes->blockSignals(true); ui->listOfModes->clear(); QListWidgetItem* iSelect = nullptr; - if (modesInList.size()>0) { + if (!modesInList.empty()) { for (size_t i = 0 ; i < modesInList.size() ; ++i){ eMapMode mmode = modesInList[i]; std::vector mstr = AttacherGui::getUIStrings(pcAttach->attacher().getTypeId(),mmode); @@ -999,7 +999,7 @@ void TaskAttacher::visibilityAutomation(bool opening_not_closing) App::DocumentObject *editObj = ViewProvider->getObject(); std::string editSubName; auto sels = Gui::Selection().getSelection(nullptr, Gui::ResolveMode::NoResolve, true); - if(sels.size() && sels[0].pResolvedObject + if(!sels.empty() && sels[0].pResolvedObject && sels[0].pResolvedObject->getLinkedObject()==editObj) { editObj = sels[0].pObject; diff --git a/src/Mod/Part/Gui/TaskDimension.cpp b/src/Mod/Part/Gui/TaskDimension.cpp index c50727d6bf..e73df5fb99 100644 --- a/src/Mod/Part/Gui/TaskDimension.cpp +++ b/src/Mod/Part/Gui/TaskDimension.cpp @@ -674,7 +674,7 @@ void PartGui::TaskMeasureLinear::selection1Slot(bool checked) { if (!checked) { - if (selections1.selections.size() > 0) + if (!selections1.selections.empty()) stepped->setIconDone(0); return; } @@ -1820,7 +1820,7 @@ void PartGui::TaskMeasureAngular::selection1Slot(bool checked) } else { - if (selections1.selections.size() > 0) + if (!selections1.selections.empty()) stepped->setIconDone(0); } } diff --git a/src/Mod/PartDesign/App/FeatureChamfer.cpp b/src/Mod/PartDesign/App/FeatureChamfer.cpp index 9b3e4c02c2..9749af28e8 100644 --- a/src/Mod/PartDesign/App/FeatureChamfer.cpp +++ b/src/Mod/PartDesign/App/FeatureChamfer.cpp @@ -130,7 +130,7 @@ App::DocumentObjectExecReturn *Chamfer::execute(void) getContinuousEdges(TopShape, SubNames, FaceNames); - if (SubNames.size() == 0) + if (SubNames.empty()) return new App::DocumentObjectExecReturn("No edges specified"); const int chamferType = ChamferType.getValue(); diff --git a/src/Mod/PartDesign/App/FeatureDraft.cpp b/src/Mod/PartDesign/App/FeatureDraft.cpp index 79d1a34471..e8c5e66ac4 100644 --- a/src/Mod/PartDesign/App/FeatureDraft.cpp +++ b/src/Mod/PartDesign/App/FeatureDraft.cpp @@ -109,7 +109,7 @@ App::DocumentObjectExecReturn *Draft::execute(void) // Faces where draft should be applied // Note: Cannot be const reference currently because of BRepOffsetAPI_DraftAngle::Remove() bug, see below std::vector SubVals = Base.getSubValuesStartsWith("Face"); - if (SubVals.size() == 0) + if (SubVals.empty()) return new App::DocumentObjectExecReturn("No faces specified"); // Draft angle diff --git a/src/Mod/PartDesign/App/FeatureFillet.cpp b/src/Mod/PartDesign/App/FeatureFillet.cpp index 8187242f76..5a0d6b1f5f 100644 --- a/src/Mod/PartDesign/App/FeatureFillet.cpp +++ b/src/Mod/PartDesign/App/FeatureFillet.cpp @@ -86,7 +86,7 @@ App::DocumentObjectExecReturn *Fillet::execute(void) getContinuousEdges(TopShape, SubNames); - if (SubNames.size() == 0) + if (SubNames.empty()) return new App::DocumentObjectExecReturn("Fillet not possible on selected shapes"); double radius = Radius.getValue(); diff --git a/src/Mod/PartDesign/App/FeatureMirrored.cpp b/src/Mod/PartDesign/App/FeatureMirrored.cpp index 63e489ef6f..0379b1d36c 100644 --- a/src/Mod/PartDesign/App/FeatureMirrored.cpp +++ b/src/Mod/PartDesign/App/FeatureMirrored.cpp @@ -75,7 +75,7 @@ const std::list Mirrored::getTransformations(const std::vectorgetAxis(Part::Part2DObject::V_Axis); else if (subStrings[0] == "V_Axis") axis = refSketch->getAxis(Part::Part2DObject::H_Axis); - else if (subStrings[0] == "") + else if (subStrings[0].empty()) axis = refSketch->getAxis(Part::Part2DObject::N_Axis); else if (subStrings[0].compare(0, 4, "Axis") == 0) { int AxId = std::atoi(subStrings[0].substr(4,4000).c_str()); diff --git a/src/Mod/PartDesign/App/FeatureSketchBased.cpp b/src/Mod/PartDesign/App/FeatureSketchBased.cpp index 17eb6e23ac..07a7bbd977 100644 --- a/src/Mod/PartDesign/App/FeatureSketchBased.cpp +++ b/src/Mod/PartDesign/App/FeatureSketchBased.cpp @@ -317,7 +317,7 @@ TopoDS_Face ProfileBased::getSupportFace(const Part::Part2DObject* sketch) const const std::vector& sub = Support.getSubValues(); assert(sub.size() == 1); - if (sub.at(0) == "") { + if (sub.at(0).empty()) { // This seems to happen when sketch is on a datum plane return TopoDS::Face(Feature::makeShapeFromPlane(sketch)); } @@ -1150,7 +1150,7 @@ void ProfileBased::handleChangedPropertyName(Base::XMLReader & reader, const cha // get the value of my attribute std::string name = reader.getAttribute("value"); - if (name != "") { + if (!name.empty()) { App::Document* document = getDocument(); DocumentObject* object = document ? document->getObject(name.c_str()) : nullptr; Profile.setValue(object, vec); diff --git a/src/Mod/PartDesign/App/ShapeBinder.cpp b/src/Mod/PartDesign/App/ShapeBinder.cpp index 1d56728e6b..ca9f09274a 100644 --- a/src/Mod/PartDesign/App/ShapeBinder.cpp +++ b/src/Mod/PartDesign/App/ShapeBinder.cpp @@ -449,7 +449,7 @@ void SubShapeBinder::setupCopyOnChange() { if (!prop.testStatus(App::Property::Output) && !prop.testStatus(App::Property::PropOutput)) { - if (this->_CopiedObjs.size()) { + if (!this->_CopiedObjs.empty()) { FC_LOG("Clear binder " << getFullName() << " cache on change of " << prop.getFullName()); this->clearCopiedObjects(); @@ -560,7 +560,7 @@ void SubShapeBinder::update(SubShapeBinder::UpdateOption options) { App::DocumentObject* copied = nullptr; if (BindCopyOnChange.getValue() == 2 && Support.getSubListValues().size() == 1) { - if (_CopiedObjs.size()) + if (!_CopiedObjs.empty()) copied = _CopiedObjs.front().getObject(); bool recomputeCopy = false; diff --git a/src/Mod/PartDesign/Gui/Command.cpp b/src/Mod/PartDesign/Gui/Command.cpp index ad71fd00aa..a34517d787 100644 --- a/src/Mod/PartDesign/Gui/Command.cpp +++ b/src/Mod/PartDesign/Gui/Command.cpp @@ -939,7 +939,7 @@ unsigned validateSketches(std::vector& sketches, else ++o; } - if (inList.size() > 0) { + if (!inList.empty()) { status.push_back(PartDesignGui::TaskFeaturePick::isUsed); continue; } @@ -1886,7 +1886,7 @@ bool dressupGetSelected(Gui::Command* cmd, const std::string& which, std::vector selection = cmd->getSelection().getSelectionEx(); - if (selection.size() == 0) { + if (selection.empty()) { QMessageBox::warning(Gui::getMainWindow(), QObject::tr("Wrong selection"), QObject::tr("Select an edge, face, or body.")); return false; @@ -1924,7 +1924,7 @@ bool dressupGetSelected(Gui::Command* cmd, const std::string& which, // if 1 Part::Feature object selected, but no subobjects, select all edges for the user // but only for fillet and chamfer (not for draft or thickness) - if (selection[0].getSubNames().size() == 0 && (which.compare("Fillet") == 0 || which.compare("Chamfer") == 0)){ + if (selection[0].getSubNames().empty() && (which.compare("Fillet") == 0 || which.compare("Chamfer") == 0)){ useAllEdges = true; std::string edgeTypeName = Part::TopoShape::shapeName(TopAbs_EDGE); //"Edge" int count = TopShape.countSubElements(edgeTypeName.c_str()); @@ -1946,7 +1946,7 @@ bool dressupGetSelected(Gui::Command* cmd, const std::string& which, void finishDressupFeature(const Gui::Command* cmd, const std::string& which, Part::Feature *base, const std::vector & SubNames, const bool useAllEdges) { - if (SubNames.size() == 0) { + if (SubNames.empty()) { QMessageBox::warning(Gui::getMainWindow(), QObject::tr("Wrong selection"), QString::fromStdString(which) + QObject::tr(" not possible on selected faces/edges.")); return; @@ -2210,7 +2210,7 @@ void prepareTransformed(PartDesign::Body *pcActiveBody, Gui::Command* cmd, const // First check selections std::vector features = cmd->getSelection().getObjectsOfType(PartDesign::Feature::getClassTypeId()); // Next create a list of all eligible objects - if (features.size() == 0) { + if (features.empty()) { features = cmd->getDocument()->getObjectsOfType(PartDesign::Feature::getClassTypeId()); // If there is more than one selected or eligible object, show dialog and let user pick one if (features.size() > 1) { diff --git a/src/Mod/PartDesign/Gui/ReferenceSelection.cpp b/src/Mod/PartDesign/Gui/ReferenceSelection.cpp index 0e17063653..4dbdc84d03 100644 --- a/src/Mod/PartDesign/Gui/ReferenceSelection.cpp +++ b/src/Mod/PartDesign/Gui/ReferenceSelection.cpp @@ -345,7 +345,7 @@ QString getRefStr(const App::DocumentObject* obj, const std::vector if (PartDesign::Feature::isDatum(obj)) return QString::fromLatin1(obj->getNameInDocument()); - else if (sub.size()>0) + else if (!sub.empty()) return QString::fromLatin1(obj->getNameInDocument()) + QString::fromLatin1(":") + QString::fromLatin1(sub.front().c_str()); else diff --git a/src/Mod/PartDesign/Gui/TaskBooleanParameters.cpp b/src/Mod/PartDesign/Gui/TaskBooleanParameters.cpp index 7aa0e2112b..3d2dbc050c 100644 --- a/src/Mod/PartDesign/Gui/TaskBooleanParameters.cpp +++ b/src/Mod/PartDesign/Gui/TaskBooleanParameters.cpp @@ -181,7 +181,7 @@ void TaskBooleanParameters::onSelectionChanged(const Gui::SelectionChanges& msg) Gui::Application::Instance->getViewProvider(pcBody)); if (vp) vp->show(); - if (bodies.size() == 0) { + if (bodies.empty()) { Gui::ViewProviderDocumentObject* vp = dynamic_cast( Gui::Application::Instance->getViewProvider(pcBoolean->BaseFeature.getValue())); if (vp) diff --git a/src/Mod/PartDesign/Gui/TaskMultiTransformParameters.cpp b/src/Mod/PartDesign/Gui/TaskMultiTransformParameters.cpp index 07f40345da..563d2b9e26 100644 --- a/src/Mod/PartDesign/Gui/TaskMultiTransformParameters.cpp +++ b/src/Mod/PartDesign/Gui/TaskMultiTransformParameters.cpp @@ -134,7 +134,7 @@ TaskMultiTransformParameters::TaskMultiTransformParameters(ViewProviderTransform if (*i) ui->listTransformFeatures->addItem(QString::fromUtf8((*i)->Label.getValue())); } - if (transformFeatures.size() > 0) { + if (!transformFeatures.empty()) { ui->listTransformFeatures->setCurrentRow(0, QItemSelectionModel::ClearAndSelect); editHint = false; } else { diff --git a/src/Mod/PartDesign/Gui/ViewProviderShapeBinder.cpp b/src/Mod/PartDesign/Gui/ViewProviderShapeBinder.cpp index 02e4f73d37..3cef2ae9c4 100644 --- a/src/Mod/PartDesign/Gui/ViewProviderShapeBinder.cpp +++ b/src/Mod/PartDesign/Gui/ViewProviderShapeBinder.cpp @@ -280,7 +280,7 @@ std::string ViewProviderSubShapeBinder::dropObjectEx(App::DocumentObject* obj, A values[owner ? owner : obj] = elements; else { std::vector subs; - if (elements.size()) { + if (!elements.empty()) { subs.reserve(elements.size()); for (auto& element : elements) subs.push_back(sub + element); @@ -330,7 +330,7 @@ bool ViewProviderSubShapeBinder::setEdit(int ModNum) { if (!obj || !obj->getNameInDocument()) continue; const auto& subs = link.getSubValues(); - if (subs.size()) + if (!subs.empty()) Gui::Selection().addSelections(obj->getDocument()->getName(), obj->getNameInDocument(), subs); else @@ -355,7 +355,7 @@ void ViewProviderSubShapeBinder::updatePlacement(bool transaction) { bool relative = self->Relative.getValue(); App::DocumentObject* parent = nullptr; std::string parentSub; - if (relative && self->getParents().size()) { + if (relative && !self->getParents().empty()) { const auto& sel = Gui::Selection().getSelection("", Gui::ResolveMode::NoResolve); if (sel.size() != 1 || !sel[0].pObject || sel[0].pObject->getSubObject(sel[0].SubName) != self) diff --git a/src/Mod/PartDesign/Gui/Workbench.cpp b/src/Mod/PartDesign/Gui/Workbench.cpp index 5dc1392e94..183fa9d413 100644 --- a/src/Mod/PartDesign/Gui/Workbench.cpp +++ b/src/Mod/PartDesign/Gui/Workbench.cpp @@ -169,7 +169,7 @@ void Workbench::setupContextMenu(const char* recipient, Gui::MenuItem* item) con { auto selection = Gui::Selection().getSelection(); // Add move Tip Command - if ( selection.size () >= 1 ) { + if ( !selection.empty() ) { App::DocumentObject *feature = selection.front().pObject; PartDesign::Body *body = nullptr; @@ -194,7 +194,7 @@ void Workbench::setupContextMenu(const char* recipient, Gui::MenuItem* item) con Gui::MDIView *activeView = Gui::Application::Instance->activeView(); - if ( selection.size () > 0 && activeView ) { + if ( !selection.empty() && activeView ) { bool docHaveBodies = activeView->getAppDocument()->countObjectsOfType ( PartDesign::Body::getClassTypeId () ) > 0; diff --git a/src/Mod/Path/App/Area.cpp b/src/Mod/Path/App/Area.cpp index 1899898099..d9387e32df 100644 --- a/src/Mod/Path/App/Area.cpp +++ b/src/Mod/Path/App/Area.cpp @@ -545,7 +545,7 @@ void Area::addToBuild(CArea& area, const TopoDS_Shape& shape) { } } - if (areaOpen.m_curves.size()) { + if (!areaOpen.m_curves.empty()) { if (&area == myArea.get() || myParams.OpenMode == OpenModeNone) myAreaOpen->m_curves.splice(myAreaOpen->m_curves.end(), areaOpen.m_curves); else @@ -706,7 +706,7 @@ struct WireJoiner { // void join(double tol) { tol = tol * tol; - while (edges.size()) { + while (!edges.empty()) { auto it = edges.begin(); BRepBuilderAPI_MakeWire mkWire; mkWire.Add(it->edge); @@ -715,7 +715,7 @@ struct WireJoiner { bool done = false; for (int idx = 0; !done && idx < 2; ++idx) { - while (edges.size()) { + while (!edges.empty()) { std::vector ret; ret.reserve(1); const gp_Pnt& pt = idx == 0 ? pstart : pend; @@ -918,7 +918,7 @@ struct WireJoiner { std::vector stack; std::vector vertexStack; - for (int iteration = 1; edgesToVisit.size(); ++iteration) { + for (int iteration = 1; !edgesToVisit.empty(); ++iteration) { EdgeInfo* currentInfo = *edgesToVisit.begin(); int currentIdx = 1; // used to tell whether search connection from the start(0) or end(1) TopoDS_Edge& e = currentInfo->edge; @@ -1566,7 +1566,7 @@ std::vector > Area::makeSections( } } } - if (area->myShapes.size()) { + if (!area->myShapes.empty()) { sections.push_back(area); FC_TIME_LOG(t1, "makeSection " << z); showShape(area->getShape(), nullptr, "section_%u_final", i); @@ -1606,7 +1606,7 @@ TopoDS_Shape Area::getPlane(gp_Trsf* trsf) { } bool Area::isBuilt() const { - return (myArea || mySections.size()); + return (myArea || !mySections.empty()); } std::list Area::getProjectedShapes(const gp_Trsf& trsf, bool inverse) const @@ -1675,7 +1675,7 @@ void Area::build() { if (myParams.OpenMode != OpenModeNone) myArea->m_curves.splice(myArea->m_curves.end(), myAreaOpen->m_curves); pending = false; - if (areaClip.m_curves.size()) { + if (!areaClip.m_curves.empty()) { if (op == OperationCompound) myArea->m_curves.splice(myArea->m_curves.end(), areaClip.m_curves); else { @@ -3121,7 +3121,7 @@ std::list Area::sortWires(const std::list& shapes, auto current_it = shape_list.end(); double current_height = (pstart.*getter)(); double max_dist = sort_mode == SortModeGreedy ? threshold * threshold : 0; - while (shape_list.size()) { + while (!shape_list.empty()) { AREA_TRACE("sorting " << shape_list.size() << ' ' << AREA_XYZ(pstart)); double best_d = DBL_MAX; auto best_it = shape_list.begin(); @@ -3314,7 +3314,7 @@ void Area::toPath(Toolpath& path, const std::list& shapes, PARAM_REF(PARAM_FARG, AREA_PARAMS_ARC_PLANE), PARAM_FIELDS(PARAM_FARG, AREA_PARAMS_SORT)); - if (wires.size() == 0) + if (wires.empty()) return; short currentArcPlane = arc_plane; diff --git a/src/Mod/Path/App/Path.cpp b/src/Mod/Path/App/Path.cpp index c47a03e9de..c4a04e8547 100644 --- a/src/Mod/Path/App/Path.cpp +++ b/src/Mod/Path/App/Path.cpp @@ -125,7 +125,7 @@ void Toolpath::deleteCommand(int pos) double Toolpath::getLength() { - if(vpcCommands.size()==0) + if(vpcCommands.empty()) return 0; double l = 0; Vector3d last(0,0,0); @@ -168,7 +168,7 @@ double Toolpath::getCycleTime(double hFeed, double vFeed, double hRapid, double vRapid = vFeed; } - if (vpcCommands.size() == 0) { + if (vpcCommands.empty()) { return 0; } double l = 0; @@ -370,7 +370,7 @@ std::string Toolpath::toGCode(void) const void Toolpath::recalculate(void) // recalculates the path cache { - if(vpcCommands.size()==0) + if(vpcCommands.empty()) return; // TODO recalculate the KDL stuff. At the moment, this is unused. diff --git a/src/Mod/Path/Gui/Command.cpp b/src/Mod/Path/Gui/Command.cpp index b116ce8a2c..8b5baeed13 100644 --- a/src/Mod/Path/Gui/Command.cpp +++ b/src/Mod/Path/Gui/Command.cpp @@ -73,7 +73,7 @@ void CmdPathArea::activated(int iMsg) { const Part::Feature *pcObj = static_cast(selObj.getObject()); const std::vector &subnames = selObj.getSubNames(); - if(addView && areaName.size()) addView = false; + if(addView && !areaName.empty()) addView = false; if(subnames.empty()) { if(addView && pcObj->getTypeId().isDerivedFrom(Path::FeatureArea::getClassTypeId())) @@ -102,7 +102,7 @@ void CmdPathArea::activated(int iMsg) sources << "FreeCAD.activeDocument()." << sub_fname << ","; } } - if(addView && areaName.size()) { + if(addView && !areaName.empty()) { std::string FeatName = getUniqueObjectName("FeatureAreaView"); openCommand(QT_TRANSLATE_NOOP("Command", "Create Path Area View")); doCommand(Doc,"FreeCAD.activeDocument().addObject('Path::FeatureAreaView','%s')",FeatName.c_str()); @@ -162,7 +162,7 @@ void CmdPathAreaWorkplane::activated(int iMsg) const Part::Feature *pcObj = static_cast(selObj.getObject()); if(subnames.empty()) { if(pcObj->getTypeId().isDerivedFrom(Path::FeatureArea::getClassTypeId())) { - if(areaName.size()){ + if(!areaName.empty()){ Base::Console().Error("Please select one FeatureArea only\n"); return; } @@ -174,7 +174,7 @@ void CmdPathAreaWorkplane::activated(int iMsg) return; } } - if(planeName.size()){ + if(!planeName.empty()){ Base::Console().Error("Please select one shape object for plane only\n"); return; }else{ @@ -237,7 +237,7 @@ void CmdPathCompound::activated(int iMsg) { Q_UNUSED(iMsg); std::vector Sel = getSelection().getSelection(); - if (Sel.size() > 0) { + if (!Sel.empty()) { std::ostringstream cmd; cmd << "["; Path::Feature *pcPathObject; diff --git a/src/Mod/Path/Gui/ViewProviderPath.cpp b/src/Mod/Path/Gui/ViewProviderPath.cpp index d616a1cde6..e720b6f6b8 100644 --- a/src/Mod/Path/Gui/ViewProviderPath.cpp +++ b/src/Mod/Path/Gui/ViewProviderPath.cpp @@ -344,7 +344,7 @@ void ViewProviderPath::onChanged(const App::Property* prop) if (prop == &LineWidth) { pcDrawStyle->lineWidth = LineWidth.getValue(); } else if (prop == &NormalColor) { - if (colorindex.size() > 0 && coordStart>=0 && coordStart<(int)colorindex.size()) { + if (!colorindex.empty() && coordStart>=0 && coordStart<(int)colorindex.size()) { const App::Color& c = NormalColor.getValue(); ParameterGrp::handle hGrp = App::GetApplication().GetParameterGroupByPath("User parameter:BaseApp/Preferences/Mod/Path"); unsigned long rcol = hGrp->GetUnsigned("DefaultRapidPathColor",2852126975UL); // dark red (170,0,0) diff --git a/src/Mod/Path/libarea/Adaptive.cpp b/src/Mod/Path/libarea/Adaptive.cpp index 070b9cd3de..5c9f194a19 100644 --- a/src/Mod/Path/libarea/Adaptive.cpp +++ b/src/Mod/Path/libarea/Adaptive.cpp @@ -68,7 +68,7 @@ inline bool HasAnyPath(const Paths &paths) { for (Paths::size_type i = 0; i < paths.size(); i++) { - if (paths[i].size() > 0) + if (!paths[i].empty()) return true; } return false; @@ -251,7 +251,7 @@ int getPathNestingLevel(const Path &path, const Paths &paths) int nesting = 0; for (const auto &other : paths) { - if (path.size() > 0 && PointInPolygon(path.front(), other) != 0) + if (!path.empty() && PointInPolygon(path.front(), other) != 0) nesting++; } return nesting; @@ -262,7 +262,7 @@ void appendDirectChildPaths(Paths &outPaths, const Path &path, const Paths &path int nesting = getPathNestingLevel(path, paths); for (const auto &other : paths) { - if (path.size() > 0 && other.size() > 0 && PointInPolygon(other.front(), path) != 0) + if (!path.empty() && !other.empty() && PointInPolygon(other.front(), path) != 0) { if (getPathNestingLevel(other, paths) == nesting + 1) outPaths.push_back(other); @@ -480,7 +480,7 @@ bool Line2CircleIntersect(const IntPoint &c, double radius, const IntPoint &p1, result.emplace_back(p1.X + t2 * dx, p1.Y + t2 * dy); result.emplace_back(p1.X + t2 * dx, p1.Y + t2 * dy); } - return result.size() > 0; + return !result.empty(); } // calculate center point of polygon @@ -703,7 +703,7 @@ bool PopPathWithClosestPoint(Paths &paths /*closest path is removed from collect IntPoint p1, Path &result) { - if (paths.size() == 0) + if (paths.empty()) return false; double minDistSqrd = __DBL_MAX__; @@ -773,7 +773,7 @@ void DeduplicatePaths(const Paths &inputs, Paths &outputs) } } - if (!duplicate && new_pth.size() > 0) + if (!duplicate && !new_pth.empty()) { outputs.push_back(new_pth); } @@ -785,11 +785,11 @@ void ConnectPaths(Paths input, Paths &output) output.clear(); bool newPath = true; Path joined; - while (input.size() > 0) + while (!input.empty()) { if (newPath) { - if (joined.size() > 0) + if (!joined.empty()) output.push_back(joined); joined.clear(); for (auto pt : input.front()) @@ -841,7 +841,7 @@ void ConnectPaths(Paths input, Paths &output) if (!anyMatch) newPath = true; } - if (joined.size() > 0) + if (!joined.empty()) output.push_back(joined); } @@ -1200,7 +1200,7 @@ class EngagePoint while (PopPathWithClosestPoint(toChain, current, result)) { toolBoundPaths.push_back(result); - if (result.size() > 0) + if (!result.empty()) current = result.back(); } @@ -1916,16 +1916,16 @@ bool Adaptive2d::FindEntryPoint(TPaths &progressPaths, const Paths &toolBoundPat double step = RESOLUTION_FACTOR; double currentDelta = -1; clipof.Execute(incOffset, currentDelta); - while (incOffset.size() > 0) + while (!incOffset.empty()) { clipof.Execute(incOffset, currentDelta); - if (incOffset.size() > 0) + if (!incOffset.empty()) lastValidOffset = incOffset; currentDelta -= step; } for (size_t i = 0; i < lastValidOffset.size(); i++) { - if (lastValidOffset[i].size() > 0) + if (!lastValidOffset[i].empty()) { entryPoint = Compute2DPolygonCentroid(lastValidOffset[i]); found = true; @@ -1960,7 +1960,7 @@ bool Adaptive2d::FindEntryPoint(TPaths &progressPaths, const Paths &toolBoundPat clip.AddPaths(boundPaths, PolyType::ptClip, true); Paths crossing; clip.Execute(ClipType::ctDifference, crossing); - if (crossing.size() > 0) + if (!crossing.empty()) { // helix does not fit to the cutting area found = false; @@ -2345,7 +2345,7 @@ void Adaptive2d::AppendToolPath(TPaths &progressPaths, AdaptiveOutput &output, IntPoint endPoint(passToolPath[0]); // if there is a previous path - need to resolve linking move to new path - if (output.AdaptivePaths.size() > 0 && output.AdaptivePaths.back().second.size() > 1) + if (!output.AdaptivePaths.empty() && output.AdaptivePaths.back().second.size() > 1) { auto &lastTPath = output.AdaptivePaths.back(); @@ -2544,7 +2544,7 @@ void Adaptive2d::AppendToolPath(TPaths &progressPaths, AdaptiveOutput &output, cutPath.second.push_back(nextT); } - if (cutPath.second.size() > 0) + if (!cutPath.second.empty()) output.AdaptivePaths.push_back(cutPath); Perf_AppendToolPath.Stop(); } @@ -2554,20 +2554,20 @@ void Adaptive2d::CheckReportProgress(TPaths &progressPaths, bool force) if (!force && (clock() - lastProgressTime < PROGRESS_TICKS)) return; // not yet lastProgressTime = clock(); - if (progressPaths.size() == 0) + if (progressPaths.empty()) return; if (progressCallback) if ((*progressCallback)(progressPaths)) stopProcessing = true; // call python function, if returns true signal stop processing // clean the paths - keep the last point - if (progressPaths.back().second.size() == 0) + if (progressPaths.back().second.empty()) return; TPath *lastPath = &progressPaths.back(); DPoint *lastPoint = &lastPath->second.back(); DPoint next(lastPoint->first, lastPoint->second); while (progressPaths.size() > 1) progressPaths.pop_back(); - while (progressPaths.front().second.size() > 0) + while (!progressPaths.front().second.empty()) progressPaths.front().second.pop_back(); progressPaths.front().first = MotionType::mtCutting; progressPaths.front().second.push_back(next); @@ -2577,7 +2577,7 @@ void Adaptive2d::AddPathsToProgress(TPaths &progressPaths, Paths paths, MotionTy { for (const auto &pth : paths) { - if (pth.size() > 0) + if (!pth.empty()) { progressPaths.push_back(TPath()); progressPaths.back().first = mt; @@ -2590,7 +2590,7 @@ void Adaptive2d::AddPathsToProgress(TPaths &progressPaths, Paths paths, MotionTy void Adaptive2d::AddPathToProgress(TPaths &progressPaths, const Path pth, MotionType mt) { - if (pth.size() > 0) + if (!pth.empty()) { progressPaths.push_back(TPath()); progressPaths.back().first = mt; @@ -2719,14 +2719,14 @@ void Adaptive2d::ProcessPolyNode(Paths boundPaths, Paths toolBoundPaths) angleHistory.clear(); // append a new path to progress info paths - if (progressPaths.size() == 0) + if (progressPaths.empty()) { progressPaths.push_back(TPath()); } else { // append new path if previous not empty - if (progressPaths.back().second.size() > 0) + if (!progressPaths.back().second.empty()) progressPaths.push_back(TPath()); } @@ -2896,18 +2896,18 @@ void Adaptive2d::ProcessPolyNode(Paths boundPaths, Paths toolBoundPaths) if (area > 0.5 * MIN_CUT_AREA_FACTOR * optimalCutAreaPD * RESOLUTION_FACTOR) { // cut is ok - record it noCutDistance=0; - if (toClearPath.size() == 0) + if (toClearPath.empty()) toClearPath.push_back(toolPos); toClearPath.push_back(newToolPos); cumulativeCutArea += area; // append to toolpaths - if (passToolPath.size() == 0) + if (passToolPath.empty()) { // in outside entry first successful cut defines the "helix center" and start point // in this case helix diameter is 0 (straight line downwards) - if (output.AdaptivePaths.size() == 0 && outsideEntry) + if (output.AdaptivePaths.empty() && outsideEntry) { entryPoint = toolPos; output.HelixCenterPoint.first = double(entryPoint.X) / scaleFactor; @@ -2922,7 +2922,7 @@ void Adaptive2d::ProcessPolyNode(Paths boundPaths, Paths toolBoundPaths) toolPos = newToolPos; // append to progress info paths - if (progressPaths.size() == 0) + if (progressPaths.empty()) progressPaths.push_back(TPath()); progressPaths.back().second.emplace_back(double(newToolPos.X) / scaleFactor, double(newToolPos.Y) / scaleFactor); @@ -2945,7 +2945,7 @@ void Adaptive2d::ProcessPolyNode(Paths boundPaths, Paths toolBoundPaths) } } /* end of points loop*/ - if (toClearPath.size() > 0) + if (!toClearPath.empty()) { cleared.ExpandCleared(toClearPath); toClearPath.clear(); diff --git a/src/Mod/Path/libarea/clipper.cpp b/src/Mod/Path/libarea/clipper.cpp index 89799588ab..0af5d2443e 100644 --- a/src/Mod/Path/libarea/clipper.cpp +++ b/src/Mod/Path/libarea/clipper.cpp @@ -1923,7 +1923,7 @@ void Clipper::InsertLocalMinimaIntoAEL(const cInt botY) //if any output polygons share an edge, they'll need joining later ... if (Op1 && IsHorizontal(*rb) && - m_GhostJoins.size() > 0 && (rb->WindDelta != 0)) + !m_GhostJoins.empty() && (rb->WindDelta != 0)) { for (JoinList::size_type i = 0; i < m_GhostJoins.size(); ++i) { @@ -3798,7 +3798,7 @@ void ClipperOffset::Execute(Paths& solution, double delta) clpr.AddPath(outer, ptSubject, true); clpr.ReverseSolution(true); clpr.Execute(ctUnion, solution, pftNegative, pftNegative); - if (solution.size() > 0) solution.erase(solution.begin()); + if (!solution.empty()) solution.erase(solution.begin()); } } //------------------------------------------------------------------------------ diff --git a/src/Mod/Points/App/PointsGrid.cpp b/src/Mod/Points/App/PointsGrid.cpp index 0f179ce94a..7a5c497c70 100644 --- a/src/Mod/Points/App/PointsGrid.cpp +++ b/src/Mod/Points/App/PointsGrid.cpp @@ -475,7 +475,7 @@ void PointsGrid::SearchNearestFromPoint (const Base::Vector3d &rclPt, std::set &raclInd) const { const std::set &rclSet = _aulGrid[ulX][ulY][ulZ]; - if (rclSet.size() > 0) + if (!rclSet.empty()) { raclInd.insert(rclSet.begin(), rclSet.end()); return rclSet.size(); diff --git a/src/Mod/Raytracing/App/LuxProject.cpp b/src/Mod/Raytracing/App/LuxProject.cpp index 36134d57ea..19dcce0cd7 100644 --- a/src/Mod/Raytracing/App/LuxProject.cpp +++ b/src/Mod/Raytracing/App/LuxProject.cpp @@ -69,7 +69,7 @@ void LuxProject::onDocumentRestored() App::DocumentObjectExecReturn *LuxProject::execute(void) { - if (std::string(PageResult.getValue()) == "") + if (std::string(PageResult.getValue()).empty()) PageResult.setValue(Template.getValue()); Base::FileInfo fi(Template.getValue()); diff --git a/src/Mod/Raytracing/App/RayProject.cpp b/src/Mod/Raytracing/App/RayProject.cpp index 7d26586277..852888649b 100644 --- a/src/Mod/Raytracing/App/RayProject.cpp +++ b/src/Mod/Raytracing/App/RayProject.cpp @@ -69,7 +69,7 @@ void RayProject::onDocumentRestored() App::DocumentObjectExecReturn *RayProject::execute(void) { - if (std::string(PageResult.getValue()) == "") + if (std::string(PageResult.getValue()).empty()) PageResult.setValue(Template.getValue()); Base::FileInfo fi(Template.getValue()); diff --git a/src/Mod/Raytracing/Gui/Command.cpp b/src/Mod/Raytracing/Gui/Command.cpp index 9c4c3a93f1..e2a5e64a0f 100644 --- a/src/Mod/Raytracing/Gui/Command.cpp +++ b/src/Mod/Raytracing/Gui/Command.cpp @@ -614,7 +614,7 @@ void CmdRaytracingRender::activated(int) std::string renderer; if (renderType == Raytracing::RayProject::getClassTypeId()) { renderer = hGrp->GetASCII("PovrayExecutable", ""); - if (renderer == "") { + if (renderer.empty()) { QMessageBox::warning(Gui::getMainWindow(), QObject::tr("POV-Ray not found"), QObject::tr("Please set the path to the POV-Ray executable in the preferences.")); return; @@ -628,7 +628,7 @@ void CmdRaytracingRender::activated(int) } } else { renderer = hGrp->GetASCII("LuxrenderExecutable", ""); - if (renderer == "") { + if (renderer.empty()) { QMessageBox::warning(Gui::getMainWindow(), QObject::tr("Luxrender not found"), QObject::tr("Please set the path to the luxrender or luxconsole executable in the preferences.")); return; diff --git a/src/Mod/Robot/App/Edge2TracObject.cpp b/src/Mod/Robot/App/Edge2TracObject.cpp index 09341c1b25..dec177ec79 100644 --- a/src/Mod/Robot/App/Edge2TracObject.cpp +++ b/src/Mod/Robot/App/Edge2TracObject.cpp @@ -73,7 +73,7 @@ App::DocumentObjectExecReturn *Edge2TracObject::execute(void) const Part::TopoShape& TopShape = base->Shape.getShape(); const std::vector& SubVals = Source.getSubValuesStartsWith("Edge"); - if (SubVals.size() == 0) + if (SubVals.empty()) return new App::DocumentObjectExecReturn("No Edges specified"); // container for all the edges @@ -89,7 +89,7 @@ App::DocumentObjectExecReturn *Edge2TracObject::execute(void) Part::Edgecluster acluster(edges); Part::tEdgeClusterVector aclusteroutput = acluster.GetClusters(); - if(aclusteroutput.size() == 0) + if(aclusteroutput.empty()) return new App::DocumentObjectExecReturn("No Edges specified"); // set the number of cluster and edges diff --git a/src/Mod/Robot/App/Trajectory.cpp b/src/Mod/Robot/App/Trajectory.cpp index 11bc706c76..9a13911daf 100644 --- a/src/Mod/Robot/App/Trajectory.cpp +++ b/src/Mod/Robot/App/Trajectory.cpp @@ -148,7 +148,7 @@ void Trajectory::deleteLast(unsigned int n) void Trajectory::generateTrajectory(void) { - if (vpcWaypoints.size() == 0) + if (vpcWaypoints.empty()) return; // delete the old and create a new one @@ -268,7 +268,7 @@ std::string Trajectory::getUniqueWaypointName(const char *Name) const const std::string &ObjName = (*it)->Name; if (ObjName.substr(0, CleanName.length()) == CleanName) { // same prefix std::string clSuffix(ObjName.substr(CleanName.length())); - if (clSuffix.size() > 0) { + if (!clSuffix.empty()) { std::string::size_type nPos = clSuffix.find_first_not_of("0123456789"); if (nPos==std::string::npos) nSuff = std::max(nSuff, std::atol(clSuffix.c_str())); diff --git a/src/Mod/Sketcher/App/ExternalGeometryExtensionPyImp.cpp b/src/Mod/Sketcher/App/ExternalGeometryExtensionPyImp.cpp index 4f6ba756b0..bbe35e3d03 100644 --- a/src/Mod/Sketcher/App/ExternalGeometryExtensionPyImp.cpp +++ b/src/Mod/Sketcher/App/ExternalGeometryExtensionPyImp.cpp @@ -45,7 +45,7 @@ std::string ExternalGeometryExtensionPy::representation(void) const str << "getName().size()>0) + if(!getExternalGeometryExtensionPtr()->getName().empty()) str << "\'" << getExternalGeometryExtensionPtr()->getName() << "\', "; str << "\"" << ref; diff --git a/src/Mod/Sketcher/App/PropertyConstraintList.cpp b/src/Mod/Sketcher/App/PropertyConstraintList.cpp index 19a9d80863..31268fd16b 100644 --- a/src/Mod/Sketcher/App/PropertyConstraintList.cpp +++ b/src/Mod/Sketcher/App/PropertyConstraintList.cpp @@ -85,7 +85,7 @@ App::ObjectIdentifier PropertyConstraintList::makeSimplePath(const Constraint * App::ObjectIdentifier PropertyConstraintList::makePath(int idx, const Constraint * c) { - return c->Name.size() == 0 ? makeArrayPath(idx) : makeSimplePath(c); + return c->Name.empty() ? makeArrayPath(idx) : makeSimplePath(c); } void PropertyConstraintList::setSize(int newSize) @@ -99,7 +99,7 @@ void PropertyConstraintList::setSize(int newSize) } /* Signal removed elements */ - if (removed.size() > 0) + if (!removed.empty()) signalConstraintsRemoved(removed); /* Actually delete them */ @@ -126,7 +126,7 @@ void PropertyConstraintList::set1Value(const int idx, const Constraint* lValue) std::map renamed; renamed[makePath(idx, _lValueList[idx])] = makePath(idx, lValue); - if (renamed.size() > 0) + if (!renamed.empty()) signalConstraintsRenamed(renamed); } @@ -148,13 +148,13 @@ void PropertyConstraintList::setValue(const Constraint* lValue) int start = 0; /* Determine if it is a rename or not * */ - if (_lValueList.size() > 0 && lValue->tag == _lValueList[0]->tag) { + if (!_lValueList.empty() && lValue->tag == _lValueList[0]->tag) { renamed[makePath(0, _lValueList[0])] = makePath(0, lValue); start = 1; } /* Signal rename changes */ - if (renamed.size() > 0) + if (!renamed.empty()) signalConstraintsRenamed(renamed); /* Collect info about removals */ @@ -164,7 +164,7 @@ void PropertyConstraintList::setValue(const Constraint* lValue) } /* Signal removes */ - if (removed.size() > 0) + if (!removed.empty()) signalConstraintsRemoved(removed); // Cleanup @@ -228,11 +228,11 @@ void PropertyConstraintList::applyValues(std::vector&& lValue) valueMap = std::move(newValueMap); /* Signal removes first, in case renamed values below have the same names as some of the removed ones. */ - if (removed.size() > 0 && !restoreFromTransaction) + if (!removed.empty() && !restoreFromTransaction) signalConstraintsRemoved(removed); /* Signal renames */ - if (renamed.size() > 0 && !restoreFromTransaction) + if (!renamed.empty() && !restoreFromTransaction) signalConstraintsRenamed(renamed); _lValueList = std::move(lValue); @@ -477,7 +477,7 @@ string PropertyConstraintList::getConstraintName(int i) bool PropertyConstraintList::validConstraintName(const std::string & name) { - return name.size() > 0; + return !name.empty(); } ObjectIdentifier PropertyConstraintList::createPath(int ConstrNbr) const @@ -582,7 +582,7 @@ ObjectIdentifier PropertyConstraintList::canonicalPath(const ObjectIdentifier &p if (c1.isArray()) { size_t idx = c1.getIndex(); - if (idx < _lValueList.size() && _lValueList[idx]->Name.size() > 0) + if (idx < _lValueList.size() && !_lValueList[idx]->Name.empty()) return ObjectIdentifier(*this) << ObjectIdentifier::SimpleComponent(_lValueList[idx]->Name); return p; } @@ -595,7 +595,7 @@ ObjectIdentifier PropertyConstraintList::canonicalPath(const ObjectIdentifier &p void PropertyConstraintList::getPaths(std::vector &paths) const { for (std::vector::const_iterator it = _lValueList.begin(); it != _lValueList.end(); ++it) { - if ((*it)->Name.size() > 0) + if (!(*it)->Name.empty()) paths.push_back(ObjectIdentifier(*this) << ObjectIdentifier::SimpleComponent((*it)->Name)); } } diff --git a/src/Mod/Sketcher/App/PythonConverter.cpp b/src/Mod/Sketcher/App/PythonConverter.cpp index 0437bd12c4..4d75f1b085 100644 --- a/src/Mod/Sketcher/App/PythonConverter.cpp +++ b/src/Mod/Sketcher/App/PythonConverter.cpp @@ -126,7 +126,7 @@ std::string PythonConverter::convert(const std::string & doc, const std::vector< constraintlist % cg); } - if(constraints.size() > 0) { + if(!constraints.empty()) { constraintlist = boost::str(boost::format("%s\n%s.addConstraint(constraintList)\ndel constraintList\n") % constraintlist % doc); } diff --git a/src/Mod/Sketcher/App/Sketch.cpp b/src/Mod/Sketcher/App/Sketch.cpp index 6a44465f77..2376e5a8fb 100644 --- a/src/Mod/Sketcher/App/Sketch.cpp +++ b/src/Mod/Sketcher/App/Sketch.cpp @@ -320,7 +320,7 @@ int Sketch::setUpSketch(const std::vector &GeoList, void Sketch::fixParametersAndDiagnose(std::vector ¶ms_to_block) { - if(params_to_block.size() > 0) { // only there are parameters to fix + if(!params_to_block.empty()) { // only there are parameters to fix for( auto p : params_to_block ) { auto findparam = std::find(Parameters.begin(),Parameters.end(), p); @@ -411,7 +411,7 @@ bool Sketch::analyseBlockedConstraintDependentParameters(std::vector &block bool unsatisfied_groups = false; for(size_t i = 0; i < prop_groups.size(); i++) { // 4.1. unsatisfiable group - if(prop_groups[i].blockable_params_in_group.size() == 0) { + if(prop_groups[i].blockable_params_in_group.empty()) { // this group does not contain any blockable parameter, so it is by definition satisfied (or impossible to satisfy by block constraints) continue; } @@ -4269,7 +4269,7 @@ TopoShape Sketch::toShape(void) const // Hint: Use ShapeAnalysis_FreeBounds::ConnectEdgesToWires() as an alternative // // sort them together to wires - while (edge_list.size() > 0) { + while (!edge_list.empty()) { BRepBuilderAPI_MakeWire mkWire; // add and erase first edge mkWire.Add(edge_list.front()); diff --git a/src/Mod/Sketcher/App/SketchGeometryExtensionPyImp.cpp b/src/Mod/Sketcher/App/SketchGeometryExtensionPyImp.cpp index 3ae885087a..9cbdfa23a3 100644 --- a/src/Mod/Sketcher/App/SketchGeometryExtensionPyImp.cpp +++ b/src/Mod/Sketcher/App/SketchGeometryExtensionPyImp.cpp @@ -40,7 +40,7 @@ std::string SketchGeometryExtensionPy::representation(void) const std::stringstream str; str << "getName().size()>0) + if(!getSketchGeometryExtensionPtr()->getName().empty()) str << "\'" << getSketchGeometryExtensionPtr()->getName() << "\', "; str << "\""; diff --git a/src/Mod/Sketcher/App/SketchObject.cpp b/src/Mod/Sketcher/App/SketchObject.cpp index 15b5ab0708..b50d09fb48 100644 --- a/src/Mod/Sketcher/App/SketchObject.cpp +++ b/src/Mod/Sketcher/App/SketchObject.cpp @@ -4111,7 +4111,7 @@ int SketchObject::addCopy(const std::vector &geoIdList, const Base::Vector3 std::vector newgeoIdList(geoIdList); - if(newgeoIdList.size() == 0) {// default option to operate on all the geometry + if(newgeoIdList.empty()) {// default option to operate on all the geometry for(int i = 0; i < int(geovals.size()); i++) newgeoIdList.push_back(i); } @@ -5361,7 +5361,7 @@ int SketchObject::deleteUnusedInternalGeometry(int GeoId, bool delgeoid) std::sort(delgeometries.begin(), delgeometries.end()); // indices over an erased element get automatically updated!! - if (delgeometries.size()>0) { + if (!delgeometries.empty()) { for (std::vector::reverse_iterator it=delgeometries.rbegin(); it!=delgeometries.rend(); ++it) { delGeometry(*it,false); } @@ -5453,7 +5453,7 @@ int SketchObject::deleteUnusedInternalGeometry(int GeoId, bool delgeoid) std::sort(delgeometries.begin(), delgeometries.end()); // indices over an erased element get automatically updated!! - if (delgeometries.size()>0) { + if (!delgeometries.empty()) { for (std::vector::reverse_iterator it=delgeometries.rbegin(); it!=delgeometries.rend(); ++it) { delGeometry(*it,false); } @@ -7494,7 +7494,7 @@ void SketchObject::appendConstraintsMsg(const std::vector &vector, std::stringstream ss; if (msg.length() > 0) ss << msg; - if (vector.size() > 0) { + if (!vector.empty()) { if (vector.size() == 1) ss << singularmsg << std::endl; else @@ -8432,7 +8432,7 @@ int SketchObject::autoRemoveRedundants(bool updategeo) { auto redundants = getLastRedundant(); - if(redundants.size() == 0) + if(redundants.empty()) return 0; for(size_t i=0;i clistR; - if (redundant.size()) { + if (!redundant.empty()) { for (std::vector::const_iterator constr=clist.begin(); constr != clist.end(); ++constr) { if (redundant.count(*constr) == 0) clistR.push_back(*constr); @@ -1523,9 +1523,9 @@ void System::initSolution(Algorithm alg) subSystems.push_back(nullptr); subSystemsAux.push_back(nullptr); - if (clist0.size() > 0) + if (!clist0.empty()) subSystems[cid] = new SubSystem(clist0, plists[cid], reductionmaps[cid]); - if (clist1.size() > 0) + if (!clist1.empty()) subSystemsAux[cid] = new SubSystem(clist1, plists[cid], reductionmaps[cid]); } diff --git a/src/Mod/Sketcher/App/planegcs/SubSystem.cpp b/src/Mod/Sketcher/App/planegcs/SubSystem.cpp index 39c84a7874..270f2168f9 100644 --- a/src/Mod/Sketcher/App/planegcs/SubSystem.cpp +++ b/src/Mod/Sketcher/App/planegcs/SubSystem.cpp @@ -68,7 +68,7 @@ void SubSystem::initialize(VEC_pD ¶ms, MAP_pD_pD &reductionmap) plist.clear(); MAP_pD_I rindex; - if (reductionmap.size() > 0) { + if (!reductionmap.empty()) { int i=0; MAP_pD_I pindex; for (VEC_pD::const_iterator itt=tmpplist.begin(); diff --git a/src/Mod/Sketcher/Gui/Command.cpp b/src/Mod/Sketcher/Gui/Command.cpp index 0a6597b991..0fed19135b 100644 --- a/src/Mod/Sketcher/Gui/Command.cpp +++ b/src/Mod/Sketcher/Gui/Command.cpp @@ -774,7 +774,7 @@ void CmdSketcherMirrorSketch::activated(int iMsg) { Q_UNUSED(iMsg); std::vector selection = getSelection().getSelectionEx(nullptr, Sketcher::SketchObject::getClassTypeId()); - if (selection.size() < 1) { + if (selection.empty()) { QMessageBox::warning(Gui::getMainWindow(), qApp->translate("CmdSketcherMirrorSketch", "Wrong selection"), qApp->translate("CmdSketcherMirrorSketch", "Select one or more sketches.")); diff --git a/src/Mod/Sketcher/Gui/CommandConstraints.cpp b/src/Mod/Sketcher/Gui/CommandConstraints.cpp index d8b692c426..e0b7f082a4 100644 --- a/src/Mod/Sketcher/Gui/CommandConstraints.cpp +++ b/src/Mod/Sketcher/Gui/CommandConstraints.cpp @@ -2138,7 +2138,7 @@ void CmdSketcherConstrainDistance::activated(int iMsg) const std::vector &SubNames = selection[0].getSubNames(); Sketcher::SketchObject* Obj = static_cast(selection[0].getObject()); - if (SubNames.size() < 1 || SubNames.size() > 2) { + if (SubNames.empty() || SubNames.size() > 2) { QMessageBox::warning(Gui::getMainWindow(), QObject::tr("Wrong selection"), QObject::tr("Select exactly one line or one point and one line or two points from the sketch.")); return; @@ -2529,8 +2529,8 @@ void CmdSketcherConstrainPointOnObject::activated(int iMsg) points.push_back(id); } - if ((points.size() == 1 && curves.size() >= 1) || - (points.size() >= 1 && curves.size() == 1)) { + if ((points.size() == 1 && !curves.empty()) || + (!points.empty() && curves.size() == 1)) { openCommand(QT_TRANSLATE_NOOP("Command", "Add point on object constraint")); int cnt = 0; @@ -2735,7 +2735,7 @@ void CmdSketcherConstrainDistanceX::activated(int iMsg) const std::vector &SubNames = selection[0].getSubNames(); Sketcher::SketchObject* Obj = static_cast(selection[0].getObject()); - if (SubNames.size() < 1 || SubNames.size() > 2) { + if (SubNames.empty() || SubNames.size() > 2) { QMessageBox::warning(Gui::getMainWindow(), QObject::tr("Wrong selection"), QObject::tr("Select exactly one line or up to two points from the sketch.")); return; @@ -2987,7 +2987,7 @@ void CmdSketcherConstrainDistanceY::activated(int iMsg) const std::vector &SubNames = selection[0].getSubNames(); Sketcher::SketchObject* Obj = static_cast(selection[0].getObject()); - if (SubNames.size() < 1 || SubNames.size() > 2) { + if (SubNames.empty() || SubNames.size() > 2) { QMessageBox::warning(Gui::getMainWindow(), QObject::tr("Wrong selection"), QObject::tr("Select exactly one line or up to two points from the sketch.")); return; @@ -5777,7 +5777,7 @@ void CmdSketcherConstrainAngle::activated(int iMsg) const std::vector &SubNames = selection[0].getSubNames(); Sketcher::SketchObject* Obj = static_cast(selection[0].getObject()); - if (SubNames.size() < 1 || SubNames.size() > 3) { + if (SubNames.empty() || SubNames.size() > 3) { //goto ExitWithMessage; QMessageBox::warning(Gui::getMainWindow(), QObject::tr("Wrong selection"), QObject::tr("Select one or two lines from the sketch. Or select two edges and a point.")); @@ -7093,12 +7093,12 @@ void CmdSketcherConstrainInternalAlignment::activated(int iMsg) } // if some element is missing and we are adding an element of that type - if((!(focus1 && focus2) && pointids.size() >= 1) || - (!(major && minor) && lineids.size() >= 1) ){ + if((!(focus1 && focus2) && !pointids.empty()) || + (!(major && minor) && !lineids.empty()) ){ openCommand(QT_TRANSLATE_NOOP("Command", "Add internal alignment constraint")); - if(pointids.size()>=1) + if(!pointids.empty()) { if(!focus1) { Gui::cmdAppObjectArgs(selection[0].getObject(), @@ -7126,7 +7126,7 @@ void CmdSketcherConstrainInternalAlignment::activated(int iMsg) extra_elements=true; } - if(lineids.size()>=1) + if(!lineids.empty()) { if(!major) { Gui::cmdAppObjectArgs(selection[0].getObject(), @@ -7210,7 +7210,7 @@ void CmdSketcherConstrainInternalAlignment::activated(int iMsg) return; } - if(ellipseids.size()>0){ + if(!ellipseids.empty()){ QMessageBox::warning(Gui::getMainWindow(), QObject::tr("Wrong selection"), QObject::tr("You cannot internally constrain an ellipse " "on an arc of ellipse. " @@ -7271,12 +7271,12 @@ void CmdSketcherConstrainInternalAlignment::activated(int iMsg) } // if some element is missing and we are adding an element of that type - if((!(focus1 && focus2) && pointids.size() >= 1) || - (!(major && minor) && lineids.size() >= 1) ){ + if((!(focus1 && focus2) && !pointids.empty()) || + (!(major && minor) && !lineids.empty()) ){ openCommand(QT_TRANSLATE_NOOP("Command", "Add internal alignment constraint")); - if(pointids.size()>=1) + if(!pointids.empty()) { if(!focus1) { Gui::cmdAppObjectArgs(selection[0].getObject(), @@ -7304,7 +7304,7 @@ void CmdSketcherConstrainInternalAlignment::activated(int iMsg) extra_elements=true; } - if(lineids.size()>=1) + if(!lineids.empty()) { if(!major) { Gui::cmdAppObjectArgs(selection[0].getObject(), diff --git a/src/Mod/Sketcher/Gui/CommandSketcherBSpline.cpp b/src/Mod/Sketcher/Gui/CommandSketcherBSpline.cpp index 7374d4075c..1d6ca9aa40 100644 --- a/src/Mod/Sketcher/Gui/CommandSketcherBSpline.cpp +++ b/src/Mod/Sketcher/Gui/CommandSketcherBSpline.cpp @@ -1167,7 +1167,7 @@ void CmdSketcherInsertKnot::activated(int iMsg) // get the needed lists and objects const std::vector &SubNames = selection[0].getSubNames(); - if (SubNames.size() == 0) { + if (SubNames.empty()) { // Check that only one object is selected, // as we need only one object to get the new GeoId after multiplicity change QMessageBox::warning(Gui::getMainWindow(), QObject::tr("Selection is empty"), diff --git a/src/Mod/Sketcher/Gui/CommandSketcherTools.cpp b/src/Mod/Sketcher/Gui/CommandSketcherTools.cpp index ccf7d7b403..b20f7f40ea 100644 --- a/src/Mod/Sketcher/Gui/CommandSketcherTools.cpp +++ b/src/Mod/Sketcher/Gui/CommandSketcherTools.cpp @@ -1181,13 +1181,13 @@ public: if (Op != SketcherCopy::Move) { // add auto constraints for the destination copy - if (sugConstr1.size() > 0) { + if (!sugConstr1.empty()) { createAutoConstraints(sugConstr1, currentgeoid+nElements, OriginPos); sugConstr1.clear(); } } else { - if (sugConstr1.size() > 0) { + if (!sugConstr1.empty()) { createAutoConstraints(sugConstr1, OriginGeoId, OriginPos); sugConstr1.clear(); } @@ -1725,7 +1725,7 @@ public: } // add auto constraints for the destination copy - if (sugConstr1.size() > 0) { + if (!sugConstr1.empty()) { createAutoConstraints(sugConstr1, OriginGeoId+nElements, OriginPos); sugConstr1.clear(); } diff --git a/src/Mod/Sketcher/Gui/DrawSketchHandler.cpp b/src/Mod/Sketcher/Gui/DrawSketchHandler.cpp index 9723b199a1..73279f8d23 100644 --- a/src/Mod/Sketcher/Gui/DrawSketchHandler.cpp +++ b/src/Mod/Sketcher/Gui/DrawSketchHandler.cpp @@ -796,7 +796,7 @@ void DrawSketchHandler::createAutoConstraints(const std::vector if (!sketchgui->Autoconstraints.getValue()) return; // If Autoconstraints property is not set quit - if (autoConstrs.size() > 0) { + if (!autoConstrs.empty()) { if(createowncommand) { // Open the Command diff --git a/src/Mod/Sketcher/Gui/DrawSketchHandlerArc.h b/src/Mod/Sketcher/Gui/DrawSketchHandlerArc.h index a8224fc7e9..7c6d0c91ac 100644 --- a/src/Mod/Sketcher/Gui/DrawSketchHandlerArc.h +++ b/src/Mod/Sketcher/Gui/DrawSketchHandlerArc.h @@ -182,19 +182,19 @@ public: } // Auto Constraint center point - if (sugConstr1.size() > 0) { + if (!sugConstr1.empty()) { createAutoConstraints(sugConstr1, getHighestCurveIndex(), Sketcher::PointPos::mid); sugConstr1.clear(); } // Auto Constraint first picked point - if (sugConstr2.size() > 0) { + if (!sugConstr2.empty()) { createAutoConstraints(sugConstr2, getHighestCurveIndex(), (arcAngle > 0) ? Sketcher::PointPos::start : Sketcher::PointPos::end ); sugConstr2.clear(); } // Auto Constraint second picked point - if (sugConstr3.size() > 0) { + if (!sugConstr3.empty()) { createAutoConstraints(sugConstr3, getHighestCurveIndex(), (arcAngle > 0) ? Sketcher::PointPos::end : Sketcher::PointPos::start); sugConstr3.clear(); } @@ -423,19 +423,19 @@ public: } // Auto Constraint first picked point - if (sugConstr1.size() > 0) { + if (!sugConstr1.empty()) { createAutoConstraints(sugConstr1, getHighestCurveIndex(), arcPos1); sugConstr1.clear(); } // Auto Constraint second picked point - if (sugConstr2.size() > 0) { + if (!sugConstr2.empty()) { createAutoConstraints(sugConstr2, getHighestCurveIndex(), arcPos2); sugConstr2.clear(); } // Auto Constraint third picked point - if (sugConstr3.size() > 0) { + if (!sugConstr3.empty()) { createAutoConstraints(sugConstr3, getHighestCurveIndex(), Sketcher::PointPos::none); sugConstr3.clear(); } diff --git a/src/Mod/Sketcher/Gui/DrawSketchHandlerArcOfEllipse.h b/src/Mod/Sketcher/Gui/DrawSketchHandlerArcOfEllipse.h index 905b171f27..97f9da4424 100644 --- a/src/Mod/Sketcher/Gui/DrawSketchHandlerArcOfEllipse.h +++ b/src/Mod/Sketcher/Gui/DrawSketchHandlerArcOfEllipse.h @@ -275,25 +275,25 @@ public: Gui::Command::commitCommand(); // add auto constraints for the center point - if (sugConstr1.size() > 0) { + if (!sugConstr1.empty()) { createAutoConstraints(sugConstr1, currentgeoid, Sketcher::PointPos::mid); sugConstr1.clear(); } // add suggested constraints for arc - if (sugConstr2.size() > 0) { + if (!sugConstr2.empty()) { createAutoConstraints(sugConstr2, currentgeoid, Sketcher::PointPos::none); sugConstr2.clear(); } // add suggested constraints for start of arc - if (sugConstr3.size() > 0) { + if (!sugConstr3.empty()) { createAutoConstraints(sugConstr3, currentgeoid, isOriginalArcCCW?Sketcher::PointPos::start:Sketcher::PointPos::end); sugConstr3.clear(); } // add suggested constraints for start of arc - if (sugConstr4.size() > 0) { + if (!sugConstr4.empty()) { createAutoConstraints(sugConstr4, currentgeoid, isOriginalArcCCW?Sketcher::PointPos::end:Sketcher::PointPos::start); sugConstr4.clear(); } diff --git a/src/Mod/Sketcher/Gui/DrawSketchHandlerArcOfHyperbola.h b/src/Mod/Sketcher/Gui/DrawSketchHandlerArcOfHyperbola.h index 3bb3c9dd62..6eb08dabdd 100644 --- a/src/Mod/Sketcher/Gui/DrawSketchHandlerArcOfHyperbola.h +++ b/src/Mod/Sketcher/Gui/DrawSketchHandlerArcOfHyperbola.h @@ -288,25 +288,25 @@ public: Gui::Command::commitCommand(); // add auto constraints for the center point - if (sugConstr1.size() > 0) { + if (!sugConstr1.empty()) { createAutoConstraints(sugConstr1, currentgeoid, Sketcher::PointPos::mid); sugConstr1.clear(); } // add suggested constraints for arc - if (sugConstr2.size() > 0) { + if (!sugConstr2.empty()) { createAutoConstraints(sugConstr2, currentgeoid, Sketcher::PointPos::none); sugConstr2.clear(); } // add suggested constraints for start of arc - if (sugConstr3.size() > 0) { + if (!sugConstr3.empty()) { createAutoConstraints(sugConstr3, currentgeoid, isOriginalArcCCW?Sketcher::PointPos::start:Sketcher::PointPos::end); sugConstr3.clear(); } // add suggested constraints for start of arc - if (sugConstr4.size() > 0) { + if (!sugConstr4.empty()) { createAutoConstraints(sugConstr4, currentgeoid, isOriginalArcCCW?Sketcher::PointPos::end:Sketcher::PointPos::start); sugConstr4.clear(); } diff --git a/src/Mod/Sketcher/Gui/DrawSketchHandlerArcOfParabola.h b/src/Mod/Sketcher/Gui/DrawSketchHandlerArcOfParabola.h index 43ca50c27f..6b58a1140c 100644 --- a/src/Mod/Sketcher/Gui/DrawSketchHandlerArcOfParabola.h +++ b/src/Mod/Sketcher/Gui/DrawSketchHandlerArcOfParabola.h @@ -246,25 +246,25 @@ public: Gui::Command::commitCommand(); // add auto constraints for the focus point - if (sugConstr1.size() > 0) { + if (!sugConstr1.empty()) { createAutoConstraints(sugConstr1, currentgeoid+1, Sketcher::PointPos::start); sugConstr1.clear(); } // add suggested constraints for vertex point - if (sugConstr2.size() > 0) { + if (!sugConstr2.empty()) { createAutoConstraints(sugConstr2, currentgeoid, Sketcher::PointPos::mid); sugConstr2.clear(); } // add suggested constraints for start of arc - if (sugConstr3.size() > 0) { + if (!sugConstr3.empty()) { createAutoConstraints(sugConstr3, currentgeoid, isOriginalArcCCW?Sketcher::PointPos::start:Sketcher::PointPos::end); sugConstr3.clear(); } // add suggested constraints for start of arc - if (sugConstr4.size() > 0) { + if (!sugConstr4.empty()) { createAutoConstraints(sugConstr4, currentgeoid, isOriginalArcCCW?Sketcher::PointPos::end:Sketcher::PointPos::start); sugConstr4.clear(); } diff --git a/src/Mod/Sketcher/Gui/DrawSketchHandlerBSpline.h b/src/Mod/Sketcher/Gui/DrawSketchHandlerBSpline.h index 704c91a3fe..97cb52882a 100644 --- a/src/Mod/Sketcher/Gui/DrawSketchHandlerBSpline.h +++ b/src/Mod/Sketcher/Gui/DrawSketchHandlerBSpline.h @@ -126,7 +126,7 @@ public: //static_cast(sketchgui->getObject())->solve(); // add auto constraints on pole - if (sugConstr.back().size() > 0) { + if (!sugConstr.back().empty()) { createAutoConstraints(sugConstr.back(), poleGeoIds.back(), Sketcher::PointPos::mid, false); } @@ -185,7 +185,7 @@ public: //static_cast(sketchgui->getObject())->solve(); // add auto constraints on pole - if (sugConstr.back().size() > 0) { + if (!sugConstr.back().empty()) { createAutoConstraints(sugConstr.back(), poleGeoIds.back(), Sketcher::PointPos::mid, false); } diff --git a/src/Mod/Sketcher/Gui/DrawSketchHandlerCircle.h b/src/Mod/Sketcher/Gui/DrawSketchHandlerCircle.h index 3f5a875e22..f42712df4a 100644 --- a/src/Mod/Sketcher/Gui/DrawSketchHandlerCircle.h +++ b/src/Mod/Sketcher/Gui/DrawSketchHandlerCircle.h @@ -119,13 +119,13 @@ public: } // add auto constraints for the center point - if (sugConstr1.size() > 0) { + if (!sugConstr1.empty()) { createAutoConstraints(sugConstr1, getHighestCurveIndex(), Sketcher::PointPos::mid); sugConstr1.clear(); } // add suggested constraints for circumference - if (sugConstr2.size() > 0) { + if (!sugConstr2.empty()) { createAutoConstraints(sugConstr2, getHighestCurveIndex(), Sketcher::PointPos::none); sugConstr2.clear(); } @@ -288,19 +288,19 @@ public: } // Auto Constraint first picked point - if (sugConstr1.size() > 0) { + if (!sugConstr1.empty()) { createAutoConstraints(sugConstr1, getHighestCurveIndex(), Sketcher::PointPos::none); sugConstr1.clear(); } // Auto Constraint second picked point - if (sugConstr2.size() > 0) { + if (!sugConstr2.empty()) { createAutoConstraints(sugConstr2, getHighestCurveIndex(), Sketcher::PointPos::none); sugConstr2.clear(); } // Auto Constraint third picked point - if (sugConstr3.size() > 0) { + if (!sugConstr3.empty()) { createAutoConstraints(sugConstr3, getHighestCurveIndex(), Sketcher::PointPos::none); sugConstr3.clear(); } diff --git a/src/Mod/Sketcher/Gui/DrawSketchHandlerEllipse.h b/src/Mod/Sketcher/Gui/DrawSketchHandlerEllipse.h index 342048cc7f..39bf81878f 100644 --- a/src/Mod/Sketcher/Gui/DrawSketchHandlerEllipse.h +++ b/src/Mod/Sketcher/Gui/DrawSketchHandlerEllipse.h @@ -739,30 +739,30 @@ private: if (method == CENTER_PERIAPSIS_B) { // add auto constraints for the center point - if (sugConstr1.size() > 0) { + if (!sugConstr1.empty()) { createAutoConstraints(sugConstr1, currentgeoid, Sketcher::PointPos::mid); sugConstr1.clear(); } - if (sugConstr2.size() > 0) { + if (!sugConstr2.empty()) { createAutoConstraints(sugConstr2, currentgeoid, Sketcher::PointPos::none); sugConstr2.clear(); } - if (sugConstr3.size() > 0) { + if (!sugConstr3.empty()) { createAutoConstraints(sugConstr3, currentgeoid, Sketcher::PointPos::none); sugConstr3.clear(); } } if (method == PERIAPSIS_APOAPSIS_B) { - if (sugConstr1.size() > 0) { + if (!sugConstr1.empty()) { createAutoConstraints(sugConstr1, currentgeoid, Sketcher::PointPos::none); sugConstr1.clear(); } - if (sugConstr2.size() > 0) { + if (!sugConstr2.empty()) { createAutoConstraints(sugConstr2, currentgeoid, Sketcher::PointPos::none); sugConstr2.clear(); } - if (sugConstr3.size() > 0) { + if (!sugConstr3.empty()) { createAutoConstraints(sugConstr3, currentgeoid, Sketcher::PointPos::none); sugConstr3.clear(); } diff --git a/src/Mod/Sketcher/Gui/DrawSketchHandlerExtend.h b/src/Mod/Sketcher/Gui/DrawSketchHandlerExtend.h index 5c4e704a97..750d0c1484 100644 --- a/src/Mod/Sketcher/Gui/DrawSketchHandlerExtend.h +++ b/src/Mod/Sketcher/Gui/DrawSketchHandlerExtend.h @@ -253,7 +253,7 @@ public: Gui::Command::updateActive(); // constrain chosen point - if (SugConstr.size() > 0) { + if (!SugConstr.empty()) { createAutoConstraints(SugConstr, BaseGeoId, (ExtendFromStart) ? Sketcher::PointPos::start : Sketcher::PointPos::end); SugConstr.clear(); } diff --git a/src/Mod/Sketcher/Gui/DrawSketchHandlerLineSet.h b/src/Mod/Sketcher/Gui/DrawSketchHandlerLineSet.h index e4afd76a0a..f754171473 100644 --- a/src/Mod/Sketcher/Gui/DrawSketchHandlerLineSet.h +++ b/src/Mod/Sketcher/Gui/DrawSketchHandlerLineSet.h @@ -478,7 +478,7 @@ public: } } - if (sugConstr2.size() > 0) { + if (!sugConstr2.empty()) { // exclude any coincidence constraints std::vector sugConstr; for (unsigned int i=0; i < sugConstr2.size(); i++) { @@ -528,7 +528,7 @@ public: Gui::Command::commitCommand(); // Add auto constraints - if (sugConstr1.size() > 0) { // this is relevant only to the very first point + if (!sugConstr1.empty()) { // this is relevant only to the very first point createAutoConstraints(sugConstr1, getHighestCurveIndex(), Sketcher::PointPos::start); sugConstr1.clear(); } @@ -545,7 +545,7 @@ public: virtualsugConstr1 = sugConstr2; // these are the initial constraints for the next iteration. - if (sugConstr2.size() > 0) { + if (!sugConstr2.empty()) { createAutoConstraints(sugConstr2, getHighestCurveIndex(), (SegmentMode == SEGMENT_MODE_Arc && startAngle > endAngle) ? Sketcher::PointPos::start : Sketcher::PointPos::end); diff --git a/src/Mod/Sketcher/Gui/DrawSketchHandlerPoint.h b/src/Mod/Sketcher/Gui/DrawSketchHandlerPoint.h index 58b35ac46b..60b5de7f5d 100644 --- a/src/Mod/Sketcher/Gui/DrawSketchHandlerPoint.h +++ b/src/Mod/Sketcher/Gui/DrawSketchHandlerPoint.h @@ -74,7 +74,7 @@ public: } // add auto constraints for the line segment start - if (sugConstr.size() > 0) { + if (!sugConstr.empty()) { createAutoConstraints(sugConstr, getHighestCurveIndex(), Sketcher::PointPos::start); sugConstr.clear(); } diff --git a/src/Mod/Sketcher/Gui/DrawSketchHandlerPolygon.h b/src/Mod/Sketcher/Gui/DrawSketchHandlerPolygon.h index f43af0ae62..95b73bb3bd 100644 --- a/src/Mod/Sketcher/Gui/DrawSketchHandlerPolygon.h +++ b/src/Mod/Sketcher/Gui/DrawSketchHandlerPolygon.h @@ -126,13 +126,13 @@ public: Gui::Command::commitCommand(); // add auto constraints at the center of the polygon - if (sugConstr1.size() > 0) { + if (!sugConstr1.empty()) { createAutoConstraints(sugConstr1, getHighestCurveIndex(), Sketcher::PointPos::mid); sugConstr1.clear(); } // add auto constraints to the last side of the polygon - if (sugConstr2.size() > 0) { + if (!sugConstr2.empty()) { createAutoConstraints(sugConstr2, getHighestCurveIndex() - 1, Sketcher::PointPos::end); sugConstr2.clear(); } diff --git a/src/Mod/Sketcher/Gui/DrawSketchHandlerRectangle.h b/src/Mod/Sketcher/Gui/DrawSketchHandlerRectangle.h index 6793433e78..32224a2f02 100644 --- a/src/Mod/Sketcher/Gui/DrawSketchHandlerRectangle.h +++ b/src/Mod/Sketcher/Gui/DrawSketchHandlerRectangle.h @@ -232,13 +232,13 @@ public: if(constructionMethod == Diagonal) { // add auto constraints at the start of the first side - if (sugConstr1.size() > 0) { + if (!sugConstr1.empty()) { createAutoConstraints(sugConstr1, getHighestCurveIndex() - 3 , Sketcher::PointPos::start); sugConstr1.clear(); } // add auto constraints at the end of the second side - if (sugConstr2.size() > 0) { + if (!sugConstr2.empty()) { createAutoConstraints(sugConstr2, getHighestCurveIndex() - 2, Sketcher::PointPos::end); sugConstr2.clear(); } @@ -246,13 +246,13 @@ public: } else if (constructionMethod == CenterAndCorner) { // add auto constraints at the start of the first side - if (sugConstr1.size() > 0) { + if (!sugConstr1.empty()) { createAutoConstraints(sugConstr1, getHighestCurveIndex(), Sketcher::PointPos::start); sugConstr1.clear(); } // add auto constraints at the end of the second side - if (sugConstr2.size() > 0) { + if (!sugConstr2.empty()) { createAutoConstraints(sugConstr2, getHighestCurveIndex() - 3, Sketcher::PointPos::end); sugConstr2.clear(); } @@ -525,13 +525,13 @@ public: Gui::Command::commitCommand(); // add auto constraints at the StartPos auxiliary point - if (sugConstr1.size() > 0) { + if (!sugConstr1.empty()) { createAutoConstraints(sugConstr1, getHighestCurveIndex() - 1, Sketcher::PointPos::start); sugConstr1.clear(); } // add auto constraints at the EndPos auxiliary point - if (sugConstr2.size() > 0) { + if (!sugConstr2.empty()) { createAutoConstraints(sugConstr2, getHighestCurveIndex(), Sketcher::PointPos::start); sugConstr2.clear(); } diff --git a/src/Mod/Sketcher/Gui/DrawSketchHandlerSlot.h b/src/Mod/Sketcher/Gui/DrawSketchHandlerSlot.h index 6965aa2b41..826bdcdd0f 100644 --- a/src/Mod/Sketcher/Gui/DrawSketchHandlerSlot.h +++ b/src/Mod/Sketcher/Gui/DrawSketchHandlerSlot.h @@ -241,13 +241,13 @@ public: Gui::Command::commitCommand(); // add auto constraints at the center of the first arc - if (sugConstr1.size() > 0) { + if (!sugConstr1.empty()) { createAutoConstraints(sugConstr1, getHighestCurveIndex() - 3, Sketcher::PointPos::mid); sugConstr1.clear(); } // add auto constraints at the center of the second arc - if (sugConstr2.size() > 0) { + if (!sugConstr2.empty()) { createAutoConstraints(sugConstr2, getHighestCurveIndex() - 2, Sketcher::PointPos::mid); sugConstr2.clear(); } diff --git a/src/Mod/Sketcher/Gui/TaskSketcherValidation.cpp b/src/Mod/Sketcher/Gui/TaskSketcherValidation.cpp index c0cda9f54c..293efc1a1c 100644 --- a/src/Mod/Sketcher/Gui/TaskSketcherValidation.cpp +++ b/src/Mod/Sketcher/Gui/TaskSketcherValidation.cpp @@ -230,7 +230,7 @@ void SketcherValidation::on_findReversed_clicked() } } hidePoints(); - if(points.size()>0){ + if(!points.empty()){ int nc = sketch->port_reversedExternalArcs(/*justAnalyze=*/true); showPoints(points); if(nc>0){ diff --git a/src/Mod/Sketcher/Gui/ViewProviderSketch.cpp b/src/Mod/Sketcher/Gui/ViewProviderSketch.cpp index 748002b3b7..a6158ea46e 100644 --- a/src/Mod/Sketcher/Gui/ViewProviderSketch.cpp +++ b/src/Mod/Sketcher/Gui/ViewProviderSketch.cpp @@ -1564,7 +1564,7 @@ void ViewProviderSketch::onSelectionChanged(const Gui::SelectionChanges& msg) // are we in edit? if (isInEditMode()) { // ignore external object - if(msg.Object.getObjectName().size() && msg.Object.getDocument()!=getObject()->getDocument()) + if(!msg.Object.getObjectName().empty() && msg.Object.getDocument()!=getObject()->getDocument()) return; bool handled=false; @@ -2883,7 +2883,7 @@ QString ViewProviderSketch::appendConstraintMsg(const QString & singularmsg, { QString msg; QTextStream ss(&msg); - if (vector.size() > 0) { + if (!vector.empty()) { if (vector.size() == 1) ss << singularmsg; else @@ -3168,7 +3168,7 @@ void ViewProviderSketch::deleteSelected() // get the needed lists and objects const std::vector &SubNames = selection[0].getSubNames(); - if(SubNames.size()>0) { + if(!SubNames.empty()) { App::Document* doc = getSketchObject()->getDocument(); doc->openTransaction("Delete sketch geometry"); diff --git a/src/Mod/Spreadsheet/App/Cell.cpp b/src/Mod/Spreadsheet/App/Cell.cpp index 9be0092044..cccb19b8ca 100644 --- a/src/Mod/Spreadsheet/App/Cell.cpp +++ b/src/Mod/Spreadsheet/App/Cell.cpp @@ -186,7 +186,7 @@ void Cell::setExpression(App::ExpressionPtr &&expr) /* Remove dependencies */ owner->removeDependencies(address); - if(expr && expr->comment.size()) { + if(expr && !expr->comment.empty()) { if(!boost::starts_with(expr->comment,"sheet()->getFullName() << '.' << address.toString()); @@ -423,7 +423,7 @@ void Cell::setStyle(const std::set & _style) PropertySheet::AtomicPropertyChange signaller(*owner); style = _style; - setUsed(STYLE_SET, style.size() > 0); + setUsed(STYLE_SET, !style.empty()); setDirty(); signaller.tryInvoke(); @@ -509,7 +509,7 @@ bool Cell::getBackground(App::Color &color) const void Cell::setDisplayUnit(const std::string &unit) { DisplayUnit newDisplayUnit; - if (unit.size() > 0) { + if (!unit.empty()) { std::shared_ptr e(ExpressionParser::parseUnit(owner->sheet(), unit.c_str())); if (!e) @@ -641,7 +641,7 @@ bool Cell::getSpans(int &rows, int &columns) const void Cell::setException(const std::string &e, bool silent) { - if(!silent && e.size() && owner && owner->sheet()) { + if(!silent && !e.empty() && owner && owner->sheet()) { FC_ERR(owner->sheet()->getFullName() << '.' << address.toString() << ": " << e); } @@ -651,7 +651,7 @@ void Cell::setException(const std::string &e, bool silent) void Cell::setParseException(const std::string &e) { - if(e.size() && owner && owner->sheet()) { + if(!e.empty() && owner && owner->sheet()) { FC_ERR(owner->sheet()->getFullName() << '.' << address.toString() << ": " << e); } @@ -661,7 +661,7 @@ void Cell::setParseException(const std::string &e) void Cell::setResolveException(const std::string &e) { - if(e.size() && owner && owner->sheet()) { + if(!e.empty() && owner && owner->sheet()) { FC_LOG(owner->sheet()->getFullName() << '.' << address.toString() << ": " << e); } @@ -899,7 +899,7 @@ int Cell::decodeAlignment(const std::string & itemStr, int alignment) alignment = (alignment & ~Cell::ALIGNMENT_VERTICAL) | Cell::ALIGNMENT_VCENTER; else if (itemStr == "bottom") alignment = (alignment & ~Cell::ALIGNMENT_VERTICAL) | Cell::ALIGNMENT_BOTTOM; - else if(itemStr.size()) + else if(!itemStr.empty()) throw Base::ValueError("Invalid alignment."); return alignment; diff --git a/src/Mod/Spreadsheet/App/DisplayUnit.h b/src/Mod/Spreadsheet/App/DisplayUnit.h index c0bf22db04..d15053dc86 100644 --- a/src/Mod/Spreadsheet/App/DisplayUnit.h +++ b/src/Mod/Spreadsheet/App/DisplayUnit.h @@ -52,7 +52,7 @@ public: return !operator==(c); } - bool isEmpty() const { return stringRep.size() == 0; } + bool isEmpty() const { return stringRep.empty(); } }; diff --git a/src/Mod/Spreadsheet/App/PropertyColumnWidths.h b/src/Mod/Spreadsheet/App/PropertyColumnWidths.h index abcaf014f6..324d8ac286 100644 --- a/src/Mod/Spreadsheet/App/PropertyColumnWidths.h +++ b/src/Mod/Spreadsheet/App/PropertyColumnWidths.h @@ -59,7 +59,7 @@ public: virtual void Restore(Base::XMLReader & reader); - bool isDirty() const { return dirty.size() > 0; } + bool isDirty() const { return !dirty.empty(); } void clearDirty() { dirty.clear(); } diff --git a/src/Mod/Spreadsheet/App/PropertySheet.cpp b/src/Mod/Spreadsheet/App/PropertySheet.cpp index 319cb20807..6cd95b2896 100644 --- a/src/Mod/Spreadsheet/App/PropertySheet.cpp +++ b/src/Mod/Spreadsheet/App/PropertySheet.cpp @@ -622,7 +622,7 @@ void PropertySheet::setDisplayUnit(CellAddress address, const std::string &unit) void PropertySheet::setAlias(CellAddress address, const std::string &alias) { - if (alias.size() > 0 && !isValidAlias(alias)) + if (!alias.empty() && !isValidAlias(alias)) throw Base::ValueError("Invalid alias"); const Cell * aliasedCell = getValueFromAlias(alias); @@ -654,7 +654,7 @@ void PropertySheet::setAlias(CellAddress address, const std::string &alias) cell->getAlias(oldAlias); cell->setAlias(alias); - if (oldAlias.size() > 0) { + if (!oldAlias.empty()) { std::map m; App::ObjectIdentifier key(owner, oldAlias); @@ -1158,7 +1158,7 @@ void PropertySheet::addDependencies(CellAddress key) cellToPropertyNameMap[key].insert(propName); // Also an alias? - if (name.size() && docObj->isDerivedFrom(Sheet::getClassTypeId())) { + if (!name.empty() && docObj->isDerivedFrom(Sheet::getClassTypeId())) { auto other = static_cast(docObj); auto j = other->cells.revAliasProp.find(name); @@ -1219,7 +1219,7 @@ void PropertySheet::removeDependencies(CellAddress key) if (k != documentObjectToCellMap.end()) { k->second.erase(key); - if (k->second.size() == 0) + if (k->second.empty()) documentObjectToCellMap.erase(*j); } diff --git a/src/Mod/Spreadsheet/App/Sheet.cpp b/src/Mod/Spreadsheet/App/Sheet.cpp index 4824e03300..33c0d86c4c 100644 --- a/src/Mod/Spreadsheet/App/Sheet.cpp +++ b/src/Mod/Spreadsheet/App/Sheet.cpp @@ -208,7 +208,7 @@ bool Sheet::importFromFile(const std::string &filename, char delimiter, char quo tokenizer > tok(line, e); for(tokenizer >::iterator i = tok.begin(); i != tok.end();++i) { - if ((*i).size() > 0) + if (!*i.empty()) setCell(CellAddress(row, col), (*i).c_str()); col++; } @@ -930,7 +930,7 @@ DocumentObjectExecReturn *Sheet::execute(void) std::map VertexList; std::map VertexIndexList; std::deque workQueue(dirtyCells.begin(),dirtyCells.end()); - while(workQueue.size()) { + while(!workQueue.empty()) { CellAddress currPos = workQueue.front(); workQueue.pop_front(); @@ -978,7 +978,7 @@ DocumentObjectExecReturn *Sheet::execute(void) } // Try to be more user friendly by finding individual loops - while(dirtyCells.size()) { + while(!dirtyCells.empty()) { std::deque workQueue; DependencyList graph; @@ -989,7 +989,7 @@ DocumentObjectExecReturn *Sheet::execute(void) workQueue.push_back(currentAddr); dirtyCells.erase(dirtyCells.begin()); - while (workQueue.size() > 0) { + while (!workQueue.empty()) { CellAddress currPos = workQueue.front(); workQueue.pop_front(); @@ -1057,7 +1057,7 @@ DocumentObjectExecReturn *Sheet::execute(void) rowHeights.clearDirty(); columnWidths.clearDirty(); - if (cellErrors.size() == 0) + if (cellErrors.empty()) return DocumentObject::StdReturn; else return new DocumentObjectExecReturn("One or more cells failed contains errors.", this); @@ -1070,7 +1070,7 @@ DocumentObjectExecReturn *Sheet::execute(void) short Sheet::mustExecute(void) const { - if (cellErrors.size() > 0 || cells.isDirty()) + if (!cellErrors.empty() || cells.isDirty()) return 1; return DocumentObject::mustExecute(); } @@ -1381,13 +1381,13 @@ void Sheet::setAlias(CellAddress address, const std::string &alias) { std::string existingAlias = getAddressFromAlias(alias); - if (existingAlias.size() > 0) { + if (!existingAlias.empty()) { if (existingAlias == address.toString()) // Same as old? return; else throw Base::ValueError("Alias already defined"); } - else if (alias.size() == 0) // Empty? + else if (alias.empty()) // Empty? cells.setAlias(address, ""); else if (isValidAlias(alias)) // Valid? cells.setAlias(address, alias); @@ -1427,7 +1427,7 @@ bool Sheet::isValidAlias(const std::string & candidate) return false; // Existing alias? Then it's ok - if (getAddressFromAlias(candidate).size() > 0 ) + if (!getAddressFromAlias(candidate).empty() ) return true; // Check to see that is does not crash with any other property in the Sheet object. diff --git a/src/Mod/Spreadsheet/App/SheetPyImp.cpp b/src/Mod/Spreadsheet/App/SheetPyImp.cpp index 0e0bc30f8f..012786afab 100644 --- a/src/Mod/Spreadsheet/App/SheetPyImp.cpp +++ b/src/Mod/Spreadsheet/App/SheetPyImp.cpp @@ -71,7 +71,7 @@ PyObject* SheetPy::set(PyObject *args) std::string cellAddress = sheet->getAddressFromAlias(address).c_str(); /* Check to see if address is really an alias first */ - if (cellAddress.size() > 0) + if (!cellAddress.empty()) sheet->setCell(cellAddress.c_str(), contents); else { Range rangeIter(address); @@ -544,7 +544,7 @@ PyObject* SheetPy::getCellFromAlias(PyObject *args) try { std::string address = getSheetPtr()->getAddressFromAlias(alias); - if (address.size() > 0) + if (!address.empty()) return Py::new_reference_to( Py::String( address ) ); else { Py_INCREF(Py_None); @@ -622,7 +622,7 @@ PyObject* SheetPy::setAlignment(PyObject *args) tokenizer > tok(line, e); for(tokenizer >::iterator i = tok.begin(); i != tok.end();++i) { - if(i->size()) + if(!i->->empty()) alignment = Cell::decodeAlignment(*i, alignment); } } diff --git a/src/Mod/Spreadsheet/App/Utils.cpp b/src/Mod/Spreadsheet/App/Utils.cpp index f651c9e61f..f20ae7aced 100644 --- a/src/Mod/Spreadsheet/App/Utils.cpp +++ b/src/Mod/Spreadsheet/App/Utils.cpp @@ -74,7 +74,7 @@ std::string Spreadsheet::rowName(int row) void Spreadsheet::createRectangles(std::set > & cells, std::map, std::pair > & rectangles) { - while (cells.size() != 0) { + while (!cells.empty()) { int row, col; int orgRow; int rows = 1; diff --git a/src/Mod/Spreadsheet/Gui/Command.cpp b/src/Mod/Spreadsheet/Gui/Command.cpp index dc6e5b78cc..2a6e2e96f1 100644 --- a/src/Mod/Spreadsheet/Gui/Command.cpp +++ b/src/Mod/Spreadsheet/Gui/Command.cpp @@ -87,7 +87,7 @@ void CmdSpreadsheetMergeCells::activated(int iMsg) std::vector ranges = sheetView->selectedRanges(); // Execute mergeCells commands - if (ranges.size() > 0) { + if (!ranges.empty()) { Gui::Command::openCommand(QT_TRANSLATE_NOOP("Command", "Merge cells")); std::vector::const_iterator i = ranges.begin(); for (; i != ranges.end(); ++i) @@ -311,7 +311,7 @@ void CmdSpreadsheetAlignLeft::activated(int iMsg) Sheet * sheet = sheetView->getSheet(); std::vector ranges = sheetView->selectedRanges(); - if (ranges.size() > 0) { + if (!ranges.empty()) { std::vector::const_iterator i = ranges.begin(); Gui::Command::openCommand(QT_TRANSLATE_NOOP("Command", "Left-align cell")); @@ -363,7 +363,7 @@ void CmdSpreadsheetAlignCenter::activated(int iMsg) Sheet * sheet = sheetView->getSheet(); std::vector ranges = sheetView->selectedRanges(); - if (ranges.size() > 0) { + if (!ranges.empty()) { std::vector::const_iterator i = ranges.begin(); Gui::Command::openCommand(QT_TRANSLATE_NOOP("Command", "Center cell")); @@ -415,7 +415,7 @@ void CmdSpreadsheetAlignRight::activated(int iMsg) Sheet * sheet = sheetView->getSheet(); std::vector ranges = sheetView->selectedRanges(); - if (ranges.size() > 0) { + if (!ranges.empty()) { std::vector::const_iterator i = ranges.begin(); Gui::Command::openCommand(QT_TRANSLATE_NOOP("Command", "Right-align cell")); @@ -467,7 +467,7 @@ void CmdSpreadsheetAlignTop::activated(int iMsg) Sheet * sheet = sheetView->getSheet(); std::vector ranges = sheetView->selectedRanges(); - if (ranges.size() > 0) { + if (!ranges.empty()) { std::vector::const_iterator i = ranges.begin(); Gui::Command::openCommand(QT_TRANSLATE_NOOP("Command", "Top-align cell")); @@ -519,7 +519,7 @@ void CmdSpreadsheetAlignBottom::activated(int iMsg) Sheet * sheet = sheetView->getSheet(); std::vector ranges = sheetView->selectedRanges(); - if (ranges.size() > 0) { + if (!ranges.empty()) { std::vector::const_iterator i = ranges.begin(); Gui::Command::openCommand(QT_TRANSLATE_NOOP("Command", "Bottom-align cell")); @@ -571,7 +571,7 @@ void CmdSpreadsheetAlignVCenter::activated(int iMsg) Sheet * sheet = sheetView->getSheet(); std::vector ranges = sheetView->selectedRanges(); - if (ranges.size() > 0) { + if (!ranges.empty()) { std::vector::const_iterator i = ranges.begin(); Gui::Command::openCommand(QT_TRANSLATE_NOOP("Command", "Vertically center cells")); @@ -623,7 +623,7 @@ void CmdSpreadsheetStyleBold::activated(int iMsg) Sheet * sheet = sheetView->getSheet(); QModelIndexList selection = sheetView->selectedIndexes(); - if (selection.size() > 0) { + if (!selection.empty()) { bool allBold = true; for (QModelIndexList::const_iterator it = selection.cbegin(); it != selection.cend(); ++it) { @@ -697,7 +697,7 @@ void CmdSpreadsheetStyleItalic::activated(int iMsg) Sheet * sheet = sheetView->getSheet(); QModelIndexList selection = sheetView->selectedIndexes(); - if (selection.size() > 0) { + if (!selection.empty()) { bool allItalic = true; for (QModelIndexList::const_iterator it = selection.cbegin(); it != selection.cend(); ++it) { @@ -771,7 +771,7 @@ void CmdSpreadsheetStyleUnderline::activated(int iMsg) Sheet * sheet = sheetView->getSheet(); QModelIndexList selection = sheetView->selectedIndexes(); - if (selection.size() > 0) { + if (!selection.empty()) { bool allUnderline = true; for (QModelIndexList::const_iterator it = selection.cbegin(); it != selection.cend(); ++it) { diff --git a/src/Mod/Spreadsheet/Gui/PropertiesDialog.cpp b/src/Mod/Spreadsheet/Gui/PropertiesDialog.cpp index 325cf9e797..ccbc7411d1 100644 --- a/src/Mod/Spreadsheet/Gui/PropertiesDialog.cpp +++ b/src/Mod/Spreadsheet/Gui/PropertiesDialog.cpp @@ -224,7 +224,7 @@ PropertiesDialog::~PropertiesDialog() void PropertiesDialog::apply() { - if (ranges.size() > 0) { + if (!ranges.empty()) { Gui::Command::openCommand(QT_TRANSLATE_NOOP("Command", "Set cell properties")); std::vector::const_iterator i = ranges.begin(); bool changes = false; diff --git a/src/Mod/Spreadsheet/Gui/SheetModel.cpp b/src/Mod/Spreadsheet/Gui/SheetModel.cpp index d1a57d92a4..bcde0eff56 100644 --- a/src/Mod/Spreadsheet/Gui/SheetModel.cpp +++ b/src/Mod/Spreadsheet/Gui/SheetModel.cpp @@ -224,7 +224,7 @@ QVariant SheetModel::data(const QModelIndex &index, int role) const if(cell->getExpression()) { std::string str; if (cell->getStringContent(str)) - if (str.size() > 0 && str[0] == '=') + if (!str.empty() && str[0] == '=') // If this is a real computed value, indicate that a recompute is // needed before we can display it return QVariant(QLatin1String("#PENDING")); diff --git a/src/Mod/Spreadsheet/Gui/SheetTableView.cpp b/src/Mod/Spreadsheet/Gui/SheetTableView.cpp index cf9f27d709..bfea091ed4 100644 --- a/src/Mod/Spreadsheet/Gui/SheetTableView.cpp +++ b/src/Mod/Spreadsheet/Gui/SheetTableView.cpp @@ -223,7 +223,7 @@ void SheetTableView::onRecompute() { void SheetTableView::onBind() { auto ranges = selectedRanges(); - if(ranges.size()>=1 && ranges.size()<=2) { + if(!ranges.empty() && ranges.size()<=2) { DlgBindSheet dlg(sheet,ranges,this); dlg.exec(); } @@ -599,7 +599,7 @@ void SheetTableView::deleteSelection() { QModelIndexList selection = selectionModel()->selectedIndexes(); - if (selection.size() > 0) { + if (!selection.empty()) { Gui::Command::openCommand(QT_TRANSLATE_NOOP("Command", "Clear cell(s)")); std::vector ranges = selectedRanges(); std::vector::const_iterator i = ranges.begin(); @@ -672,7 +672,7 @@ void SheetTableView::pasteClipboard() ranges = sheet->getCopyOrCutRange(copy); } - if(ranges.size()) + if(!ranges.empty()) _copySelection(ranges, copy); const QMimeData* mimeData = QApplication::clipboard()->mimeData(); @@ -1004,7 +1004,7 @@ void SheetTableView::contextMenuEvent(QContextMenuEvent *) } auto ranges = selectedRanges(); - actionBind->setEnabled(ranges.size()>=1 && ranges.size()<=2); + actionBind->setEnabled(!ranges.empty() && ranges.size()<=2); contextMenu->exec(QCursor::pos()); } diff --git a/src/Mod/Spreadsheet/Gui/SpreadsheetView.cpp b/src/Mod/Spreadsheet/Gui/SpreadsheetView.cpp index 07174cd965..24e94b7881 100644 --- a/src/Mod/Spreadsheet/Gui/SpreadsheetView.cpp +++ b/src/Mod/Spreadsheet/Gui/SpreadsheetView.cpp @@ -118,11 +118,11 @@ SheetView::SheetView(Gui::Document *pcDocument, App::DocumentObject *docObj, QWi ui->cells->setPalette(palette); QList bgList = Gui::getMainWindow()->findChildren(QString::fromLatin1("Spreadsheet_BackgroundColor")); - if (bgList.size() > 0) + if (!bgList.empty()) bgList[0]->setCurrentColor(palette.color(QPalette::Base)); QList fgList = Gui::getMainWindow()->findChildren(QString::fromLatin1("Spreadsheet_ForegroundColor")); - if (fgList.size() > 0) + if (!fgList.empty()) fgList[0]->setCurrentColor(palette.color(QPalette::Text)); // Set document object to create auto completer @@ -312,7 +312,7 @@ void SheetView::updateAliasLine() void SheetView::columnResizeFinished() { - if (newColumnSizes.size() == 0) + if (newColumnSizes.empty()) return; blockSignals(true); @@ -324,7 +324,7 @@ void SheetView::columnResizeFinished() void SheetView::rowResizeFinished() { - if (newRowSizes.size() == 0) + if (newRowSizes.empty()) return; blockSignals(true); diff --git a/src/Mod/Spreadsheet/Gui/Workbench.cpp b/src/Mod/Spreadsheet/Gui/Workbench.cpp index b7c2a4a978..2d3a92271a 100644 --- a/src/Mod/Spreadsheet/Gui/Workbench.cpp +++ b/src/Mod/Spreadsheet/Gui/Workbench.cpp @@ -78,7 +78,7 @@ void Workbench::activated() QPalette palette = Gui::getMainWindow()->palette(); QList fgList = Gui::getMainWindow()->findChildren(QString::fromLatin1("Spreadsheet_ForegroundColor")); - if (fgList.size() > 0) + if (!fgList.empty()) foregroundColor = fgList[0]; else { foregroundColor = new QtColorPicker(); @@ -93,7 +93,7 @@ void Workbench::activated() bar->addWidget(foregroundColor); QList bgList = Gui::getMainWindow()->findChildren(QString::fromLatin1("Spreadsheet_BackgroundColor")); - if (bgList.size() > 0) + if (!bgList.empty()) backgroundColor = bgList[0]; else { backgroundColor = new QtColorPicker(); @@ -125,7 +125,7 @@ void WorkbenchHelper::setForegroundColor(const QColor & color) std::vector ranges = sheetView->selectedRanges(); // Execute mergeCells commands - if (ranges.size() > 0) { + if (!ranges.empty()) { std::vector::const_iterator i = ranges.begin(); Gui::Command::openCommand(QT_TRANSLATE_NOOP("Command", "Set foreground color")); @@ -152,7 +152,7 @@ void WorkbenchHelper::setBackgroundColor(const QColor & color) std::vector ranges = sheetView->selectedRanges(); // Execute mergeCells commands - if (ranges.size() > 0) { + if (!ranges.empty()) { std::vector::const_iterator i = ranges.begin(); Gui::Command::openCommand(QT_TRANSLATE_NOOP("Command", "Set background color")); diff --git a/src/Mod/TechDraw/App/AppTechDrawPy.cpp b/src/Mod/TechDraw/App/AppTechDrawPy.cpp index 36a03e7752..a74b8c8ecf 100644 --- a/src/Mod/TechDraw/App/AppTechDrawPy.cpp +++ b/src/Mod/TechDraw/App/AppTechDrawPy.cpp @@ -392,7 +392,7 @@ private: if(ew.perform()) { std::vector rw = ew.getResultNoDups(); std::vector sortedWires = ew.sortStrip(rw,true); - if(sortedWires.size()) { + if(!sortedWires.empty()) { outerWire = new TopoShapeWirePy(new TopoShape(*sortedWires.begin())); success = true; } diff --git a/src/Mod/TechDraw/App/DrawUtil.cpp b/src/Mod/TechDraw/App/DrawUtil.cpp index 4e85bd1716..1370cb281b 100644 --- a/src/Mod/TechDraw/App/DrawUtil.cpp +++ b/src/Mod/TechDraw/App/DrawUtil.cpp @@ -848,7 +848,7 @@ unsigned int DrawUtil::intervalMerge(std::vector> &marki unsigned int i = 0; bool last = false; - if (wraps && marking.size() > 0) { + if (wraps && !marking.empty()) { last = marking.back().second; } diff --git a/src/Mod/TechDraw/App/DrawViewDimExtent.cpp b/src/Mod/TechDraw/App/DrawViewDimExtent.cpp index a0942cbd8f..adc05b7f22 100644 --- a/src/Mod/TechDraw/App/DrawViewDimExtent.cpp +++ b/src/Mod/TechDraw/App/DrawViewDimExtent.cpp @@ -164,7 +164,7 @@ std::vector DrawViewDimExtent::getSubNames(void) { std::vector edgeNames = Source.getSubValues(); if (edgeNames.empty() || - edgeNames[0].size() != 0) { + !edgeNames[0].empty()) { return std::vector(); //garbage first entry - nop } return edgeNames; @@ -184,7 +184,7 @@ pointPair DrawViewDimExtent::getPointsTwoVerts() } std::vector cTags = CosmeticTags.getValues(); - if (cTags.size() < 1) { + if (cTags.empty()) { return errorValue; } @@ -206,7 +206,7 @@ bool DrawViewDimExtent::checkReferences2D() const } std::vector cTags = CosmeticTags.getValues(); - if (cTags.size() < 1) { + if (cTags.empty()) { return false; } diff --git a/src/Mod/TechDraw/App/EdgeWalker.cpp b/src/Mod/TechDraw/App/EdgeWalker.cpp index 1c6fca9b27..0657b19d15 100644 --- a/src/Mod/TechDraw/App/EdgeWalker.cpp +++ b/src/Mod/TechDraw/App/EdgeWalker.cpp @@ -376,7 +376,7 @@ std::vector EdgeWalker::sortStrip(std::vector fw, bool } } std::vector sortedWires = sortWiresBySize(closedWires,false); //biggest 1st - if (!sortedWires.size()) { + if (sortedWires.empty()) { Base::Console().Log("INFO - EW::sortStrip - no sorted Wires!\n"); return sortedWires; // might happen in the middle of changes? } diff --git a/src/Mod/TechDraw/Gui/Command.cpp b/src/Mod/TechDraw/Gui/Command.cpp index f5a78c143b..df734f1e7b 100644 --- a/src/Mod/TechDraw/Gui/Command.cpp +++ b/src/Mod/TechDraw/Gui/Command.cpp @@ -399,7 +399,7 @@ void CmdTechDrawView::activated(int iMsg) } dvp->Source.setValues(shapes); dvp->XSource.setValues(xShapes); - if (faceName.size()) { + if (!faceName.empty()) { std::pair dirs = DrawGuiUtil::getProjDirFromFace(partObj, faceName); projDir = dirs.first; getDocument()->setStatus(App::Document::Status::SkipRecompute, true); @@ -677,7 +677,7 @@ void CmdTechDrawProjectionGroup::activated(int iMsg) multiView->XSource.setValues(xShapes); doCommand(Doc, "App.activeDocument().%s.addProjection('Front')", multiViewName.c_str()); - if (faceName.size()) { + if (!faceName.empty()) { std::pair dirs = DrawGuiUtil::getProjDirFromFace(partObj, faceName); getDocument()->setStatus(App::Document::Status::SkipRecompute, true); doCommand(Doc, "App.activeDocument().%s.Anchor.Direction = FreeCAD.Vector(%.3f,%.3f,%.3f)", @@ -779,7 +779,7 @@ bool CmdTechDrawProjectionGroup::isActive(void) //non-empty selection, no more than maxObjs selected and at least 1 DrawingPage exists bool _checkSelectionBalloon(Gui::Command* cmd, unsigned maxObjs) { std::vector selection = cmd->getSelection().getSelectionEx(); - if (selection.size() == 0) { + if (selection.empty()) { QMessageBox::warning(Gui::getMainWindow(), QObject::tr("Incorrect selection"), QObject::tr("Select an object first")); return false; diff --git a/src/Mod/TechDraw/Gui/CommandCreateDims.cpp b/src/Mod/TechDraw/Gui/CommandCreateDims.cpp index c38f4b1e4f..c38c32bf3c 100644 --- a/src/Mod/TechDraw/Gui/CommandCreateDims.cpp +++ b/src/Mod/TechDraw/Gui/CommandCreateDims.cpp @@ -1426,7 +1426,7 @@ void CreateTechDrawCommandsDims(void) //non-empty selection, no more than maxObjs selected and at least 1 DrawingPage exists bool _checkSelection(Gui::Command* cmd, unsigned maxObjs) { std::vector selection = cmd->getSelection().getSelectionEx(); - if (selection.size() == 0) { + if (selection.empty()) { QMessageBox::warning(Gui::getMainWindow(), QObject::tr("Incorrect selection"), QObject::tr("Select an object first")); return false; diff --git a/src/Mod/TechDraw/Gui/CommandDecorate.cpp b/src/Mod/TechDraw/Gui/CommandDecorate.cpp index 929d8bb0a1..52558dc7a5 100644 --- a/src/Mod/TechDraw/Gui/CommandDecorate.cpp +++ b/src/Mod/TechDraw/Gui/CommandDecorate.cpp @@ -360,7 +360,7 @@ void CreateTechDrawCommandsDecorate(void) bool _checkSelectionHatch(Gui::Command* cmd) { std::vector selection = cmd->getSelection().getSelectionEx(); - if (selection.size() == 0) { + if (selection.empty()) { QMessageBox::warning(Gui::getMainWindow(), QObject::tr("Incorrect selection"), QObject::tr("Select a Face first")); return false; diff --git a/src/Mod/TechDraw/Gui/QGIViewAnnotation.cpp b/src/Mod/TechDraw/Gui/QGIViewAnnotation.cpp index c0c874df64..ec116b5b74 100644 --- a/src/Mod/TechDraw/Gui/QGIViewAnnotation.cpp +++ b/src/Mod/TechDraw/Gui/QGIViewAnnotation.cpp @@ -195,7 +195,7 @@ void QGIViewAnnotation::mouseDoubleClickEvent(QGraphicsSceneMouseEvent* event) const std::vector &values = annotation->Text.getValues(); QString text; - if (values.size() > 0) { + if (!values.empty()) { text = QString::fromUtf8(values[0].c_str()); for (unsigned int i = 1; i < values.size(); ++i) { diff --git a/src/Mod/TechDraw/Gui/QGIViewDimension.cpp b/src/Mod/TechDraw/Gui/QGIViewDimension.cpp index 7542c08e0d..8b211d6d92 100644 --- a/src/Mod/TechDraw/Gui/QGIViewDimension.cpp +++ b/src/Mod/TechDraw/Gui/QGIViewDimension.cpp @@ -974,7 +974,7 @@ double QGIViewDimension::computeArcStrikeFactor(const Base::BoundBox2d &labelRec const Base::Vector2d &arcCenter, double arcRadius, const std::vector> &drawMarking) { - if (drawMarking.size() < 1) { + if (drawMarking.empty()) { return 0.0; } @@ -1312,7 +1312,7 @@ void QGIViewDimension::drawSingleArc(QPainterPath &painterPath, const Base::Vect void QGIViewDimension::drawMultiArc(QPainterPath &painterPath, const Base::Vector2d &arcCenter, double arcRadius, const std::vector> &drawMarking) const { - if (drawMarking.size() < 1) { + if (drawMarking.empty()) { return; } diff --git a/src/Mod/TechDraw/Gui/QGSPage.cpp b/src/Mod/TechDraw/Gui/QGSPage.cpp index 6d7db4feea..d3756c22fa 100644 --- a/src/Mod/TechDraw/Gui/QGSPage.cpp +++ b/src/Mod/TechDraw/Gui/QGSPage.cpp @@ -556,7 +556,7 @@ QGIView *QGSPage::findParent(QGIView *view) const if (dim) { std::vector objs = dim->References2D.getValues(); - if (objs.size() > 0) { + if (!objs.empty()) { std::vector objs = dim->References2D.getValues(); // Attach the dimension to the first object's group for (std::vector::const_iterator it = qviews.begin(); it != qviews.end(); ++it) { diff --git a/src/Mod/TechDraw/Gui/QGTracker.cpp b/src/Mod/TechDraw/Gui/QGTracker.cpp index b5974a04b6..9ca74313a0 100644 --- a/src/Mod/TechDraw/Gui/QGTracker.cpp +++ b/src/Mod/TechDraw/Gui/QGTracker.cpp @@ -201,7 +201,7 @@ void QGTracker::sleep(bool b) QPointF QGTracker::snapToAngle(QPointF dumbPt) { // If no point selected yet, snapping has no sense - if (m_points.size() < 1) + if (m_points.empty()) return dumbPt; QPointF result(dumbPt); diff --git a/src/Mod/TechDraw/Gui/TaskLinkDim.cpp b/src/Mod/TechDraw/Gui/TaskLinkDim.cpp index cab406b9fb..7cc34ac1ca 100644 --- a/src/Mod/TechDraw/Gui/TaskLinkDim.cpp +++ b/src/Mod/TechDraw/Gui/TaskLinkDim.cpp @@ -154,7 +154,7 @@ bool TaskLinkDim::dimReferencesSelection(const TechDraw::DrawViewDimension* dim) return false; } - if(refParts.size() == 0) { + if(refParts.empty()) { //shouldn't happen! } else if (refParts.size() == 1) { if ((refParts[0] == m_parts[0]) &&