forked from qt-creator/qt-creator
Utils: Make port.h slimmer
Fix the fallout. Also make comparisons hidden friends. Change-Id: Ib16a294391f5732f94f9f411a48220b497691de2 Reviewed-by: Alessandro Portale <alessandro.portale@qt.io> Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
This commit is contained in:
@@ -25,8 +25,11 @@
|
||||
|
||||
#include "port.h"
|
||||
|
||||
#include "qtcassert.h"
|
||||
#include "stringutils.h"
|
||||
|
||||
#include <limits>
|
||||
|
||||
/*! \class Utils::Port
|
||||
|
||||
\brief The Port class implements a wrapper around a 16 bit port number
|
||||
@@ -35,6 +38,21 @@
|
||||
|
||||
namespace Utils {
|
||||
|
||||
Port::Port(int port)
|
||||
: m_port((port < 0 || port > std::numeric_limits<quint16>::max()) ? -1 : port)
|
||||
{
|
||||
}
|
||||
|
||||
Port::Port(uint port)
|
||||
: m_port(port > std::numeric_limits<quint16>::max() ? -1 : port)
|
||||
{
|
||||
}
|
||||
|
||||
quint16 Port::number() const
|
||||
{
|
||||
QTC_ASSERT(isValid(), return -1); return quint16(m_port);
|
||||
}
|
||||
|
||||
QList<Port> Port::parseFromSedOutput(const QByteArray &output)
|
||||
{
|
||||
QList<Port> ports;
|
||||
|
||||
Reference in New Issue
Block a user