QHostAddress: resolve API issues marked with ##Qt6
Also, remove the deprecated function and its auto-test. Change-Id: If04a54c4b91e0f76523960c7b1a5bcb8fe883ac6 Reviewed-by: Edward Welbourne <edward.welbourne@qt.io> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
This commit is contained in:
parent
83f00b8229
commit
1482739002
src/network/kernel
tests/auto/network/kernel/qhostaddress
@ -422,18 +422,6 @@ QHostAddress::QHostAddress(quint32 ip4Addr)
|
||||
setAddress(ip4Addr);
|
||||
}
|
||||
|
||||
/*!
|
||||
Constructs a host address object with the IPv6 address \a ip6Addr.
|
||||
|
||||
\a ip6Addr must be a 16-byte array in network byte order (big
|
||||
endian).
|
||||
*/
|
||||
QHostAddress::QHostAddress(quint8 *ip6Addr)
|
||||
: d(new QHostAddressPrivate)
|
||||
{
|
||||
setAddress(ip6Addr);
|
||||
}
|
||||
|
||||
/*!
|
||||
\since 5.5
|
||||
Constructs a host address object with the IPv6 address \a ip6Addr.
|
||||
@ -519,20 +507,6 @@ QHostAddress &QHostAddress::operator=(const QHostAddress &address)
|
||||
return *this;
|
||||
}
|
||||
|
||||
#if QT_DEPRECATED_SINCE(5, 8)
|
||||
/*!
|
||||
Assigns the host address \a address to this object, and returns a
|
||||
reference to this object.
|
||||
|
||||
\sa setAddress()
|
||||
*/
|
||||
QHostAddress &QHostAddress::operator=(const QString &address)
|
||||
{
|
||||
setAddress(address);
|
||||
return *this;
|
||||
}
|
||||
#endif
|
||||
|
||||
/*!
|
||||
\since 5.8
|
||||
Assigns the special address \a address to this object, and returns a
|
||||
@ -590,20 +564,6 @@ void QHostAddress::setAddress(quint32 ip4Addr)
|
||||
d->setAddress(ip4Addr);
|
||||
}
|
||||
|
||||
/*!
|
||||
\overload
|
||||
|
||||
Set the IPv6 address specified by \a ip6Addr.
|
||||
|
||||
\a ip6Addr must be an array of 16 bytes in network byte order
|
||||
(high-order byte first).
|
||||
*/
|
||||
void QHostAddress::setAddress(quint8 *ip6Addr)
|
||||
{
|
||||
d.detach();
|
||||
d->setAddress(ip6Addr);
|
||||
}
|
||||
|
||||
/*!
|
||||
\overload
|
||||
\since 5.5
|
||||
@ -715,26 +675,7 @@ void QHostAddress::setAddress(SpecialAddress address)
|
||||
\l{QAbstractSocket::}{IPv4Protocol},
|
||||
or if the protocol is
|
||||
\l{QAbstractSocket::}{IPv6Protocol},
|
||||
and the IPv6 address is an IPv4 mapped address. (RFC4291)
|
||||
|
||||
\sa toString()
|
||||
*/
|
||||
quint32 QHostAddress::toIPv4Address() const
|
||||
{
|
||||
return toIPv4Address(nullptr);
|
||||
}
|
||||
|
||||
/*!
|
||||
Returns the IPv4 address as a number.
|
||||
|
||||
For example, if the address is 127.0.0.1, the returned value is
|
||||
2130706433 (i.e. 0x7f000001).
|
||||
|
||||
This value is valid if the protocol() is
|
||||
\l{QAbstractSocket::}{IPv4Protocol},
|
||||
or if the protocol is
|
||||
\l{QAbstractSocket::}{IPv6Protocol},
|
||||
and the IPv6 address is an IPv4 mapped address. (RFC4291). In those
|
||||
and the IPv6 address is an IPv4 mapped address (RFC4291). In those
|
||||
cases, \a ok will be set to true. Otherwise, it will be set to false.
|
||||
|
||||
\sa toString()
|
||||
|
@ -93,7 +93,6 @@ public:
|
||||
|
||||
QHostAddress();
|
||||
explicit QHostAddress(quint32 ip4Addr);
|
||||
explicit QHostAddress(quint8 *ip6Addr); // ### Qt 6: remove me
|
||||
explicit QHostAddress(const quint8 *ip6Addr);
|
||||
explicit QHostAddress(const Q_IPV6ADDR &ip6Addr);
|
||||
explicit QHostAddress(const sockaddr *address);
|
||||
@ -105,16 +104,11 @@ public:
|
||||
QHostAddress &operator=(QHostAddress &&other) noexcept
|
||||
{ swap(other); return *this; }
|
||||
QHostAddress &operator=(const QHostAddress &other);
|
||||
#if QT_DEPRECATED_SINCE(5, 8)
|
||||
QT_DEPRECATED_X("use = QHostAddress(string) instead")
|
||||
QHostAddress &operator=(const QString &address);
|
||||
#endif
|
||||
QHostAddress &operator=(SpecialAddress address);
|
||||
|
||||
void swap(QHostAddress &other) noexcept { d.swap(other.d); }
|
||||
|
||||
void setAddress(quint32 ip4Addr);
|
||||
void setAddress(quint8 *ip6Addr); // ### Qt 6: remove me
|
||||
void setAddress(const quint8 *ip6Addr);
|
||||
void setAddress(const Q_IPV6ADDR &ip6Addr);
|
||||
void setAddress(const sockaddr *address);
|
||||
@ -122,8 +116,7 @@ public:
|
||||
void setAddress(SpecialAddress address);
|
||||
|
||||
QAbstractSocket::NetworkLayerProtocol protocol() const;
|
||||
quint32 toIPv4Address() const; // ### Qt6: merge with next overload
|
||||
quint32 toIPv4Address(bool *ok) const;
|
||||
quint32 toIPv4Address(bool *ok = nullptr) const;
|
||||
Q_IPV6ADDR toIPv6Address() const;
|
||||
|
||||
QString toString() const;
|
||||
|
@ -364,23 +364,9 @@ void tst_QHostAddress::isEqual()
|
||||
QCOMPARE(second.isEqual(first, QHostAddress::ConversionModeFlag(flags)), result);
|
||||
}
|
||||
|
||||
QT_WARNING_PUSH
|
||||
#ifdef QT_WARNING_DISABLE_DEPRECATED
|
||||
QT_WARNING_DISABLE_DEPRECATED
|
||||
#endif
|
||||
|
||||
void tst_QHostAddress::assignment()
|
||||
{
|
||||
QHostAddress address;
|
||||
|
||||
#if QT_DEPRECATED_SINCE(5, 8)
|
||||
address = "127.0.0.1";
|
||||
QCOMPARE(address, QHostAddress("127.0.0.1"));
|
||||
|
||||
address = "::1";
|
||||
QCOMPARE(address, QHostAddress("::1"));
|
||||
#endif
|
||||
|
||||
QHostAddress addr("4.2.2.1");
|
||||
sockaddr_in sockAddr;
|
||||
sockAddr.sin_family = AF_INET;
|
||||
@ -389,8 +375,6 @@ void tst_QHostAddress::assignment()
|
||||
QCOMPARE(address, addr);
|
||||
}
|
||||
|
||||
QT_WARNING_POP
|
||||
|
||||
void tst_QHostAddress::scopeId()
|
||||
{
|
||||
QHostAddress address("fe80::2e0:4cff:fefb:662a%eth0");
|
||||
|
Loading…
Reference in New Issue
Block a user