Fix debug stream operators.

- Use QDebugStateSaver to restore space setting in stream operators
  instead of returning dbg.space() which breaks formatting on streams
  that already have nospace() set.
- Fix some single character string constants, streamline code.

Change-Id: I18ae7324b172ea801aa9b5fe56ddf6fe527fdde9
Reviewed-by: Yoann Lopes <yoann.lopes@theqtcompany.com>
This commit is contained in:
Friedemann Kleint
2015-04-01 17:09:45 +02:00
parent 9fccf8064d
commit 4d17db19f8
9 changed files with 150 additions and 124 deletions

View File

@@ -62,8 +62,9 @@ struct PtrWrapper
template <typename T>
inline QDebug& operator<<(QDebug &debug, const Trace::PtrWrapper<T> &wrapper)
{
debug.nospace() << "[" << (void*)wrapper.m_ptr << "]";
return debug.space();
QDebugStateSaver saver(debug);
debug.nospace() << '[' << static_cast<const void *>(wrapper.m_ptr) << ']';
return debug;
}
template<typename T>

View File

@@ -62,8 +62,9 @@ struct PtrWrapper
template <typename T>
inline QDebug &operator<<(QDebug &debug, const Trace::PtrWrapper<T> &wrapper)
{
debug.nospace() << "[" << (void*)wrapper.m_ptr << "]";
return debug.space();
QDebugStateSaver saver(debug);
debug.nospace() << '[' << static_cast<const void *>(wrapper.m_ptr) << ']';
return debug;
}
#ifdef ENABLE_TRACE