diff options
author | Kai Koehne <kai.koehne@theqtcompany.com> | 2015-02-11 10:22:01 +0100 |
---|---|---|
committer | Kai Koehne <kai.koehne@theqtcompany.com> | 2015-02-12 10:08:20 +0000 |
commit | cd83859bd6310a2cf0a67c489aa597dc87e326b4 (patch) | |
tree | a6c9472f4e668035775b4f9260a2e8d3f02baf27 /src/network/kernel/qnetworkinterface.cpp | |
parent | 7997e56a2e5f35fa19da9ccb5dc89586882d951b (diff) | |
download | qtbase-cd83859bd6310a2cf0a67c489aa597dc87e326b4.tar.gz |
Network: Fix operator<<(QDebug, ...) operations
Use the
QDebugStateSaver saver(debug);
debug.resetFormat().nospace();
idiom to unify the formatting and whitespace handling.
Change-Id: Id346d63b3f589b60ca19e4459271d587f1a0c003
Reviewed-by: Richard J. Moore <rich@kde.org>
Diffstat (limited to 'src/network/kernel/qnetworkinterface.cpp')
-rw-r--r-- | src/network/kernel/qnetworkinterface.cpp | 38 |
1 files changed, 20 insertions, 18 deletions
diff --git a/src/network/kernel/qnetworkinterface.cpp b/src/network/kernel/qnetworkinterface.cpp index c62244fab3..8d891733ac 100644 --- a/src/network/kernel/qnetworkinterface.cpp +++ b/src/network/kernel/qnetworkinterface.cpp @@ -580,40 +580,42 @@ QList<QHostAddress> QNetworkInterface::allAddresses() static inline QDebug flagsDebug(QDebug debug, QNetworkInterface::InterfaceFlags flags) { if (flags & QNetworkInterface::IsUp) - debug.nospace() << "IsUp "; + debug << "IsUp "; if (flags & QNetworkInterface::IsRunning) - debug.nospace() << "IsRunning "; + debug << "IsRunning "; if (flags & QNetworkInterface::CanBroadcast) - debug.nospace() << "CanBroadcast "; + debug << "CanBroadcast "; if (flags & QNetworkInterface::IsLoopBack) - debug.nospace() << "IsLoopBack "; + debug << "IsLoopBack "; if (flags & QNetworkInterface::IsPointToPoint) - debug.nospace() << "IsPointToPoint "; + debug << "IsPointToPoint "; if (flags & QNetworkInterface::CanMulticast) - debug.nospace() << "CanMulticast "; - return debug.nospace(); + debug << "CanMulticast "; + return debug; } static inline QDebug operator<<(QDebug debug, const QNetworkAddressEntry &entry) { - debug.nospace() << "(address = " << entry.ip(); + debug << "(address = " << entry.ip(); if (!entry.netmask().isNull()) - debug.nospace() << ", netmask = " << entry.netmask(); + debug << ", netmask = " << entry.netmask(); if (!entry.broadcast().isNull()) - debug.nospace() << ", broadcast = " << entry.broadcast(); - debug.nospace() << ')'; - return debug.space(); + debug << ", broadcast = " << entry.broadcast(); + debug << ')'; + return debug; } QDebug operator<<(QDebug debug, const QNetworkInterface &networkInterface) { - debug.nospace() << "QNetworkInterface(name = " << networkInterface.name() - << ", hardware address = " << networkInterface.hardwareAddress() - << ", flags = "; + QDebugStateSaver saver(debug); + debug.resetFormat().nospace(); + debug << "QNetworkInterface(name = " << networkInterface.name() + << ", hardware address = " << networkInterface.hardwareAddress() + << ", flags = "; flagsDebug(debug, networkInterface.flags()); - debug.nospace() << ", entries = " << networkInterface.addressEntries() - << ")\n"; - return debug.space(); + debug << ", entries = " << networkInterface.addressEntries() + << ")\n"; + return debug; } #endif |