diff options
author | Marc Mutz <marc.mutz@kdab.com> | 2015-11-28 10:57:51 +0100 |
---|---|---|
committer | Marc Mutz <marc.mutz@kdab.com> | 2015-11-28 16:26:24 +0000 |
commit | ca1f842158419e49b2a010f58e347d7af3b28b93 (patch) | |
tree | e48d8b6f56c9efd364a171bf42e1ed0c2c07b149 /src/corelib/io/qdebug.cpp | |
parent | 88d7c8f963414f4d3ac7a406faddcc074ca6462d (diff) |
QDebug: reduce template bloat
When streaming non-Q_FLAG QFlags, factor the common code
into a helper function only templated on QFlags<T>::Int
and pass what varies as parameters.
Then overload the helper function for the most common int
type (int) as an out-of-line function, implemented via the
primary template to avoid the two going out of sync.
That leaves the primary helper template only for special
cases (such as future extensions).
Change-Id: I70e0001bcfacab9f8765c9b1075fe80b596223f1
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
Diffstat (limited to 'src/corelib/io/qdebug.cpp')
-rw-r--r-- | src/corelib/io/qdebug.cpp | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/src/corelib/io/qdebug.cpp b/src/corelib/io/qdebug.cpp index 002c9bcda2..4f85ceb084 100644 --- a/src/corelib/io/qdebug.cpp +++ b/src/corelib/io/qdebug.cpp @@ -867,6 +867,19 @@ QDebugStateSaver::~QDebugStateSaver() d->restoreState(); } +/*! + \internal + + Specialization of the primary template in qdebug.h to out-of-line + the common case of QFlags<T>::Int being int. + + Just call the generic version so the two don't get out of sync. +*/ +void qt_QMetaEnum_flagDebugOperator(QDebug &debug, size_t sizeofT, int value) +{ + qt_QMetaEnum_flagDebugOperator<int>(debug, sizeofT, value); +} + #ifndef QT_NO_QOBJECT /*! \internal |