Qt
Internal/Contributor docs for the Qt SDK. <b>Note:</b> These are NOT official API docs; those are found <a href='https://doc.qt.io/'>here</a>.
Loading...
Searching...
No Matches
qdebug.cpp File Reference

(d9f71041661146c7bea0bb0f53a14a6cbce596f3)

#include "qdebug.h"
#include "private/qdebug_p.h"
#include "qmetaobject.h"
#include <private/qlogging_p.h>
#include <private/qtextstream_p.h>
#include <private/qtools_p.h>
#include <array>
#include <q20chrono.h>
+ Include dependency graph for qdebug.cpp:

Go to the source code of this file.

Classes

class  QDebugStateSaverPrivate
 

Functions

static bool isPrintable (char32_t ucs4)
 
static bool isPrintable (char16_t uc)
 
static bool isPrintable (uchar c)
 
template<typename Char >
static void putEscapedString (QTextStreamPrivate *d, const Char *begin, size_t length, bool isUnicode=true)
 
static QByteArray timeUnit (qint64 num, qint64 den)
 
void qt_QMetaEnum_flagDebugOperator (QDebug &debug, size_t sizeofT, int value)
 
QDebug qt_QMetaEnum_debugOperator (QDebug &dbg, qint64 value, const QMetaObject *meta, const char *name)
 
QDebug qt_QMetaEnum_flagDebugOperator (QDebug &debug, quint64 value, const QMetaObject *meta, const char *name)
 

Function Documentation

◆ isPrintable() [1/3]

static bool isPrintable ( char16_t uc)
inlinestatic

Definition at line 193 of file qdebug.cpp.

◆ isPrintable() [2/3]

static bool isPrintable ( char32_t ucs4)
inlinestatic

Definition at line 192 of file qdebug.cpp.

Referenced by putEscapedString().

+ Here is the caller graph for this function:

◆ isPrintable() [3/3]

static bool isPrintable ( uchar c)
inlinestatic

Definition at line 194 of file qdebug.cpp.

References QtMiscUtils::isAsciiPrintable().

+ Here is the call graph for this function:

◆ putEscapedString()

template<typename Char >
static void putEscapedString ( QTextStreamPrivate * d,
const Char * begin,
size_t length,
bool isUnicode = true )
inlinestatic

Definition at line 198 of file qdebug.cpp.

References begin(), d, QtMiscUtils::fromHex(), isPrintable(), Q_UNLIKELY, quote(), and QtMiscUtils::toHexUpper().

+ Here is the call graph for this function:

◆ qt_QMetaEnum_debugOperator()

QDebug qt_QMetaEnum_debugOperator ( QDebug & dbg,
qint64 value,
const QMetaObject * meta,
const char * name )

Formats the given enum value for debug output.

The supported verbosity are:

0: Just the key, or value with enum name if no key is found:

MyEnum2 MyEnum(123) MyScopedEnum::Enum3 MyScopedEnum(456)

1: Same as 0, but treating all enums as scoped:

MyEnum::MyEnum2 MyEnum(123) MyScopedEnum::Enum3 MyScopedEnum(456)

2: The QDebug default. Same as 0, and includes class/namespace scope:

MyNamespace::MyClass::MyEnum2 MyNamespace::MyClass::MyEnum(123) MyNamespace::MyClass::MyScopedEnum::Enum3 MyNamespace::MyClass::MyScopedEnum(456)

3: Same as 2, but treating all enums as scoped:

MyNamespace::MyClass::MyEnum::MyEnum2 MyNamespace::MyClass::MyEnum(123) MyNamespace::MyClass::MyScopedEnum::Enum3 MyNamespace::MyClass::MyScopedEnum(456)

Definition at line 1287 of file qdebug.cpp.

References QMetaObject::enumerator(), QMetaEnum::enumName(), QMetaObject::indexOfEnumerator(), QMetaEnum::isScoped(), QMetaEnum::scope(), and QMetaEnum::valueToKey().

Referenced by operator<<().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ qt_QMetaEnum_flagDebugOperator() [1/2]

QDebug qt_QMetaEnum_flagDebugOperator ( QDebug & debug,
quint64 value,
const QMetaObject * meta,
const char * name )

Formats the given flag value for debug output.

The supported verbosity are:

0: Just the key(s):

MyFlag1 MyFlag2|MyFlag3 MyScopedFlag(MyFlag2) MyScopedFlag(MyFlag2|MyFlag3)

1: Same as 0, but treating all flags as scoped:

MyFlag(MyFlag1) MyFlag(MyFlag2|MyFlag3) MyScopedFlag(MyFlag2) MyScopedFlag(MyFlag2|MyFlag3)

2: The QDebug default. Same as 1, and includes class/namespace scope:

QFlags<MyNamespace::MyClass::MyFlag>(MyFlag1) QFlags<MyNamespace::MyClass::MyFlag>(MyFlag2|MyFlag3) QFlags<MyNamespace::MyClass::MyScopedFlag>(MyFlag2) QFlags<MyNamespace::MyClass::MyScopedFlag>(MyFlag2|MyFlag3)

Definition at line 1341 of file qdebug.cpp.

References debug, QMetaObject::enumerator(), QMetaEnum::enumName(), QMetaObject::indexOfEnumerator(), QMetaEnum::isScoped(), QMetaEnum::scope(), and QMetaEnum::valueToKeys().

+ Here is the call graph for this function:

◆ qt_QMetaEnum_flagDebugOperator() [2/2]

void qt_QMetaEnum_flagDebugOperator ( QDebug & debug,
size_t sizeofT,
int value )

Specialization of the primary template in qdebug.h to out-of-line the common case of QFlags<T>::Int being int.

Just call the generic version so the two don't get out of sync.

Definition at line 1246 of file qdebug.cpp.

References debug.

◆ timeUnit()

static QByteArray timeUnit ( qint64 num,
qint64 den )
static

Definition at line 345 of file qdebug.cpp.

References QString::asprintf(), d, Q_ASSERT, Q_UNLIKELY, QByteArray(), and qsnprintf().

+ Here is the call graph for this function: