forked from qt-creator/qt-creator
DeviceUsedPortsGatherer: Move getNextFreePort() into PortList
Seems more natural place for this function. Change-Id: I09f6776ce946f623e3a512411bb922841c06a47d Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
This commit is contained in:
@@ -168,6 +168,16 @@ Port PortList::getNext()
|
||||
return next;
|
||||
}
|
||||
|
||||
Port PortList::getNextFreePort(const QList<Port> &usedPorts)
|
||||
{
|
||||
while (hasMore()) {
|
||||
const Port port = getNext();
|
||||
if (!usedPorts.contains(port))
|
||||
return port;
|
||||
}
|
||||
return {};
|
||||
}
|
||||
|
||||
QString PortList::toString() const
|
||||
{
|
||||
QString stringRep;
|
||||
|
||||
Reference in New Issue
Block a user