QNetworkAddressEntry: export QDebug stream operator

It already existed, but was only used internally in QNetworkInterface's
debug stream operator.

Change-Id: I36c2b4f6cb228df2f92ec92cc879b6d34f1e3ea1
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
bb10
Fabian Kosmale 2021-05-19 11:15:11 +02:00
parent 8827cd657d
commit d95e39a9b8
2 changed files with 19 additions and 3 deletions

View File

@ -931,17 +931,32 @@ static inline QDebug flagsDebug(QDebug debug, QNetworkInterface::InterfaceFlags
return debug;
}
static inline QDebug operator<<(QDebug debug, const QNetworkAddressEntry &entry)
/*!
\since 6.2
Writes the QNetworkAddressEntry \a entry to the stream and
returns a reference to the stream.
\relates QNetworkAddressEntry
*/
QDebug operator<<(QDebug debug, const QNetworkAddressEntry &entry)
{
debug << "(address = " << entry.ip();
QDebugStateSaver saver(debug);
debug.resetFormat().nospace();
debug << "address = " << entry.ip();
if (!entry.netmask().isNull())
debug << ", netmask = " << entry.netmask();
if (!entry.broadcast().isNull())
debug << ", broadcast = " << entry.broadcast();
debug << ')';
return debug;
}
/*!
Writes the QNetworkInterface \a networkInterface to the stream and
returns a reference to the stream.
\relates QNetworkInterface
*/
QDebug operator<<(QDebug debug, const QNetworkInterface &networkInterface)
{
QDebugStateSaver saver(debug);

View File

@ -176,6 +176,7 @@ Q_DECLARE_SHARED(QNetworkInterface)
Q_DECLARE_OPERATORS_FOR_FLAGS(QNetworkInterface::InterfaceFlags)
#ifndef QT_NO_DEBUG_STREAM
Q_NETWORK_EXPORT QDebug operator<<(QDebug debug, const QNetworkAddressEntry &entry);
Q_NETWORK_EXPORT QDebug operator<<(QDebug debug, const QNetworkInterface &networkInterface);
#endif