Skip to content

Commit

Permalink
Add debug stream operator for QNetworkProxyQuery
Browse files Browse the repository at this point in the history
Change-Id: Iae215827350e47a8ce31e5828d3ad1ed54564e84
Reviewed-by: Friedemann Kleint <[email protected]>
Reviewed-by: André Klitzing <[email protected]>
Reviewed-by: Timur Pocheptsov <[email protected]>
  • Loading branch information
SmallLars committed Jan 24, 2017
1 parent c28fde3 commit 139d2e5
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 4 deletions.
19 changes: 15 additions & 4 deletions src/network/kernel/qnetworkproxy.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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
Expand Down
4 changes: 4 additions & 0 deletions src/network/kernel/qnetworkproxy.h
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,8 @@ class QNetworkConfiguration;
class QNetworkProxyQueryPrivate;
class Q_NETWORK_EXPORT QNetworkProxyQuery
{
Q_GADGET

public:
enum QueryType {
TcpSocket,
Expand All @@ -65,6 +67,7 @@ class Q_NETWORK_EXPORT QNetworkProxyQuery
UrlRequest,
SctpServer
};
Q_ENUM(QueryType)

QNetworkProxyQuery();
explicit QNetworkProxyQuery(const QUrl &requestUrl, QueryType queryType = UrlRequest);
Expand Down Expand Up @@ -222,6 +225,7 @@ class Q_NETWORK_EXPORT QNetworkProxyFactory

#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
Expand Down

0 comments on commit 139d2e5

Please sign in to comment.