QOperatingSystemVersion: Add debug operator

Change-Id: Ibc942196bef0edc74f34501830fc83cb64259e39
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Jake Petroules <jake.petroules@qt.io>
This commit is contained in:
Friedemann Kleint 2017-09-18 13:01:02 +02:00
parent 29b38bea45
commit 34aa7a18af
2 changed files with 18 additions and 0 deletions

View File

@ -43,6 +43,7 @@
#endif
#include <qversionnumber.h>
#include <qdebug.h>
#if defined(Q_OS_ANDROID)
#include <private/qjni_p.h>
@ -510,4 +511,16 @@ const QOperatingSystemVersion QOperatingSystemVersion::AndroidNougat_MR1 =
const QOperatingSystemVersion QOperatingSystemVersion::AndroidOreo =
QOperatingSystemVersion(QOperatingSystemVersion::Android, 8, 0);
#ifndef QT_NO_DEBUG_STREAM
QDebug operator<<(QDebug debug, const QOperatingSystemVersion &ov)
{
QDebugStateSaver saver(debug);
debug.nospace();
debug << "QOperatingSystemVersion(" << ov.name()
<< ", " << ov.majorVersion() << '.' << ov.minorVersion()
<< '.' << ov.microVersion() << ')';
return debug;
}
#endif // !QT_NO_DEBUG_STREAM
QT_END_NAMESPACE

View File

@ -128,6 +128,11 @@ private:
};
Q_DECLARE_TYPEINFO(QOperatingSystemVersion, QT_VERSION < QT_VERSION_CHECK(6, 0, 0) ? Q_RELOCATABLE_TYPE : Q_PRIMITIVE_TYPE);
#ifndef QT_NO_DEBUG_STREAM
class QDebug;
Q_CORE_EXPORT QDebug operator<<(QDebug debug, const QOperatingSystemVersion &ov);
#endif
QT_END_NAMESPACE
#endif // QOPERATINGSYSTEMVERSION_H