fix some occurrences where size() is misused as Boolean
- as suggested by @wwmayer: 4d51d1d0b1 (r69648152)
This commit is contained in:
@@ -1817,7 +1817,7 @@ void CmdFemPostPipelineFromResult::activated(int)
|
||||
Fem::FemAnalysis* pcAnalysis;
|
||||
std::string FeatName = getUniqueObjectName("ResultPipeline");
|
||||
auto parents = results[0]->getInList();
|
||||
if (parents.size()) {
|
||||
if (!parents.empty()) {
|
||||
for (auto parentObject : parents) {
|
||||
if (parentObject->getTypeId() == Base::Type::fromName("Fem::FemAnalysis")) {
|
||||
pcAnalysis = static_cast<Fem::FemAnalysis*>(parentObject);
|
||||
|
||||
@@ -430,7 +430,7 @@ void ViewProviderFemPostObject::WritePointData(vtkPoints* points, vtkDataArray*
|
||||
|
||||
// we must inherit the Scale of parent meshes (for example for clip filters)
|
||||
auto parents = pcObject->getInList();
|
||||
if (parents.size()) {
|
||||
if (!parents.empty()) {
|
||||
for (auto itParents = parents.begin(); itParents != parents.end(); ++itParents) {
|
||||
if ((*itParents)->getTypeId() == Base::Type::fromName("Fem::FemPostPipeline")) {
|
||||
auto vpObject = dynamic_cast<FemGui::ViewProviderFemPostObject*>(
|
||||
|
||||
@@ -513,7 +513,7 @@ void SectionCut::startCutting(bool isInitial)
|
||||
|
||||
// if the object is part of an App::Part container, the link needs to get the container placement
|
||||
auto parents = (*itCuts)->getInList();
|
||||
if (parents.size()) {
|
||||
if (!parents.empty()) {
|
||||
for (auto itParents = parents.begin(); itParents != parents.end(); ++itParents) {
|
||||
if ((*itParents)->getTypeId() == Base::Type::fromName("App::Part")) {
|
||||
App::Part* pcPartParent = static_cast<App::Part*>((*itParents));
|
||||
|
||||
@@ -972,7 +972,8 @@ void TaskAttacher::visibilityAutomation(bool opening_not_closing)
|
||||
QString::fromLatin1(editSubName.c_str()),
|
||||
QString::fromLatin1(postfix.c_str()));
|
||||
Gui::Command::runCommand(Gui::Command::Gui,code.toLatin1().constData());
|
||||
} else if(postfix.size()) {
|
||||
}
|
||||
else if (!postfix.empty()) {
|
||||
QString code = QString::fromLatin1(
|
||||
"_tv_%1.restore()\n"
|
||||
"del(_tv_%1)"
|
||||
|
||||
@@ -167,7 +167,7 @@ Part::Feature* ProfileBased::getVerifiedObject(bool silent) const {
|
||||
Part::TopoShape ProfileBased::getProfileShape() const
|
||||
{
|
||||
auto shape = getTopoShape(Profile.getValue());
|
||||
if (!shape.isNull() && Profile.getSubValues().size()) {
|
||||
if (!shape.isNull() && !Profile.getSubValues().empty()) {
|
||||
std::vector<Part::TopoShape> shapes;
|
||||
for (auto& sub : Profile.getSubValues(true))
|
||||
shapes.emplace_back(shape.getSubShape(sub.c_str()));
|
||||
|
||||
@@ -479,17 +479,17 @@ void SubShapeBinder::update(SubShapeBinder::UpdateOption options) {
|
||||
if(!Relative.getValue())
|
||||
parent = nullptr;
|
||||
else {
|
||||
if(parent && parent->getSubObject(parentSub.c_str())==this) {
|
||||
if (parent && parent->getSubObject(parentSub.c_str())==this) {
|
||||
auto parents = parent->getParents();
|
||||
if(parents.size()) {
|
||||
if (!parents.empty()) {
|
||||
parent = parents.begin()->first;
|
||||
parentSub = parents.begin()->second + parentSub;
|
||||
}
|
||||
} else
|
||||
parent = nullptr;
|
||||
if(!parent && parentSub.empty()) {
|
||||
if (!parent && parentSub.empty()) {
|
||||
auto parents = getParents();
|
||||
if(parents.size()) {
|
||||
if(!parents.empty()) {
|
||||
parent = parents.begin()->first;
|
||||
parentSub = parents.begin()->second;
|
||||
}
|
||||
@@ -561,7 +561,7 @@ void SubShapeBinder::update(SubShapeBinder::UpdateOption options) {
|
||||
auto tmpDoc = App::GetApplication().newDocument(
|
||||
"_tmp_binder", nullptr, false, true);
|
||||
auto objs = tmpDoc->copyObject({obj},true,true);
|
||||
if(objs.size()) {
|
||||
if (!objs.empty()) {
|
||||
for(auto it=objs.rbegin(); it!=objs.rend(); ++it)
|
||||
_CopiedObjs.emplace_back(*it);
|
||||
copied = objs.back();
|
||||
@@ -648,7 +648,7 @@ void SubShapeBinder::update(SubShapeBinder::UpdateOption options) {
|
||||
|
||||
if(!init) {
|
||||
|
||||
if(errMsg.size()) {
|
||||
if (!errMsg.empty()) {
|
||||
if(!(options & UpdateInit))
|
||||
FC_THROWM(Base::RuntimeError, errMsg);
|
||||
if(!Shape.getValue().IsNull())
|
||||
@@ -706,7 +706,7 @@ void SubShapeBinder::update(SubShapeBinder::UpdateOption options) {
|
||||
else
|
||||
solids.push_back(s.getShape());
|
||||
}
|
||||
if(solids.size()) {
|
||||
if (!solids.empty()) {
|
||||
result = solid.fuse(solids);
|
||||
fused = true;
|
||||
} else if (!solid.isNull()) {
|
||||
@@ -819,7 +819,7 @@ void SubShapeBinder::onChanged(const App::Property *prop) {
|
||||
if(prop == &Support) {
|
||||
clearCopiedObjects();
|
||||
setupCopyOnChange();
|
||||
if(Support.getSubListValues().size()) {
|
||||
if (!Support.getSubListValues().empty()) {
|
||||
update();
|
||||
if(BindMode.getValue() == 2)
|
||||
Support.setValue(nullptr);
|
||||
|
||||
Reference in New Issue
Block a user