diff options
author | Timur Pocheptsov <timur.pocheptsov@qt.io> | 2020-07-22 14:23:20 +0200 |
---|---|---|
committer | Timur Pocheptsov <timur.pocheptsov@qt.io> | 2020-07-28 12:38:15 +0200 |
commit | 1482739002f7dfca398ddc850c0bc1e0f4893ddd (patch) | |
tree | 9623404364027482ca5460e1d3caf9af4e095420 /src/network/kernel | |
parent | 83f00b82298cf8fbba8baa7b983ff177f74a6642 (diff) |
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>
Diffstat (limited to 'src/network/kernel')
-rw-r--r-- | src/network/kernel/qhostaddress.cpp | 61 | ||||
-rw-r--r-- | src/network/kernel/qhostaddress.h | 9 |
2 files changed, 2 insertions, 68 deletions
diff --git a/src/network/kernel/qhostaddress.cpp b/src/network/kernel/qhostaddress.cpp index c318766796..007608dd68 100644 --- a/src/network/kernel/qhostaddress.cpp +++ b/src/network/kernel/qhostaddress.cpp @@ -423,18 +423,6 @@ QHostAddress::QHostAddress(quint32 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 @@ -592,20 +566,6 @@ void QHostAddress::setAddress(quint32 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 Set the IPv6 address specified by \a ip6Addr. @@ -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() diff --git a/src/network/kernel/qhostaddress.h b/src/network/kernel/qhostaddress.h index 6f83bdef05..82790fa28d 100644 --- a/src/network/kernel/qhostaddress.h +++ b/src/network/kernel/qhostaddress.h @@ -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; |