QSharedPointer: move QDebug stream operators into qdebug.h
In order to avoid pulling in QDebug when including QSharedPointer. Change-Id: I14b86d1f100ed44a68258c91bbda394b655bac83 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
This commit is contained in:
parent
99ca471014
commit
4dc29bc9de
@ -793,6 +793,17 @@ QDebug &QDebug::resetFormat()
|
|||||||
Writes \a flag to \a stream.
|
Writes \a flag to \a stream.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
/*!
|
||||||
|
\fn QDebug operator<<(QDebug debug, const QSharedPointer<T> &ptr)
|
||||||
|
\relates QSharedPointer
|
||||||
|
\since 5.7
|
||||||
|
|
||||||
|
Writes the pointer tracked by \a ptr into the debug object \a debug for
|
||||||
|
debugging purposes.
|
||||||
|
|
||||||
|
\sa {Debugging Techniques}
|
||||||
|
*/
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
\class QDebugStateSaver
|
\class QDebugStateSaver
|
||||||
\inmodule QtCore
|
\inmodule QtCore
|
||||||
|
@ -51,6 +51,7 @@
|
|||||||
#include <QtCore/qvector.h>
|
#include <QtCore/qvector.h>
|
||||||
#include <QtCore/qset.h>
|
#include <QtCore/qset.h>
|
||||||
#include <QtCore/qcontiguouscache.h>
|
#include <QtCore/qcontiguouscache.h>
|
||||||
|
#include <QtCore/qsharedpointer.h>
|
||||||
|
|
||||||
// all these have already been included by various headers above, but don't rely on indirect includes:
|
// all these have already been included by various headers above, but don't rely on indirect includes:
|
||||||
#include <vector>
|
#include <vector>
|
||||||
@ -330,6 +331,14 @@ inline QDebug operator<<(QDebug debug, const QContiguousCache<T> &cache)
|
|||||||
return debug.maybeSpace();
|
return debug.maybeSpace();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
template <class T>
|
||||||
|
inline QDebug operator<<(QDebug debug, const QSharedPointer<T> &ptr)
|
||||||
|
{
|
||||||
|
QDebugStateSaver saver(debug);
|
||||||
|
debug.nospace() << "QSharedPointer(" << ptr.data() << ")";
|
||||||
|
return debug;
|
||||||
|
}
|
||||||
|
|
||||||
Q_CORE_EXPORT void qt_QMetaEnum_flagDebugOperator(QDebug &debug, size_t sizeofT, int value);
|
Q_CORE_EXPORT void qt_QMetaEnum_flagDebugOperator(QDebug &debug, size_t sizeofT, int value);
|
||||||
|
|
||||||
template <typename Int>
|
template <typename Int>
|
||||||
|
@ -1299,17 +1299,6 @@
|
|||||||
compile. Use qSharedPointerConstCast to cast away the constness.
|
compile. Use qSharedPointerConstCast to cast away the constness.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/*!
|
|
||||||
\fn QDebug operator<<(QDebug debug, const QSharedPointer<T> &ptr)
|
|
||||||
\relates QSharedPointer
|
|
||||||
\since 5.7
|
|
||||||
|
|
||||||
Writes the pointer tracked by \a ptr into the debug object \a debug for
|
|
||||||
debugging purposes.
|
|
||||||
|
|
||||||
\sa {Debugging Techniques}
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include <qset.h>
|
#include <qset.h>
|
||||||
#include <qmutex.h>
|
#include <qmutex.h>
|
||||||
|
|
||||||
|
@ -159,8 +159,6 @@ template <class X, class T> QSharedPointer<X> qSharedPointerObjectCast(const QWe
|
|||||||
|
|
||||||
template <class X, class T> QWeakPointer<X> qWeakPointerCast(const QWeakPointer<T> &src);
|
template <class X, class T> QWeakPointer<X> qWeakPointerCast(const QWeakPointer<T> &src);
|
||||||
|
|
||||||
template <class T> QDebug operator<<(QDebug debug, const QSharedPointer<T> &ptr);
|
|
||||||
|
|
||||||
QT_END_NAMESPACE
|
QT_END_NAMESPACE
|
||||||
|
|
||||||
#endif // Q_QDOC
|
#endif // Q_QDOC
|
||||||
|
@ -62,7 +62,6 @@ QT_END_NAMESPACE
|
|||||||
#include <new>
|
#include <new>
|
||||||
#include <QtCore/qatomic.h>
|
#include <QtCore/qatomic.h>
|
||||||
#include <QtCore/qobject.h> // for qobject_cast
|
#include <QtCore/qobject.h> // for qobject_cast
|
||||||
#include <QtCore/qdebug.h>
|
|
||||||
#if QT_DEPRECATED_SINCE(5, 6)
|
#if QT_DEPRECATED_SINCE(5, 6)
|
||||||
#include <QtCore/qhash.h>
|
#include <QtCore/qhash.h>
|
||||||
#endif
|
#endif
|
||||||
@ -877,16 +876,6 @@ inline void qSwap(QSharedPointer<T> &p1, QSharedPointer<T> &p2)
|
|||||||
p1.swap(p2);
|
p1.swap(p2);
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifndef QT_NO_DEBUG_STREAM
|
|
||||||
template <class T>
|
|
||||||
Q_INLINE_TEMPLATE QDebug operator<<(QDebug debug, const QSharedPointer<T> &ptr)
|
|
||||||
{
|
|
||||||
QDebugStateSaver saver(debug);
|
|
||||||
debug.nospace() << "QSharedPointer(" << ptr.data() << ")";
|
|
||||||
return debug;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
QT_END_NAMESPACE
|
QT_END_NAMESPACE
|
||||||
namespace std {
|
namespace std {
|
||||||
template <class T>
|
template <class T>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user