CopperSpice API
1.9.2
|
The QDebug class generates output for debugging. More...
Public Methods | |
QDebug (const QDebug &other) | |
QDebug (QIODevice *device) | |
QDebug (QString *string) | |
QDebug (QtMsgType type) | |
~QDebug () | |
bool | autoInsertSpaces () const |
QDebug & | maybeQuote (char c= '"') |
QDebug & | maybeSpace () |
QDebug & | noquote () |
QDebug & | nospace () |
QDebug & | operator<< (bool value) |
QDebug & | operator<< (char value) |
QDebug & | operator<< (char16_t value) |
QDebug & | operator<< (char32_t value) |
QDebug & | operator<< (const char *value) |
QDebug & | operator<< (const QByteArray &str) |
QDebug & | operator<< (const QString &str) |
QDebug & | operator<< (const QUrl &url) |
QDebug & | operator<< (const void *ptr) |
QDebug & | operator<< (double value) |
QDebug & | operator<< (float value) |
QDebug & | operator<< (QChar value) |
QDebug & | operator<< (qint64 value) |
QDebug & | operator<< (QStringView str) |
QDebug & | operator<< (quint64 value) |
QDebug & | operator<< (signed int value) |
QDebug & | operator<< (signed long value) |
QDebug & | operator<< (signed short value) |
QDebug & | operator<< (unsigned int value) |
QDebug & | operator<< (unsigned long value) |
QDebug & | operator<< (unsigned short value) |
QDebug & | operator= (const QDebug &other) |
QDebug & | quote () |
QDebug & | resetFormat () |
void | setAutoInsertSpaces (bool enable) |
void | setVerbosity (int verbosityLevel) |
QDebug & | space () |
void | swap (QDebug &other) |
int | verbosity () const |
The QDebug class generates output for debugging. This class is intended to be used during the application development process. The debug output stream is normally displayed on the terminal screen. The output can be redirected to a file.
There are three different constructors for QDebug to accept a QIODevice, a QString, or a QtMsgType.
A QFile object can be used to construct a QDebug since QFile inherits from QIODevice. Any other class which inherits from QIODevice will also call this constructor. Passing a QString to QDebug will call the appropriate constructor. This can be used to format the output of the given debug message.
The qDebug() function calls a constructor in the QDebug class. Using this function is a common and useful way to display debug output as shown in the following examples.
Any data type can be written to QDebug. CopperSpice provides built in support for the most common data types. To add support for custom types you will need to implement an operator<<() function as shown in the following example.
The debug output can be redirected from the screen (terminal window) to a file by using the following command line syntax.
An extensive number of calls to qDebug() can be found within the CopperSpice libraries. They are all disabled by default. Each call to qDebug() is guarded with #define macro. For ease of use the debug messages have been grouped into a small number of categories.The full list of #define macros can be found in the CsCore library in the src/core/global/qglobal_debug.h header file.
To enable one or more of the debug macros either uncomment in the header file or pass one or more of the defines in your CopperSpice build files.
The following is an example which can be found in CsCore. If the macro is enabled then the debug message will be displayed in the terminal window.
|
inline |
Constructs a debug stream which writes to the given device.
|
inline |
Constructs a debug stream which writes to the given string.
|
inline |
Constructs a debug stream for the message type specified by type.
|
inline |
Constructs a copy of the other debug stream.
QDebug::~QDebug | ( | ) |
Flushes any pending data to be written and destroys the debug stream.
|
inline |
Returns true if this QDebug instance will automatically insert spaces between writes.
|
inline |
|
inline |
|
inline |
Disables automatic insertion of quotation characters around QChar, QString and QByteArray contents. Returns a reference to the stream. When quoting is disabled these types are printed without quotation characters and without escaping of non-printable characters.
|
inline |
Disables automatic insertion of spaces. Returns a reference to the stream.
|
inline |
Writes the given boolean value to the stream and returns a reference to the stream.
|
inline |
Writes the character value to the stream and returns a reference to the stream.
|
inline |
Writes the 16-bit character value to the stream and returns a reference to the stream.
|
inline |
Writes the 32-bit character value to the stream and returns a reference to the stream.
|
inline |
Writes the null terminated string value to the stream and returns a reference to the stream.
|
inline |
Writes the byte array str to the stream and returns a reference to the stream.
|
inline |
Writes the string str to the stream and returns a reference to the stream.
|
inline |
Writes the url to the stream and returns a reference to the stream.
|
inline |
Writes a pointer ptr to the stream and returns a reference to the stream.
|
inline |
Writes the 64-bit floating point number value to the stream and returns a reference to the stream.
|
inline |
Writes the 32-bit floating point number value to the stream and returns a reference to the stream.
|
inline |
Writes the character value to the stream and returns a reference to the stream.
|
inline |
Writes the signed 64-bit integer value to the stream and returns a reference to the stream.
|
inline |
Writes the string view str to the stream and returns a reference to the stream.
|
inline |
Writes the unsigned 64-bit integer value to the stream and returns a reference to the stream.
|
inline |
Writes the signed integer value to the stream and returns a reference to the stream.
|
inline |
Writes the signed long integer value to the stream and returns a reference to the stream.
|
inline |
Writes the signed short integer value to the stream and returns a reference to the stream.
|
inline |
Writes the unsigned integer value to the stream and returns a reference to the stream.
|
inline |
Writes the unsigned long integer value to the stream and returns a reference to the stream.
|
inline |
Writes the unsigned short integer value to the stream and returns a reference to the stream.
|
inline |
Copy assigns from other and returns a reference to this object.
|
inline |
Enables automatic insertion of quotation characters around QChar, QString and QByteArray contents and returns a reference to the stream.
Quoting is enabled by default.
QDebug & QDebug::resetFormat | ( | ) |
|
inline |
Enables automatic insertion of spaces between writes if enable is true, otherwise automatic insertion of spaces is disabled.
|
inline |
Sets the verbosity of the stream to verbosityLevel. The allowed range is from 0 to 7. The default value is 2.
|
inline |
Writes a space character to the debug stream and returns a reference to the stream.
|
inline |
Swaps this debug stream instance with other. This method is very fast and never fails.
|
inline |
Returns the verbosity of the debug stream.
Streaming operators can check the value to decide whether verbose output is desired and print more information depending on the level. Higher values indicate more information is desired. The allowed range is from 0 to 7. The default value is 2.