QtBase
v6.3.1
|
Convenience class for custom QDebug operators. More...
#include <qdebug.h>
Public Member Functions | |
QDebugStateSaver (QDebug &dbg) | |
~QDebugStateSaver () | |
Convenience class for custom QDebug operators.
\inmodule QtCore
Saves the settings used by QDebug, and restores them upon destruction, then calls \l {QDebug::maybeSpace()}{maybeSpace()}, to separate arguments with a space if \l {QDebug::autoInsertSpaces()}{autoInsertSpaces()} was true at the time of constructing the QDebugStateSaver.
The automatic insertion of spaces between writes is one of the settings that QDebugStateSaver stores for the duration of the current block.
The settings of the internal QTextStream are also saved and restored, so that using << Qt::hex in a QDebug operator doesn't affect other QDebug operators.
QDebugStateSaver is typically used in the implementation of an operator<<() for debugging:
QDebugStateSaver::QDebugStateSaver | ( | QDebug & | dbg | ) |
Creates a QDebugStateSaver instance, which saves the settings currently used by dbg.
Definition at line 1016 of file qdebug.cpp.
QDebugStateSaver::~QDebugStateSaver | ( | ) |
Destroys a QDebugStateSaver instance, which restores the settings used when the QDebugStateSaver instance was created.
Definition at line 1027 of file qdebug.cpp.