QHostAddress: add missing docs

qHash(QHostAddress) was added in Qt 5.0 (at least the version with uint seed = 0).

op==(QHostAddress::SpecialAddress, QHostAddress) was there since QHostAddress was
added before public history. Since QHostAddress does not have a \since, the I did
not supply one for op==, either.

Since the equality operator did not have unit-tests, added one.

Change-Id: I954a0df02464338f08a12ca58d4cc0ceb013e67a
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
bb10
Marc Mutz 2017-01-14 09:02:03 +01:00
parent 21306bccc4
commit 4baf08653c
2 changed files with 15 additions and 0 deletions

View File

@ -1251,6 +1251,11 @@ QDebug operator<<(QDebug d, const QHostAddress &address)
}
#endif
/*!
\since 5.0
\relates QHostAddress
Returns a hash of the host address \a key, using \a seed to seed the calculation.
*/
uint qHash(const QHostAddress &key, uint seed)
{
// both lines might throw
@ -1258,6 +1263,15 @@ uint qHash(const QHostAddress &key, uint seed)
return qHashBits(key.d->a6.c, 16, seed);
}
/*!
\relates QHostAddress
\fn operator==(QHostAddress::SpecialAddress lhs, const QHostAddress &rhs)
Returns \c true if special address \a lhs is the same as host address \a rhs;
otherwise returns \c false.
\sa isEqual()
*/
#ifndef QT_NO_DATASTREAM
/*! \relates QHostAddress

View File

@ -271,6 +271,7 @@ void tst_QHostAddress::specialAddresses()
//check special address equal to itself (QTBUG-22898), note two overloads of operator==
QVERIFY(QHostAddress(address) == QHostAddress(address));
QVERIFY(QHostAddress(address) == address);
QVERIFY(address == QHostAddress(address));
QVERIFY(!(QHostAddress(address) != QHostAddress(address)));
QVERIFY(!(QHostAddress(address) != address));