forked from qt-creator/qt-creator
Utils: Consolidate port parsing methods
Change-Id: I137e9faa2c5f18e9ade0e2c59d73811d682abf13 Reviewed-by: Jarek Kobus <jaroslaw.kobus@qt.io> Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
This commit is contained in:
@@ -62,7 +62,6 @@
|
||||
#include <utils/processinterface.h>
|
||||
#include <utils/qtcassert.h>
|
||||
#include <utils/qtcprocess.h>
|
||||
#include <utils/stringutils.h>
|
||||
#include <utils/temporaryfile.h>
|
||||
#include <utils/treemodel.h>
|
||||
#include <utils/utilsicons.h>
|
||||
@@ -587,24 +586,7 @@ PortsGatheringMethod DockerDevice::portsGatheringMethod() const
|
||||
CommandLine::Raw};
|
||||
},
|
||||
|
||||
[](const QByteArray &output) {
|
||||
QList<Utils::Port> ports;
|
||||
const QList<QByteArray> portStrings = output.split('\n');
|
||||
for (const QByteArray &portString : portStrings) {
|
||||
if (portString.size() != 4)
|
||||
continue;
|
||||
bool ok;
|
||||
const Utils::Port port(portString.toInt(&ok, 16));
|
||||
if (ok) {
|
||||
if (!ports.contains(port))
|
||||
ports << port;
|
||||
} else {
|
||||
qWarning("%s: Unexpected string '%s' is not a port.",
|
||||
Q_FUNC_INFO, portString.data());
|
||||
}
|
||||
}
|
||||
return ports;
|
||||
}
|
||||
&Port::parseFromSedOutput
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user