Part: use empty() and isEmpty() instead of count() where possible
This commit is contained in:
@@ -151,6 +151,10 @@ int TopoShapeCache::Ancestry::count() const
|
||||
return shapes.Extent();
|
||||
}
|
||||
|
||||
bool TopoShapeCache::Ancestry::empty() const
|
||||
{
|
||||
return shapes.IsEmpty();
|
||||
}
|
||||
|
||||
TopoShapeCache::TopoShapeCache(const TopoDS_Shape& tds)
|
||||
: shape(tds.Located(TopLoc_Location()))
|
||||
|
||||
@@ -114,6 +114,7 @@ public:
|
||||
int find(const TopoDS_Shape& parent, const TopoDS_Shape& subShape);
|
||||
TopoDS_Shape find(const TopoDS_Shape& parent, int index);
|
||||
int count() const;
|
||||
bool empty() const;
|
||||
|
||||
friend TopoShapeCache;
|
||||
};
|
||||
|
||||
@@ -860,7 +860,7 @@ void TopoShape::mapSubElementForShape(const TopoShape& other, const char* op)
|
||||
for (auto type : types) {
|
||||
auto& shapeMap = _cache->getAncestry(type);
|
||||
auto& otherMap = other._cache->getAncestry(type);
|
||||
if ((shapeMap.count() == 0) || (otherMap.count() == 0)) {
|
||||
if ((shapeMap.empty()) || (otherMap.empty())) {
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -1450,7 +1450,7 @@ TopoShape& TopoShape::makeShapeWithElementMap(const TopoDS_Shape& shape,
|
||||
continue;
|
||||
}
|
||||
auto& otherMap = incomingShape._cache->getAncestry(info.type);
|
||||
if (otherMap.count() == 0) {
|
||||
if (otherMap.empty()) {
|
||||
continue;
|
||||
}
|
||||
for (int i = 1; i <= otherMap.count(); i++) {
|
||||
|
||||
@@ -952,7 +952,7 @@ void TaskAttacher::updateListOfModes()
|
||||
//first up, remember currently selected mode.
|
||||
eMapMode curMode = mmDeactivated;
|
||||
auto sel = ui->listOfModes->selectedItems();
|
||||
if (sel.count() > 0)
|
||||
if (!sel.isEmpty())
|
||||
curMode = modesInList[ui->listOfModes->row(sel[0])];
|
||||
|
||||
//obtain list of available modes:
|
||||
@@ -1054,7 +1054,7 @@ void TaskAttacher::selectMapMode(eMapMode mmode) {
|
||||
Attacher::eMapMode TaskAttacher::getActiveMapMode()
|
||||
{
|
||||
auto sel = ui->listOfModes->selectedItems();
|
||||
if (sel.count() > 0)
|
||||
if (!sel.isEmpty())
|
||||
return modesInList[ui->listOfModes->row(sel[0])];
|
||||
else {
|
||||
if (this->lastSuggestResult.message == SuggestResult::srOK)
|
||||
|
||||
Reference in New Issue
Block a user