9#pragma qt_class(QtDebug)
12#include <QtCore/qcompare.h>
13#include <QtCore/qcontainerfwd.h>
14#include <QtCore/qtextstream.h>
15#include <QtCore/qttypetraits.h>
16#include <QtCore/qtypes.h>
17#include <QtCore/qstring.h>
18#include <QtCore/qcontiguouscache.h>
19#include <QtCore/qsharedpointer.h>
31#include <QtCore/q20type_traits.h>
35#if !defined(QT_LEAN_HEADERS) || QT_LEAN_HEADERS < 1
36# include <QtCore/qlist.h>
37# include <QtCore/qmap.h>
38# include <QtCore/qset.h>
39# include <QtCore/qvarlengtharray.h>
44class QT6_ONLY(Q_CORE_EXPORT) QDebug :
public QIODeviceBase
46 friend class QMessageLogger;
47 friend class QDebugStateSaver;
48 friend class QDebugStateSaverPrivate;
50 enum { VerbosityShift = 29, VerbosityMask = 0x7 };
52 explicit Stream(QIODevice *device)
55 explicit Stream(QString *string)
56 : ts(string, WriteOnly)
58 explicit Stream(QByteArray *ba)
61 explicit Stream(QtMsgType t)
62 : ts(&buffer, WriteOnly),
69 QtMsgType type = QtDebugMsg;
71 bool noQuotes =
false;
72 bool message_output =
false;
73 int verbosity = DefaultVerbosity;
74 QMessageLogContext context;
77 enum Latin1Content { ContainsBinary = 0, ContainsLatin1 };
79 QT7_ONLY(Q_CORE_EXPORT)
void putUcs4(uint ucs4);
80 QT7_ONLY(Q_CORE_EXPORT)
void putString(
const QChar *begin, size_t length);
81 QT7_ONLY(Q_CORE_EXPORT)
void putByteArray(
const char *begin, size_t length, Latin1Content content);
82 QT7_ONLY(Q_CORE_EXPORT)
void putTimeUnit(qint64 num, qint64 den);
83 QT7_ONLY(Q_CORE_EXPORT)
void putInt128(
const void *i);
84 QT7_ONLY(Q_CORE_EXPORT)
void putUInt128(
const void *i);
85 QT7_ONLY(Q_CORE_EXPORT)
void putQtOrdering(QtOrderingPrivate::QtOrderingTypeFlag flags,
86 Qt::partial_ordering order);
88 template <
typename...Ts>
89 using if_streamable = std::enable_if_t<
90 std::conjunction_v<QTypeTraits::has_ostream_operator<QDebug, Ts>...>
93 explicit QDebug(QIODevice *device) : stream(
new Stream(device)) {}
94 explicit QDebug(QString *string) : stream(
new Stream(string)) {}
95 explicit QDebug(QByteArray *bytes) : stream(
new Stream(bytes)) {}
96 explicit QDebug(QtMsgType t) : stream(
new Stream(t)) {}
97 QDebug(
const QDebug &o) : stream(o.stream) { ++stream->ref; }
98 QDebug(QDebug &&other)
noexcept : stream{std::exchange(other.stream,
nullptr)} {}
99 inline QDebug &operator=(
const QDebug &other);
100 QT_MOVE_ASSIGNMENT_OPERATOR_IMPL_VIA_MOVE_AND_SWAP(QDebug)
102 void swap(QDebug &other)
noexcept { qt_ptr_swap(stream, other.stream); }
104 QT7_ONLY(Q_CORE_EXPORT) QDebug &resetFormat();
106 inline QDebug &space() { stream->space =
true; stream->ts <<
' ';
return *
this; }
107 inline QDebug &nospace() { stream->space =
false;
return *
this; }
108 inline QDebug &maybeSpace() {
if (stream->space) stream->ts <<
' ';
return *
this; }
109 inline QDebug &verbosity(
int verbosityLevel) { stream->verbosity = verbosityLevel;
return *
this; }
110 int verbosity()
const {
return stream->verbosity; }
111 void setVerbosity(
int verbosityLevel) { stream->verbosity = verbosityLevel; }
112 enum VerbosityLevel { MinimumVerbosity = 0, DefaultVerbosity = 2, MaximumVerbosity = 7 };
114 bool autoInsertSpaces()
const {
return stream->space; }
115 void setAutoInsertSpaces(
bool b) { stream->space = b; }
117 [[nodiscard]]
bool quoteStrings()
const noexcept {
return !stream->noQuotes; }
118 void setQuoteStrings(
bool b) { stream->noQuotes = !b; }
120 inline QDebug "e() { stream->noQuotes =
false;
return *
this; }
121 inline QDebug &noquote() { stream->noQuotes =
true;
return *
this; }
122 inline QDebug &maybeQuote(
char c =
'"') {
if (!stream->noQuotes) stream->ts << c;
return *
this; }
124 inline QDebug &operator<<(QChar t) { putUcs4(t.unicode());
return maybeSpace(); }
125 inline QDebug &operator<<(
bool t) { stream->ts << (t ?
"true" :
"false");
return maybeSpace(); }
126 inline QDebug &operator<<(
char t) { stream->ts << t;
return maybeSpace(); }
127 inline QDebug &operator<<(
signed short t) { stream->ts << t;
return maybeSpace(); }
128 inline QDebug &operator<<(
unsigned short t) { stream->ts << t;
return maybeSpace(); }
129 inline QDebug &operator<<(
char16_t t) {
return *
this << QChar(t); }
130 inline QDebug &operator<<(
char32_t t) { putUcs4(t);
return maybeSpace(); }
131 inline QDebug &operator<<(
signed int t) { stream->ts << t;
return maybeSpace(); }
132 inline QDebug &operator<<(
unsigned int t) { stream->ts << t;
return maybeSpace(); }
133 inline QDebug &operator<<(
signed long t) { stream->ts << t;
return maybeSpace(); }
134 inline QDebug &operator<<(
unsigned long t) { stream->ts << t;
return maybeSpace(); }
135 inline QDebug &operator<<(qint64 t) { stream->ts << t;
return maybeSpace(); }
136 inline QDebug &operator<<(quint64 t) { stream->ts << t;
return maybeSpace(); }
137 inline QDebug &operator<<(qfloat16 t) { stream->ts << t;
return maybeSpace(); }
138 inline QDebug &operator<<(
float t) { stream->ts << t;
return maybeSpace(); }
139 inline QDebug &operator<<(
double t) { stream->ts << t;
return maybeSpace(); }
140 inline QDebug &operator<<(
const char* t) { stream->ts << QString::fromUtf8(t);
return maybeSpace(); }
141 inline QDebug &operator<<(
const char16_t *t) { stream->ts << QStringView(t);
return maybeSpace(); }
142 inline QDebug &operator<<(
const QString & t) { putString(t.constData(), size_t(t.size()));
return maybeSpace(); }
143 inline QDebug &operator<<(QStringView s) { putString(s.data(), size_t(s.size()));
return maybeSpace(); }
144 inline QDebug &operator<<(QUtf8StringView s) { putByteArray(
reinterpret_cast<
const char*>(s.data()), s.size(), ContainsBinary);
return maybeSpace(); }
145 inline QDebug &operator<<(QLatin1StringView t) { putByteArray(t.latin1(), t.size(), ContainsLatin1);
return maybeSpace(); }
146 inline QDebug &operator<<(
const QByteArray & t) { putByteArray(t.constData(), t.size(), ContainsBinary);
return maybeSpace(); }
147 inline QDebug &operator<<(QByteArrayView t) { putByteArray(t.constData(), t.size(), ContainsBinary);
return maybeSpace(); }
148 inline QDebug &operator<<(
const void * t) { stream->ts << t;
return maybeSpace(); }
149 inline QDebug &operator<<(std::nullptr_t) { stream->ts <<
"(nullptr)";
return maybeSpace(); }
150 inline QDebug &operator<<(std::nullopt_t) { stream->ts <<
"nullopt";
return maybeSpace(); }
151 inline QDebug &operator<<(QTextStreamFunction f) {
156 inline QDebug &operator<<(QTextStreamManipulator m)
157 { stream->ts << m;
return *
this; }
160 template <
typename Char,
typename...Args>
161 QDebug &operator<<(
const std::basic_string<Char, Args...> &s);
163 template <
typename Char,
typename...Args>
164 QDebug &operator<<(std::basic_string_view<Char, Args...> s);
166 template <
typename...Args>
167 QDebug &operator<<(
const std::basic_string<
char, Args...> &s)
168 {
return *
this << QUtf8StringView(s); }
170 template <
typename...Args>
171 QDebug &operator<<(std::basic_string_view<
char, Args...> s)
172 {
return *
this << QUtf8StringView(s); }
175 template <
typename...Args>
176 QDebug &operator<<(
const std::basic_string<char8_t, Args...> &s)
177 {
return *
this << QUtf8StringView(s); }
179 template <
typename...Args>
180 QDebug &operator<<(std::basic_string_view<char8_t, Args...> s)
181 {
return *
this << QUtf8StringView(s); }
184 template <
typename...Args>
185 QDebug &operator<<(
const std::basic_string<
char16_t, Args...> &s)
186 {
return *
this << QStringView(s); }
188 template <
typename...Args>
189 QDebug &operator<<(std::basic_string_view<
char16_t, Args...> s)
190 {
return *
this << QStringView(s); }
192 template <
typename...Args>
193 QDebug &operator<<(
const std::basic_string<
wchar_t, Args...> &s)
195 if constexpr (
sizeof(
wchar_t) == 2)
196 return *
this << QStringView(s);
198 return *
this << QString::fromWCharArray(s.data(), s.size());
201 template <
typename...Args>
202 QDebug &operator<<(std::basic_string_view<
wchar_t, Args...> s)
204 if constexpr (
sizeof(
wchar_t) == 2)
205 return *
this << QStringView(s);
207 return *
this << QString::fromWCharArray(s.data(), s.size());
210 template <
typename...Args>
211 QDebug &operator<<(
const std::basic_string<
char32_t, Args...> &s)
212 {
return *
this << QString::fromUcs4(s.data(), s.size()); }
214 template <
typename...Args>
215 QDebug &operator<<(std::basic_string_view<
char32_t, Args...> s)
216 {
return *
this << QString::fromUcs4(s.data(), s.size()); }
219 template <
typename Rep,
typename Period>
220 QDebug &operator<<(std::chrono::duration<Rep, Period> duration)
222 stream->ts << duration.count();
223 putTimeUnit(Period::num, Period::den);
227#ifdef QT_SUPPORTS_INT128
231 template <
typename T>
232 using if_qint128 = std::enable_if_t<std::is_same_v<T, qint128>,
bool>;
233 template <
typename T>
234 using if_quint128 = std::enable_if_t<std::is_same_v<T, quint128>,
bool>;
236 template <
typename T, if_qint128<T> =
true>
237 QDebug &operator<<(T i128) { putInt128(&i128);
return maybeSpace(); }
238 template <
typename T, if_quint128<T> =
true>
239 QDebug &operator<<(T u128) { putUInt128(&u128);
return maybeSpace(); }
243 template <
typename T>
244 static void streamTypeErased(QDebug &d,
const void *obj)
246 d << *
static_cast<
const T*>(obj);
248 using StreamTypeErased =
void(*)(QDebug&,
const void*);
249 QT7_ONLY(Q_CORE_EXPORT)
static QString toStringImpl(StreamTypeErased s,
const void *obj);
250 QT7_ONLY(Q_CORE_EXPORT)
static QByteArray toBytesImpl(StreamTypeErased s,
const void *obj);
251 QT7_ONLY(Q_CORE_EXPORT) QDebug &putTupleLikeImplImpl(
const char *ns,
const char *what, size_t n,
252 StreamTypeErased *ops,
const void **data);
254 template <
typename TupleLike, size_t...Is>
255 QDebug &putTupleLikeImpl(
const char *ns,
const char *what,
const TupleLike &t,
256 std::index_sequence<Is...>)
258 if constexpr (
sizeof...(Is)) {
259 StreamTypeErased ops[] = {
260 &streamTypeErased<q20::remove_cvref_t<std::tuple_element_t<Is, TupleLike>>>...
262 const void *data[] = {
263 std::addressof(std::get<Is>(t))...
265 return putTupleLikeImplImpl(ns, what,
sizeof...(Is), ops, data);
267 return putTupleLikeImplImpl(ns, what, 0,
nullptr,
nullptr);
271 template <
typename TupleLike>
272 QDebug &putTupleLike(
const char *ns,
const char *what,
const TupleLike &t)
274 using Indexes = std::make_index_sequence<std::tuple_size_v<TupleLike>>;
275 return putTupleLikeImpl(ns, what, t, Indexes{});
278 template <
typename T>
279 static QString toString(
const T &object)
281 return toStringImpl(&streamTypeErased<T>, std::addressof(object));
284 template <
typename T>
285 static QByteArray toBytes(
const T &object)
287 return toBytesImpl(&streamTypeErased<T>, std::addressof(object));
290 template <
typename...Ts, if_streamable<Ts...> =
true>
291 QDebug &operator<<(
const std::tuple<Ts...> &t)
293 return putTupleLike(
"std",
"tuple", t);
297 template <
typename T>
298 using if_ordering_type = std::enable_if_t<QtOrderingPrivate::is_ordering_type_v<T>,
bool>;
300 template <
typename T, if_ordering_type<T> =
true>
301 friend QDebug operator<<(QDebug debug, T t)
303 debug.putQtOrdering(QtOrderingPrivate::orderingFlagsFor(t), Qt::partial_ordering(t));
311class QDebugStateSaver
314 Q_NODISCARD_CTOR Q_CORE_EXPORT
315 QDebugStateSaver(QDebug &dbg);
319 Q_DISABLE_COPY(QDebugStateSaver)
320 QScopedPointer<QDebugStateSaverPrivate> d;
326 inline QNoDebug &operator<<(QTextStreamFunction) {
return *
this; }
327 inline QNoDebug &operator<<(QTextStreamManipulator) {
return *
this; }
328 inline QNoDebug &space() {
return *
this; }
329 inline QNoDebug &nospace() {
return *
this; }
330 inline QNoDebug &maybeSpace() {
return *
this; }
331 inline QNoDebug "e() {
return *
this; }
332 inline QNoDebug &noquote() {
return *
this; }
333 inline QNoDebug &maybeQuote(
const char =
'"') {
return *
this; }
334 inline QNoDebug &verbosity(
int) {
return *
this; }
337 inline QNoDebug &operator<<(
const T &) {
return *
this; }
340inline QDebug &QDebug::operator=(
const QDebug &other)
342 QDebug{other}.swap(*
this);
348template <
typename SequentialContainer>
351 const QDebugStateSaver saver(debug);
352 debug.nospace() << which <<
'(';
353 typename SequentialContainer::const_iterator it = c.begin(), end = c.end();
359 debug <<
", " << *it;
366template <
typename AssociativeContainer>
369 const QDebugStateSaver saver(debug);
370 debug.nospace() << which <<
"(";
371 for (
typename AssociativeContainer::const_iterator it = c.constBegin();
372 it != c.constEnd(); ++it) {
373 debug <<
'(' << it.key() <<
", " << it.value() <<
')';
381template<
typename ...T>
382using QDebugIfHasDebugStream =
383 std::enable_if_t<std::conjunction_v<QTypeTraits::has_ostream_operator<QDebug, T>...>, QDebug>;
385template<
typename Container,
typename ...T>
386using QDebugIfHasDebugStreamContainer =
387 std::enable_if_t<std::conjunction_v<QTypeTraits::has_ostream_operator_container<QDebug, Container, T>...>, QDebug>;
392inline QDebugIfHasDebugStreamContainer<QList<T>, T> operator<<(QDebug debug,
const QList<T> &vec)
394 return QtPrivate::printSequentialContainer(
std::move(debug),
"QList", vec);
397template<
typename T, qsizetype P>
398inline QDebugIfHasDebugStream<T> operator<<(QDebug debug,
const QVarLengthArray<T, P> &vec)
400 return QtPrivate::printSequentialContainer(
std::move(debug),
"QVarLengthArray", vec);
403template <
typename T,
typename Alloc>
404inline QDebugIfHasDebugStream<T> operator<<(QDebug debug,
const std::vector<T, Alloc> &vec)
406 return QtPrivate::printSequentialContainer(
std::move(debug),
"std::vector", vec);
409template <
typename T,
std::size_t N>
410inline QDebugIfHasDebugStream<T> operator<<(QDebug debug,
const std::array<T, N> &array)
412 return QtPrivate::printSequentialContainer(
std::move(debug),
"std::array", array);
415template <
typename T,
typename Alloc>
416inline QDebugIfHasDebugStream<T> operator<<(QDebug debug,
const std::list<T, Alloc> &vec)
418 return QtPrivate::printSequentialContainer(
std::move(debug),
"std::list", vec);
422inline QDebugIfHasDebugStream<T> operator<<(QDebug debug,
std::initializer_list<T> list)
424 return QtPrivate::printSequentialContainer(
std::move(debug),
"std::initializer_list", list);
427template <
typename Key,
typename T,
typename Compare,
typename Alloc>
428inline QDebugIfHasDebugStream<Key, T> operator<<(QDebug debug,
const std::map<Key, T, Compare, Alloc> &map)
430 return QtPrivate::printSequentialContainer(
std::move(debug),
"std::map", map);
433template <
typename Key,
typename T,
typename Compare,
typename Alloc>
434inline QDebugIfHasDebugStream<Key, T> operator<<(QDebug debug,
const std::multimap<Key, T, Compare, Alloc> &map)
436 return QtPrivate::printSequentialContainer(
std::move(debug),
"std::multimap", map);
439template <
class Key,
class T>
440inline QDebugIfHasDebugStreamContainer<QMap<Key, T>, Key, T> operator<<(QDebug debug,
const QMap<Key, T> &map)
442 return QtPrivate::printAssociativeContainer(
std::move(debug),
"QMap", map);
445template <
class Key,
class T>
446inline QDebugIfHasDebugStreamContainer<QMultiMap<Key, T>, Key, T> operator<<(QDebug debug,
const QMultiMap<Key, T> &map)
448 return QtPrivate::printAssociativeContainer(
std::move(debug),
"QMultiMap", map);
451template <
class Key,
class T>
452inline QDebugIfHasDebugStreamContainer<QHash<Key, T>, Key, T> operator<<(QDebug debug,
const QHash<Key, T> &hash)
454 return QtPrivate::printAssociativeContainer(
std::move(debug),
"QHash", hash);
457template <
class Key,
class T>
458inline QDebugIfHasDebugStreamContainer<QMultiHash<Key, T>, Key, T> operator<<(QDebug debug,
const QMultiHash<Key, T> &hash)
460 return QtPrivate::printAssociativeContainer(
std::move(debug),
"QMultiHash", hash);
464inline QDebugIfHasDebugStream<T> operator<<(QDebug debug,
const std::optional<T> &opt)
467 return debug <<
std::nullopt;
468 const QDebugStateSaver saver(debug);
469 debug.nospace() <<
"std::optional(" << *opt <<
')';
473template <
class T1,
class T2>
474inline QDebugIfHasDebugStream<T1, T2> operator<<(QDebug debug,
const std::pair<T1, T2> &pair)
476 const QDebugStateSaver saver(debug);
477 debug.nospace() <<
"std::pair(" << pair.first <<
", " << pair.second <<
')';
482inline QDebugIfHasDebugStreamContainer<QSet<T>, T> operator<<(QDebug debug,
const QSet<T> &set)
484 return QtPrivate::printSequentialContainer(
std::move(debug),
"QSet", set);
488inline QDebugIfHasDebugStream<T> operator<<(QDebug debug,
const QContiguousCache<T> &cache)
490 const QDebugStateSaver saver(debug);
491 debug.nospace() <<
"QContiguousCache(";
492 for (qsizetype i = cache.firstIndex(); i <= cache.lastIndex(); ++i) {
494 if (i != cache.lastIndex())
503QDebug operator<<(QDebug debug,
const QList<T> &list);
505template <
class T, qsizetype P>
506QDebug operator<<(QDebug debug,
const QVarLengthArray<T, P> &array);
508template <
typename T,
typename Alloc>
509QDebug operator<<(QDebug debug,
const std::vector<T, Alloc> &vec);
511template <
typename T, std::size_t N>
512QDebug operator<<(QDebug debug,
const std::array<T, N> &array);
514template <
typename T,
typename Alloc>
515QDebug operator<<(QDebug debug,
const std::list<T, Alloc> &vec);
517template <
typename Key,
typename T,
typename Compare,
typename Alloc>
518QDebug operator<<(QDebug debug,
const std::map<Key, T, Compare, Alloc> &map);
520template <
typename Key,
typename T,
typename Compare,
typename Alloc>
521QDebug operator<<(QDebug debug,
const std::multimap<Key, T, Compare, Alloc> &map);
523template <
class Key,
class T>
524QDebug operator<<(QDebug debug,
const QMap<Key, T> &map);
526template <
class Key,
class T>
527QDebug operator<<(QDebug debug,
const QMultiMap<Key, T> &map);
529template <
class Key,
class T>
530QDebug operator<<(QDebug debug,
const QHash<Key, T> &hash);
532template <
class Key,
class T>
533QDebug operator<<(QDebug debug,
const QMultiHash<Key, T> &hash);
536QDebug operator<<(QDebug debug,
const QSet<T> &set);
538template <
class T1,
class T2>
539QDebug operator<<(QDebug debug,
const std::pair<T1, T2> &pair);
542QDebug operator<<(QDebug debug,
const QContiguousCache<T> &cache);
547inline QDebug operator<<(QDebug debug,
const QSharedPointer<T> &ptr)
549 QDebugStateSaver saver(debug);
550 debug.nospace() <<
"QSharedPointer(" << ptr.data() <<
")";
556template <
typename T,
typename Tag>
559 QDebugStateSaver saver(debug);
560 debug.nospace() <<
"QTaggedPointer(" << ptr.pointer() <<
", " << ptr.tag() <<
")";
564Q_CORE_EXPORT
QDebug qt_QMetaEnum_debugOperator(QDebug&, qint64 value,
const QMetaObject *meta,
const char *name);
565Q_CORE_EXPORT
QDebug qt_QMetaEnum_flagDebugOperator(QDebug &dbg, quint64 value,
const QMetaObject *meta,
const char *name);
569template <
typename Int>
572 static_assert(
std::is_unsigned_v<Int>,
573 "Cast value to an unsigned type before calling this function");
574 const QDebugStateSaver saver(debug);
576 debug.nospace() <<
"QFlags(" << Qt::hex << Qt::showbase;
577 bool needSeparator =
false;
578 for (size_t i = 0; i < sizeofT * 8; ++i) {
579 if (value & (Int(1) << i)) {
583 needSeparator =
true;
584 debug << (Int(1) << i);
590template <
class Flags,
591 typename = std::enable_if_t<QtPrivate::IsQFlags<Flags>::value,
void>,
592 typename T =
typename Flags::enum_type>
593inline QDebug operator<<(QDebug debug, Flags flags)
595 using UInt =
typename QIntegerForSizeof<T>::Unsigned;
596#if !defined(QT_NO_QOBJECT)
597 if constexpr (QtPrivate::IsQEnumHelper<T>::Value || QtPrivate::IsQEnumHelper<Flags>::Value) {
600 using Int = std::conditional_t<QtPrivate::IsQEnumHelper<Flags>::Value, UInt,
601 std::underlying_type_t<T>>;
602 const QMetaObject *obj = qt_getEnumMetaObject(T());
603 const char *name = qt_getEnumName(T());
604 return qt_QMetaEnum_flagDebugOperator(debug, Int(flags.toInt()), obj, name);
608 qt_QMetaEnum_flagDebugOperator(debug,
sizeof(T), UInt(flags.toInt()));
613#if !defined(QT_NO_QOBJECT) && !defined(Q_QDOC)
625template <
typename T,
bool IsEnum = std::is_enum_v<T>,
bool =
sizeof(T) <=
sizeof(quint64)>
626struct EnumHasQFlag {
static constexpr bool Value =
false; };
627template <
typename T>
struct EnumHasQFlag<T,
true,
true> : QtPrivate::IsQEnumHelper<QFlags<T>> {};
629template <
typename T,
bool IsEnum = std::is_enum_v<T>,
bool HasQFlag = EnumHasQFlag<T>::Value>
630struct EnumHasQEnum {
static constexpr bool Value =
false; };
631template <
typename T>
struct EnumHasQEnum<T,
true,
false> : QtPrivate::IsQEnumHelper<T> {};
635std::enable_if_t<QtPrivate::EnumHasQFlag<T>::Value, QDebug>
636operator<<(QDebug debug, T flag)
638 return debug << QFlags(flag);
642std::enable_if_t<QtPrivate::EnumHasQEnum<T>::Value, QDebug>
643operator<<(QDebug dbg, T value)
645 const QMetaObject *obj = qt_getEnumMetaObject(value);
646 const char *name = qt_getEnumName(value);
647 return qt_QMetaEnum_debugOperator(dbg,
static_cast<
typename std::underlying_type<T>::type>(value), obj, name);
651inline QDebug operator<<(QDebug debug, QKeyCombination combination)
653 QDebugStateSaver saver(debug);
654 debug.nospace() <<
"QKeyCombination("
655 << combination.keyboardModifiers()
668#define QT_FOR_EACH_CORE_FOUNDATION_TYPE(F)
679#define QT_FOR_EACH_MUTABLE_CORE_FOUNDATION_TYPE(F)
683#define QT_FOR_EACH_CORE_GRAPHICS_TYPE(F)
686#define QT_FOR_EACH_MUTABLE_CORE_GRAPHICS_TYPE(F)
692#define QT_FORWARD_DECLARE_CF_TYPE(type) Q_FORWARD_DECLARE_CF_TYPE(type);
693#define QT_FORWARD_DECLARE_MUTABLE_CF_TYPE(type) Q_FORWARD_DECLARE_MUTABLE_CF_TYPE(type);
694#define QT_FORWARD_DECLARE_CG_TYPE(type) Q_FORWARD_DECLARE_CG_TYPE(type);
695#define QT_FORWARD_DECLARE_MUTABLE_CG_TYPE(type) Q_FORWARD_DECLARE_MUTABLE_CG_TYPE(type);
698Q_FORWARD_DECLARE_CF_TYPE(CFString);
700Q_FORWARD_DECLARE_OBJC_CLASS(NSObject);
701QT_FOR_EACH_CORE_FOUNDATION_TYPE(QT_FORWARD_DECLARE_CF_TYPE)
702QT_FOR_EACH_MUTABLE_CORE_FOUNDATION_TYPE(QT_FORWARD_DECLARE_MUTABLE_CF_TYPE)
703QT_FOR_EACH_CORE_GRAPHICS_TYPE(QT_FORWARD_DECLARE_CG_TYPE)
704QT_FOR_EACH_MUTABLE_CORE_GRAPHICS_TYPE(QT_FORWARD_DECLARE_MUTABLE_CG_TYPE)
707#define QT_FORWARD_DECLARE_QDEBUG_OPERATOR_FOR_CF_TYPE(CFType)
708 Q_CORE_EXPORT QDebug operator
<<(QDebug, CFType##Ref);
710#define Q_DECLARE_QDEBUG_OPERATOR_FOR_CF_TYPE(CFType)
711 QDebug operator
<<(QDebug debug, CFType##Ref ref)
714 return debug << QT_STRINGIFY(CFType) "Ref(0x0)";
715 if (CFStringRef description = CFCopyDescription(ref)) {
716 QDebugStateSaver saver(debug);
717 debug.noquote() << description;
718 CFRelease(description);
725Q_CORE_EXPORT QDebug operator<<(QDebug, id);
727Q_CORE_EXPORT QDebug operator<<(QDebug, objc_object *);
728Q_CORE_EXPORT QDebug operator<<(QDebug,
const NSObject *);
729Q_CORE_EXPORT QDebug operator<<(QDebug, CFStringRef);
731QT_FOR_EACH_CORE_FOUNDATION_TYPE(QT_FORWARD_DECLARE_QDEBUG_OPERATOR_FOR_CF_TYPE)
732QT_FOR_EACH_MUTABLE_CORE_FOUNDATION_TYPE(QT_FORWARD_DECLARE_QDEBUG_OPERATOR_FOR_CF_TYPE)
733QT_FOR_EACH_CORE_GRAPHICS_TYPE(QT_FORWARD_DECLARE_QDEBUG_OPERATOR_FOR_CF_TYPE)
734QT_FOR_EACH_MUTABLE_CORE_GRAPHICS_TYPE(QT_FORWARD_DECLARE_QDEBUG_OPERATOR_FOR_CF_TYPE)
736#undef QT_FORWARD_DECLARE_CF_TYPE
737#undef QT_FORWARD_DECLARE_MUTABLE_CF_TYPE
738#undef QT_FORWARD_DECLARE_CG_TYPE
739#undef QT_FORWARD_DECLARE_MUTABLE_CG_TYPE
QByteArray & operator*() noexcept
QByteArray::Base64DecodingStatus decodingStatus
friend bool operator==(const QByteArray::FromBase64Result &lhs, const QByteArray::FromBase64Result &rhs) noexcept
Returns true if lhs and rhs are equal, otherwise returns false.
void swap(QByteArray::FromBase64Result &other) noexcept
operator bool() const noexcept
\variable QByteArray::FromBase64Result::decoded
const QByteArray & operator*() const noexcept
Returns the decoded byte array.
friend bool operator!=(const QByteArray::FromBase64Result &lhs, const QByteArray::FromBase64Result &rhs) noexcept
Returns true if lhs and rhs are different, otherwise returns false.
\inmodule QtCore\reentrant
int initFrom(const QMessageLogContext &logContext)
void populateBacktrace(int frameCount)
QInternalMessageLogContext(const QMessageLogContext &logContext, const QLoggingCategory &categoryOverride)
std::optional< BacktraceStorage > backtrace
static constexpr int DefaultBacktraceDepth
static void setFilterRules(const QString &rules)
Configures which categories and message types should be enabled through a set of rules.
~QLoggingCategory()
Destroys a QLoggingCategory object.
bool isInfoEnabled() const
Returns true if informational messages should be shown for this category; false otherwise.
static QLoggingCategory * defaultCategory()
Returns a pointer to the global category "default" that is used, for example, by qDebug(),...
QLoggingCategory & operator()()
Returns the object itself.
void(*) CategoryFilter(QLoggingCategory *)
This is a typedef for a pointer to a function with the following signature:
void setEnabled(QtMsgType type, bool enable)
Changes the message type type for the category to enable.
static CategoryFilter installFilter(CategoryFilter)
Take control of how logging categories are configured.
bool isWarningEnabled() const
Returns true if warning messages should be shown for this category; false otherwise.
bool isEnabled(QtMsgType type) const
Returns true if a message of type msgtype for the category should be shown; false otherwise.
bool isCriticalEnabled() const
Returns true if critical messages should be shown for this category; false otherwise.
const char * categoryName() const
Returns the name of the category.
bool isDebugEnabled() const
Returns true if debug messages should be shown for this category; false otherwise.
constexpr QMessageLogContext(const char *fileName, int lineNumber, const char *functionName, const char *categoryName) noexcept
constexpr QMessageLogContext() noexcept=default
QDebug debug(CategoryFunction catFunc) const
Logs a debug message into category returned by catFunc using a QDebug stream.
QDebug debug(const QLoggingCategory &cat) const
Logs a debug message into category cat using a QDebug stream.
void void void void Q_DECL_COLD_FUNCTION void Q_DECL_COLD_FUNCTION void Q_DECL_COLD_FUNCTION void Q_DECL_COLD_FUNCTION void QT_MESSAGE_LOGGER_NORETURN Q_DECL_COLD_FUNCTION void QT_MESSAGE_LOGGER_NORETURN Q_DECL_COLD_FUNCTION void QDebug debug() const
Logs a debug message using a QDebug stream.
QDebug info(const QLoggingCategory &cat) const
Logs an informational message into the category cat using a QDebug stream.
QDebug info() const
Logs an informational message using a QDebug stream.
QDebug info(CategoryFunction catFunc) const
Logs an informational message into category returned by catFunc using a QDebug stream.
QNoDebug noDebug() const noexcept
constexpr size_type capacity() const noexcept
Q_ALWAYS_INLINE constexpr void verify(qsizetype pos=0, qsizetype n=1) const
constexpr bool empty() const noexcept
constexpr size_type size() const noexcept
value_type value(qsizetype i, const T &defaultValue) const
const_reverse_iterator rend() const noexcept
void remove(qsizetype i, qsizetype n=1)
void reallocate_impl(qsizetype prealloc, void *array, qsizetype size, qsizetype alloc)
const_reference operator[](qsizetype idx) const
value_type value(qsizetype i) const
const_reverse_iterator rbegin() const noexcept
reference emplace_back_impl(qsizetype prealloc, void *array, Args &&...args)
bool less_than(const QVLABase< S > &other) const
qsizetype removeIf(Predicate pred)
iterator erase(const_iterator pos)
const_reference back() const
reverse_iterator rbegin() noexcept
const_iterator cbegin() const noexcept
qsizetype lastIndexOf(const AT &t, qsizetype from=-1) const
void resize_impl(qsizetype prealloc, void *array, qsizetype sz, const T &v)
void growBy(qsizetype prealloc, void *array, qsizetype increment)
bool removeOne(const AT &t)
bool equal(const QVLABase< S > &other) const
iterator erase(const_iterator begin, const_iterator end)
const_reference front() const
bool isValidIterator(const const_iterator &i) const
const_iterator cend() const noexcept
static constexpr qsizetype maxSize() noexcept
const T * data() const noexcept
const_reverse_iterator crbegin() const noexcept
void resize_impl(qsizetype prealloc, void *array, qsizetype sz)
void replace(qsizetype i, const T &t)
iterator insert_impl(qsizetype prealloc, void *array, const_iterator pos, qsizetype n, const T &t)
void assign_impl(qsizetype prealloc, void *array, Iterator first, Iterator last)
reference operator[](qsizetype idx)
size_t hash(size_t seed) const noexcept(QtPrivate::QNothrowHashable_v< T >)
Q_OUTOFLINE_TEMPLATE void assign_impl(qsizetype prealloc, void *array, Iterator first, Iterator last)
const_iterator end() const noexcept
qsizetype indexOf(const AT &t, qsizetype from=0) const
const_iterator begin() const noexcept
qsizetype removeAll(const AT &t)
Q_INLINE_TEMPLATE bool contains(const AT &t) const
void append_impl(qsizetype prealloc, void *array, const T *buf, qsizetype n)
const_reverse_iterator crend() const noexcept
bool contains(const AT &t) const
reverse_iterator rend() noexcept
constexpr qsizetype max_size() const noexcept
void assign_impl(qsizetype prealloc, void *array, qsizetype n, const T &t)
iterator begin() noexcept
iterator emplace_impl(qsizetype prealloc, void *array, const_iterator pos, Args &&...arg)
Q_OUTOFLINE_TEMPLATE auto emplace_impl(qsizetype prealloc, void *array, const_iterator before, Args &&...args) -> iterator
friend QTypeTraits::compare_lt_result< U > operator>(const QVarLengthArray< T, Prealloc > &lhs, const QVarLengthArray< T, Prealloc2 > &rhs) noexcept(noexcept(lhs< rhs))
QVarLengthArray & assign(InputIterator first, InputIterator last)
QVarLengthArray< T, Prealloc > & operator+=(const T &t)
iterator insert(const_iterator before, T &&x)
T & emplace_back(Args &&...args)
const T & at(qsizetype idx) const
void resize(qsizetype sz)
QVarLengthArray< T, Prealloc > & operator=(const QVarLengthArray< T, Prealloc > &other)
QVarLengthArray(qsizetype sz, const T &v)
QVarLengthArray(const QVarLengthArray &other)
QVarLengthArray(qsizetype size)
iterator insert(const_iterator before, qsizetype n, const T &x)
QVarLengthArray(InputIterator first, InputIterator last)
iterator emplace(const_iterator pos, Args &&...args)
void insert(qsizetype i, T &&t)
QVarLengthArray(QVarLengthArray &&other) noexcept(std::is_nothrow_move_constructible_v< T >)
friend QTypeTraits::compare_lt_result< U > operator<=(const QVarLengthArray< T, Prealloc > &lhs, const QVarLengthArray< T, Prealloc2 > &rhs) noexcept(noexcept(lhs< rhs))
QVarLengthArray & operator=(QVarLengthArray &&other) noexcept(std::is_nothrow_move_constructible_v< T >)
static constexpr qsizetype PreallocatedSize
friend QTypeTraits::compare_eq_result< U > operator==(const QVarLengthArray< T, Prealloc > &l, const QVarLengthArray< T, Prealloc2 > &r)
QVarLengthArray & assign(qsizetype n, const T &t)
QVarLengthArray< T, Prealloc > & operator+=(T &&t)
const_iterator constEnd() const
friend QTypeTraits::compare_eq_result< U > operator!=(const QVarLengthArray< T, Prealloc > &l, const QVarLengthArray< T, Prealloc2 > &r)
friend QTypeTraits::compare_lt_result< U > operator>=(const QVarLengthArray< T, Prealloc > &lhs, const QVarLengthArray< T, Prealloc2 > &rhs) noexcept(noexcept(lhs< rhs))
void resize(qsizetype sz, const T &v)
void append(const T *buf, qsizetype sz)
QVarLengthArray< T, Prealloc > & operator=(std::initializer_list< T > list)
QVarLengthArray(std::initializer_list< T > args)
iterator insert(const_iterator before, const T &x)
friend QTypeTraits::compare_lt_result< U > operator<(const QVarLengthArray< T, Prealloc > &lhs, const QVarLengthArray< T, Prealloc2 > &rhs) noexcept(noexcept(std::lexicographical_compare(lhs.begin(), lhs.end(), rhs.begin(), rhs.end())))
void insert(qsizetype i, const T &t)
const T * constData() const
void push_back(const T &t)
auto constBegin() const -> const_iterator
QVarLengthArray() noexcept
void reserve(qsizetype sz)
QVarLengthArray & assign(std::initializer_list< T > list)
void insert(qsizetype i, qsizetype n, const T &t)
static const char ifCriticalTokenC[]
static const char emptyTokenC[]
static Q_NEVER_INLINE void qt_message(QtMsgType msgType, const QMessageLogContext &context, const char *msg, va_list ap)
static void preformattedMessageHandler(QtMsgType type, const QMessageLogContext &context, const QString &formattedMessage)
static bool systemHasStderr()
Returns true if writing to stderr is supported.
static const char endifTokenC[]
static bool isDefaultCategory(const char *category)
static const char messageTokenC[]
static constexpr SystemMessageSink systemMessageSink
#define HANDLE_IF_TOKEN(LEVEL)
static const char defaultPattern[]
static const char timeTokenC[]
static bool is_fatal_count_down(QAtomicInt &n)
static const char qthreadptrTokenC[]
static const char fileTokenC[]
static const char ifDebugTokenC[]
static const char ifFatalTokenC[]
static const char categoryTokenC[]
static const char lineTokenC[]
static const char typeTokenC[]
static const char ifCategoryTokenC[]
static int checked_var_value(const char *varname)
static const char pidTokenC[]
Q_TRACE_POINT(qtcore, qt_message_print, int type, const char *category, const char *function, const char *file, int line, const QString &message)
static const char threadidTokenC[]
static QString formatLogMessage(QtMsgType type, const QMessageLogContext &context, const QString &str)
static const char backtraceTokenC[]
static const char functionTokenC[]
static const char ifWarningTokenC[]
static const char appnameTokenC[]
static Q_NORETURN void qt_message_fatal(QtMsgType, const QMessageLogContext &context, String &&message)
\inmodule QtCore \title Qt Logging Types
static bool isFatal(QtMsgType msgType)
static const char ifInfoTokenC[]
static void qt_message_print(QtMsgType, const QMessageLogContext &context, const QString &message)
static bool stderrHasConsoleAttached()
Returns true if writing to stderr will end up in a console/terminal visible to the user.
Combined button and popup list for selecting options.
QDebug printAssociativeContainer(QDebug debug, const char *which, const AssociativeContainer &c)
bool shouldLogToStderr()
Returns true if logging stderr should be ensured.
QDebug printSequentialContainer(QDebug debug, const char *which, const SequentialContainer &c)
QByteArray operator""_ba(const char *str, size_t size) noexcept
QByteArray operator+(const QByteArray &a1, const char *a2)
QByteArray qUncompress(const QByteArray &data)
QByteArray operator+(char a1, const QByteArray &a2)
QByteArray operator+(QByteArray &&lhs, char rhs)
QByteArray operator+(const QByteArray &a1, char a2)
QByteArray operator+(const char *a1, const QByteArray &a2)
QByteArray operator+(QByteArray &&lhs, const QByteArray &rhs)
qsizetype erase_if(QByteArray &ba, Predicate pred)
QByteArray operator+(const QByteArray &a1, const QByteArray &a2)
QByteArray qCompress(const QByteArray &data, int compressionLevel=-1)
qsizetype erase(QByteArray &ba, const T &t)
QByteArray operator+(QByteArray &&lhs, const char *rhs)
void qt_QMetaEnum_flagDebugOperator(QDebug &debug, size_t sizeofT, Int value)
Q_CORE_EXPORT void qt_QMetaEnum_flagDebugOperator(QDebug &debug, size_t sizeofT, quint64 value)
Q_CORE_EXPORT QDebug operator<<(QDebug debug, QDir::Filters filters)
#define QT_MESSAGELOG_FUNC
Q_CORE_EXPORT Q_DECL_COLD_FUNCTION void qErrnoWarning(int code, const char *msg,...)
Q_CORE_EXPORT Q_DECL_COLD_FUNCTION void qErrnoWarning(const char *msg,...)
#define QT_MESSAGELOG_FILE
#define QT_MESSAGE_LOGGER_NORETURN
#define QT_MESSAGELOG_LINE
Q_CORE_EXPORT void qSetMessagePattern(const QString &messagePattern)
#define QT_MESSAGELOGCONTEXT
Q_CORE_EXPORT void qt_message_output(QtMsgType, const QMessageLogContext &context, const QString &message)
void(* QtMessageHandler)(QtMsgType, const QMessageLogContext &, const QString &)
#define Q_LOGGING_CATEGORY(name,...)
#define QT_MESSAGE_LOGGER_COMMON(category, level)
#define Q_DECLARE_LOGGING_CATEGORY(name)
QScopeGuard(F(&)()) -> QScopeGuard< F(*)()>
QScopeGuard< typename std::decay< F >::type > qScopeGuard(F &&f)
[qScopeGuard]
qsizetype erase(QVarLengthArray< T, Prealloc > &array, const AT &t)
qsizetype erase_if(QVarLengthArray< T, Prealloc > &array, Predicate pred)
size_t qHash(const QVarLengthArray< T, Prealloc > &key, size_t seed=0) noexcept(QtPrivate::QNothrowHashable_v< T >)
void setPattern(const QString &pattern)
std::unique_ptr< std::unique_ptr< const char[]>[]> literals
std::unique_ptr< const char *[]> tokens
QList< QString > timeArgs
void operator()(void *p) const noexcept