Mod: use empty

This commit is contained in:
berniev
2022-08-06 02:29:31 +10:00
committed by wwmayer
parent 1cc6329eab
commit b796a0d376
134 changed files with 419 additions and 419 deletions

View File

@@ -392,7 +392,7 @@ private:
if(ew.perform()) {
std::vector<TopoDS_Wire> rw = ew.getResultNoDups();
std::vector<TopoDS_Wire> sortedWires = ew.sortStrip(rw,true);
if(sortedWires.size()) {
if(!sortedWires.empty()) {
outerWire = new TopoShapeWirePy(new TopoShape(*sortedWires.begin()));
success = true;
}

View File

@@ -848,7 +848,7 @@ unsigned int DrawUtil::intervalMerge(std::vector<std::pair<double, bool>> &marki
unsigned int i = 0;
bool last = false;
if (wraps && marking.size() > 0) {
if (wraps && !marking.empty()) {
last = marking.back().second;
}

View File

@@ -164,7 +164,7 @@ std::vector<std::string> DrawViewDimExtent::getSubNames(void)
{
std::vector<std::string> edgeNames = Source.getSubValues();
if (edgeNames.empty() ||
edgeNames[0].size() != 0) {
!edgeNames[0].empty()) {
return std::vector<std::string>(); //garbage first entry - nop
}
return edgeNames;
@@ -184,7 +184,7 @@ pointPair DrawViewDimExtent::getPointsTwoVerts()
}
std::vector<std::string> cTags = CosmeticTags.getValues();
if (cTags.size() < 1) {
if (cTags.empty()) {
return errorValue;
}
@@ -206,7 +206,7 @@ bool DrawViewDimExtent::checkReferences2D() const
}
std::vector<std::string> cTags = CosmeticTags.getValues();
if (cTags.size() < 1) {
if (cTags.empty()) {
return false;
}

View File

@@ -376,7 +376,7 @@ std::vector<TopoDS_Wire> EdgeWalker::sortStrip(std::vector<TopoDS_Wire> fw, bool
}
}
std::vector<TopoDS_Wire> 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?
}

View File

@@ -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<Base::Vector3d, Base::Vector3d> 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<Base::Vector3d, Base::Vector3d> 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<Gui::SelectionObject> 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;

View File

@@ -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<Gui::SelectionObject> 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;

View File

@@ -360,7 +360,7 @@ void CreateTechDrawCommandsDecorate(void)
bool _checkSelectionHatch(Gui::Command* cmd) {
std::vector<Gui::SelectionObject> 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;

View File

@@ -195,7 +195,7 @@ void QGIViewAnnotation::mouseDoubleClickEvent(QGraphicsSceneMouseEvent* event)
const std::vector<std::string> &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) {

View File

@@ -974,7 +974,7 @@ double QGIViewDimension::computeArcStrikeFactor(const Base::BoundBox2d &labelRec
const Base::Vector2d &arcCenter, double arcRadius,
const std::vector<std::pair<double, bool>> &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<std::pair<double, bool>> &drawMarking) const
{
if (drawMarking.size() < 1) {
if (drawMarking.empty()) {
return;
}

View File

@@ -556,7 +556,7 @@ QGIView *QGSPage::findParent(QGIView *view) const
if (dim) {
std::vector<App::DocumentObject *> objs = dim->References2D.getValues();
if (objs.size() > 0) {
if (!objs.empty()) {
std::vector<App::DocumentObject *> objs = dim->References2D.getValues();
// Attach the dimension to the first object's group
for (std::vector<QGIView *>::const_iterator it = qviews.begin(); it != qviews.end(); ++it) {

View File

@@ -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);

View File

@@ -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]) &&