Utils: Replace foreach with range-based for

Change-Id: I9aeea9c029ffc56cbadc04edd20e9b35b154f986
Reviewed-by: hjk <hjk@qt.io>
This commit is contained in:
Orgad Shaneh
2020-06-13 23:39:57 +03:00
committed by Orgad Shaneh
parent afd6eeed3f
commit 51453936cc
34 changed files with 104 additions and 95 deletions

View File

@@ -164,7 +164,7 @@ bool PortList::hasMore() const { return !d->ranges.isEmpty(); }
bool PortList::contains(Port port) const
{
foreach (const Internal::Range &r, d->ranges) {
for (const Internal::Range &r : d->ranges) {
if (port >= r.first && port <= r.second)
return true;
}
@@ -174,7 +174,7 @@ bool PortList::contains(Port port) const
int PortList::count() const
{
int n = 0;
foreach (const Internal::Range &r, d->ranges)
for (const Internal::Range &r : d->ranges)
n += r.second.number() - r.first.number() + 1;
return n;
}
@@ -194,7 +194,7 @@ Port PortList::getNext()
QString PortList::toString() const
{
QString stringRep;
foreach (const Internal::Range &range, d->ranges) {
for (const Internal::Range &range : d->ranges) {
stringRep += QString::number(range.first.number());
if (range.second != range.first)
stringRep += QLatin1Char('-') + QString::number(range.second.number());