QHostAddress: add missing op!=(SpecialAddress, QHostAddress)

The equality operator was supplied, but this one was missing.

[ChangeLog][QtNetwork][QHostAddress] Added op!=(SpecialAddress, QHostAddress).

Change-Id: Iad9c55fa0ee7a8e97d5e4ea4be0605b8b74649d1
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
This commit is contained in:
Marc Mutz 2017-01-14 09:11:57 +01:00
parent a9603a4088
commit c2cecf08d5
3 changed files with 15 additions and 0 deletions

View File

@ -1258,6 +1258,18 @@ uint qHash(const QHostAddress &key, uint seed) Q_DECL_NOTHROW
\sa isEqual()
*/
/*!
\relates QHostAddress
\since 5.9
\fn operator!=(QHostAddress::SpecialAddress lhs, const QHostAddress &rhs)
Returns \c false if special address \a lhs is the same as host address \a rhs;
otherwise returns \c true.
\sa isEqual()
*/
#ifndef QT_NO_DATASTREAM
/*! \relates QHostAddress

View File

@ -161,6 +161,8 @@ Q_DECLARE_SHARED_NOT_MOVABLE_UNTIL_QT6(QHostAddress)
inline bool operator ==(QHostAddress::SpecialAddress address1, const QHostAddress &address2)
{ return address2 == address1; }
inline bool operator!=(QHostAddress::SpecialAddress lhs, const QHostAddress &rhs)
{ return rhs != lhs; }
#ifndef QT_NO_DEBUG_STREAM
Q_NETWORK_EXPORT QDebug operator<<(QDebug, const QHostAddress &);

View File

@ -274,6 +274,7 @@ void tst_QHostAddress::specialAddresses()
QVERIFY(address == QHostAddress(address));
QVERIFY(!(QHostAddress(address) != QHostAddress(address)));
QVERIFY(!(QHostAddress(address) != address));
QVERIFY(!(address != QHostAddress(address)));
{
QHostAddress ha;