Add debug stream operator for QNetworkProxyQuery

Change-Id: Iae215827350e47a8ce31e5828d3ad1ed54564e84
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Reviewed-by: André Klitzing <aklitzing@gmail.com>
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
This commit is contained in:
Lars Schmertmann 2017-01-10 08:52:35 +01:00 committed by Lars Schmertmann
parent c28fde3fda
commit 139d2e5f10
2 changed files with 19 additions and 4 deletions

View File

@ -1636,10 +1636,6 @@ QList<QNetworkProxy> QNetworkProxyFactory::proxyForQuery(const QNetworkProxyQuer
}
#ifndef QT_NO_DEBUG_STREAM
/*!
\since 5.0
Outputs a QNetworkProxy details to a debug stream
*/
QDebug operator<<(QDebug debug, const QNetworkProxy &proxy)
{
QDebugStateSaver saver(debug);
@ -1688,6 +1684,21 @@ QDebug operator<<(QDebug debug, const QNetworkProxy &proxy)
debug << '[' << scaps.join(QLatin1Char(' ')) << ']';
return debug;
}
QDebug operator<<(QDebug debug, const QNetworkProxyQuery &proxyQuery)
{
QDebugStateSaver saver(debug);
debug.resetFormat().nospace()
<< "ProxyQuery("
<< "type: " << proxyQuery.queryType()
<< ", protocol: " << proxyQuery.protocolTag()
<< ", peerPort: " << proxyQuery.peerPort()
<< ", peerHostName: " << proxyQuery.peerHostName()
<< ", localPort: " << proxyQuery.localPort()
<< ", url: " << proxyQuery.url()
<< ')';
return debug;
}
#endif
QT_END_NAMESPACE

View File

@ -56,6 +56,8 @@ class QNetworkConfiguration;
class QNetworkProxyQueryPrivate;
class Q_NETWORK_EXPORT QNetworkProxyQuery
{
Q_GADGET
public:
enum QueryType {
TcpSocket,
@ -65,6 +67,7 @@ public:
UrlRequest,
SctpServer
};
Q_ENUM(QueryType)
QNetworkProxyQuery();
explicit QNetworkProxyQuery(const QUrl &requestUrl, QueryType queryType = UrlRequest);
@ -222,6 +225,7 @@ public:
#ifndef QT_NO_DEBUG_STREAM
Q_NETWORK_EXPORT QDebug operator<<(QDebug debug, const QNetworkProxy &proxy);
Q_NETWORK_EXPORT QDebug operator<<(QDebug debug, const QNetworkProxyQuery &proxyQuery);
#endif
QT_END_NAMESPACE