QDebug: sprinkle usage of QDebugStateSaver
Change-Id: I6dc134acca2bbc010139113f196869b36da9b240 Reviewed-by: Lars Knoll <lars.knoll@qt.io>
This commit is contained in:
parent
18693916a4
commit
737635fa56
@ -234,7 +234,7 @@ namespace QtPrivate {
|
|||||||
template <typename SequentialContainer>
|
template <typename SequentialContainer>
|
||||||
inline QDebug printSequentialContainer(QDebug debug, const char *which, const SequentialContainer &c)
|
inline QDebug printSequentialContainer(QDebug debug, const char *which, const SequentialContainer &c)
|
||||||
{
|
{
|
||||||
const bool oldSetting = debug.autoInsertSpaces();
|
const QDebugStateSaver saver(debug);
|
||||||
debug.nospace() << which << '(';
|
debug.nospace() << which << '(';
|
||||||
typename SequentialContainer::const_iterator it = c.begin(), end = c.end();
|
typename SequentialContainer::const_iterator it = c.begin(), end = c.end();
|
||||||
if (it != end) {
|
if (it != end) {
|
||||||
@ -246,22 +246,20 @@ inline QDebug printSequentialContainer(QDebug debug, const char *which, const Se
|
|||||||
++it;
|
++it;
|
||||||
}
|
}
|
||||||
debug << ')';
|
debug << ')';
|
||||||
debug.setAutoInsertSpaces(oldSetting);
|
return debug;
|
||||||
return debug.maybeSpace();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename AssociativeContainer>
|
template <typename AssociativeContainer>
|
||||||
inline QDebug printAssociativeContainer(QDebug debug, const char *which, const AssociativeContainer &c)
|
inline QDebug printAssociativeContainer(QDebug debug, const char *which, const AssociativeContainer &c)
|
||||||
{
|
{
|
||||||
const bool oldSetting = debug.autoInsertSpaces();
|
const QDebugStateSaver saver(debug);
|
||||||
debug.nospace() << which << "(";
|
debug.nospace() << which << "(";
|
||||||
for (typename AssociativeContainer::const_iterator it = c.constBegin();
|
for (typename AssociativeContainer::const_iterator it = c.constBegin();
|
||||||
it != c.constEnd(); ++it) {
|
it != c.constEnd(); ++it) {
|
||||||
debug << '(' << it.key() << ", " << it.value() << ')';
|
debug << '(' << it.key() << ", " << it.value() << ')';
|
||||||
}
|
}
|
||||||
debug << ')';
|
debug << ')';
|
||||||
debug.setAutoInsertSpaces(oldSetting);
|
return debug;
|
||||||
return debug.maybeSpace();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace QtPrivate
|
} // namespace QtPrivate
|
||||||
@ -332,10 +330,9 @@ inline QDebug operator<<(QDebug debug, const QPair<T1, T2> &pair)
|
|||||||
template <class T1, class T2>
|
template <class T1, class T2>
|
||||||
inline QDebug operator<<(QDebug debug, const std::pair<T1, T2> &pair)
|
inline QDebug operator<<(QDebug debug, const std::pair<T1, T2> &pair)
|
||||||
{
|
{
|
||||||
const bool oldSetting = debug.autoInsertSpaces();
|
const QDebugStateSaver saver(debug);
|
||||||
debug.nospace() << "std::pair(" << pair.first << ',' << pair.second << ')';
|
debug.nospace() << "std::pair(" << pair.first << ',' << pair.second << ')';
|
||||||
debug.setAutoInsertSpaces(oldSetting);
|
return debug;
|
||||||
return debug.maybeSpace();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
@ -347,7 +344,7 @@ inline QDebug operator<<(QDebug debug, const QSet<T> &set)
|
|||||||
template <class T>
|
template <class T>
|
||||||
inline QDebug operator<<(QDebug debug, const QContiguousCache<T> &cache)
|
inline QDebug operator<<(QDebug debug, const QContiguousCache<T> &cache)
|
||||||
{
|
{
|
||||||
const bool oldSetting = debug.autoInsertSpaces();
|
const QDebugStateSaver saver(debug);
|
||||||
debug.nospace() << "QContiguousCache(";
|
debug.nospace() << "QContiguousCache(";
|
||||||
for (int i = cache.firstIndex(); i <= cache.lastIndex(); ++i) {
|
for (int i = cache.firstIndex(); i <= cache.lastIndex(); ++i) {
|
||||||
debug << cache[i];
|
debug << cache[i];
|
||||||
@ -355,8 +352,7 @@ inline QDebug operator<<(QDebug debug, const QContiguousCache<T> &cache)
|
|||||||
debug << ", ";
|
debug << ", ";
|
||||||
}
|
}
|
||||||
debug << ')';
|
debug << ')';
|
||||||
debug.setAutoInsertSpaces(oldSetting);
|
return debug;
|
||||||
return debug.maybeSpace();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
template <class T>
|
template <class T>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user