Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Loading...
Searching...
No Matches
qdebug.h
Go to the documentation of this file.
1// Copyright (C) 2016 The Qt Company Ltd.
2// Copyright (C) 2016 Intel Corporation.
3// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
4
5#ifndef QDEBUG_H
6#define QDEBUG_H
7
8#if 0
9#pragma qt_class(QtDebug)
10#endif
11
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>
20
21// all these have already been included by various headers above, but don't rely on indirect includes:
22#include <array>
23#include <chrono>
24#include <list>
25#include <map>
26#include <memory>
27#include <optional>
28#include <string>
29#include <string_view>
30#include <tuple>
31#include <QtCore/q20type_traits.h>
32#include <utility>
33#include <vector>
34
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>
40#endif
41
42QT_BEGIN_NAMESPACE
43
44class QT6_ONLY(Q_CORE_EXPORT) QDebug : public QIODeviceBase
45{
46 friend class QMessageLogger;
47 friend class QDebugStateSaver;
48 friend class QDebugStateSaverPrivate;
49 struct Stream {
50 enum { VerbosityShift = 29, VerbosityMask = 0x7 };
51
52 explicit Stream(QIODevice *device)
53 : ts(device)
54 {}
55 explicit Stream(QString *string)
56 : ts(string, WriteOnly)
57 {}
58 explicit Stream(QByteArray *ba)
59 : ts(ba, WriteOnly)
60 {}
61 explicit Stream(QtMsgType t)
62 : ts(&buffer, WriteOnly),
63 type(t),
64 message_output(true)
65 {}
66 QTextStream ts;
67 QString buffer;
68 int ref = 1;
69 QtMsgType type = QtDebugMsg;
70 bool space = true;
71 bool noQuotes = false;
72 bool message_output = false;
73 int verbosity = DefaultVerbosity;
74 QMessageLogContext context;
75 } *stream;
76
77 enum Latin1Content { ContainsBinary = 0, ContainsLatin1 };
78
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);
87
88 template <typename...Ts>
89 using if_streamable = std::enable_if_t<
90 std::conjunction_v<QTypeTraits::has_ostream_operator<QDebug, Ts>...>
91 , bool>;
92public:
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)
101 ~QDebug();
102 void swap(QDebug &other) noexcept { qt_ptr_swap(stream, other.stream); }
103
104 QT7_ONLY(Q_CORE_EXPORT) QDebug &resetFormat();
105
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 };
113
114 bool autoInsertSpaces() const { return stream->space; }
115 void setAutoInsertSpaces(bool b) { stream->space = b; }
116
117 [[nodiscard]] bool quoteStrings() const noexcept { return !stream->noQuotes; }
118 void setQuoteStrings(bool b) { stream->noQuotes = !b; }
119
120 inline QDebug &quote() { 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; }
123
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) {
152 stream->ts << f;
153 return *this;
154 }
155
156 inline QDebug &operator<<(QTextStreamManipulator m)
157 { stream->ts << m; return *this; }
158
159#ifdef Q_QDOC
160 template <typename Char, typename...Args>
161 QDebug &operator<<(const std::basic_string<Char, Args...> &s);
162
163 template <typename Char, typename...Args>
164 QDebug &operator<<(std::basic_string_view<Char, Args...> s);
165#else
166 template <typename...Args>
167 QDebug &operator<<(const std::basic_string<char, Args...> &s)
168 { return *this << QUtf8StringView(s); }
169
170 template <typename...Args>
171 QDebug &operator<<(std::basic_string_view<char, Args...> s)
172 { return *this << QUtf8StringView(s); }
173
174#ifdef __cpp_char8_t
175 template <typename...Args>
176 QDebug &operator<<(const std::basic_string<char8_t, Args...> &s)
177 { return *this << QUtf8StringView(s); }
178
179 template <typename...Args>
180 QDebug &operator<<(std::basic_string_view<char8_t, Args...> s)
181 { return *this << QUtf8StringView(s); }
182#endif // __cpp_char8_t
183
184 template <typename...Args>
185 QDebug &operator<<(const std::basic_string<char16_t, Args...> &s)
186 { return *this << QStringView(s); }
187
188 template <typename...Args>
189 QDebug &operator<<(std::basic_string_view<char16_t, Args...> s)
190 { return *this << QStringView(s); }
191
192 template <typename...Args>
193 QDebug &operator<<(const std::basic_string<wchar_t, Args...> &s)
194 {
195 if constexpr (sizeof(wchar_t) == 2)
196 return *this << QStringView(s);
197 else
198 return *this << QString::fromWCharArray(s.data(), s.size()); // ### optimize
199 }
200
201 template <typename...Args>
202 QDebug &operator<<(std::basic_string_view<wchar_t, Args...> s)
203 {
204 if constexpr (sizeof(wchar_t) == 2)
205 return *this << QStringView(s);
206 else
207 return *this << QString::fromWCharArray(s.data(), s.size()); // ### optimize
208 }
209
210 template <typename...Args>
211 QDebug &operator<<(const std::basic_string<char32_t, Args...> &s)
212 { return *this << QString::fromUcs4(s.data(), s.size()); }
213
214 template <typename...Args>
215 QDebug &operator<<(std::basic_string_view<char32_t, Args...> s)
216 { return *this << QString::fromUcs4(s.data(), s.size()); }
217#endif // !Q_QDOC
218
219 template <typename Rep, typename Period>
220 QDebug &operator<<(std::chrono::duration<Rep, Period> duration)
221 {
222 stream->ts << duration.count();
223 putTimeUnit(Period::num, Period::den);
224 return maybeSpace();
225 }
226
227#ifdef QT_SUPPORTS_INT128
228private:
229 // Constrained templates so they only match q(u)int128 without conversions.
230 // Also keeps these operators out of the ABI.
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>;
235public:
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(); }
240#endif // QT_SUPPORTS_INT128
241
242private:
243 template <typename T>
244 static void streamTypeErased(QDebug &d, const void *obj)
245 {
246 d << *static_cast<const T*>(obj);
247 }
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);
253
254 template <typename TupleLike, size_t...Is>
255 QDebug &putTupleLikeImpl(const char *ns, const char *what, const TupleLike &t,
256 std::index_sequence<Is...>)
257 {
258 if constexpr (sizeof...(Is)) {
259 StreamTypeErased ops[] = {
260 &streamTypeErased<q20::remove_cvref_t<std::tuple_element_t<Is, TupleLike>>>...
261 };
262 const void *data[] = {
263 std::addressof(std::get<Is>(t))...
264 };
265 return putTupleLikeImplImpl(ns, what, sizeof...(Is), ops, data);
266 } else {
267 return putTupleLikeImplImpl(ns, what, 0, nullptr, nullptr);
268 }
269 }
270
271 template <typename TupleLike>
272 QDebug &putTupleLike(const char *ns, const char *what, const TupleLike &t)
273 {
274 using Indexes = std::make_index_sequence<std::tuple_size_v<TupleLike>>;
275 return putTupleLikeImpl(ns, what, t, Indexes{});
276 }
277public:
278 template <typename T>
279 static QString toString(const T &object)
280 {
281 return toStringImpl(&streamTypeErased<T>, std::addressof(object));
282 }
283
284 template <typename T>
285 static QByteArray toBytes(const T &object)
286 {
287 return toBytesImpl(&streamTypeErased<T>, std::addressof(object));
288 }
289
290 template <typename...Ts, if_streamable<Ts...> = true>
291 QDebug &operator<<(const std::tuple<Ts...> &t)
292 {
293 return putTupleLike("std", "tuple", t);
294 }
295
296private:
297 template <typename T>
298 using if_ordering_type = std::enable_if_t<QtOrderingPrivate::is_ordering_type_v<T>, bool>;
299
300 template <typename T, if_ordering_type<T> = true>
301 friend QDebug operator<<(QDebug debug, T t)
302 {
303 debug.putQtOrdering(QtOrderingPrivate::orderingFlagsFor(t), Qt::partial_ordering(t));
304 return debug;
305 }
306};
307
309
311class QDebugStateSaver
312{
313public:
314 Q_NODISCARD_CTOR Q_CORE_EXPORT
315 QDebugStateSaver(QDebug &dbg);
316 Q_CORE_EXPORT
317 ~QDebugStateSaver();
318private:
319 Q_DISABLE_COPY(QDebugStateSaver)
320 QScopedPointer<QDebugStateSaverPrivate> d;
321};
322
323class QNoDebug
324{
325public:
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 &quote() { return *this; }
332 inline QNoDebug &noquote() { return *this; }
333 inline QNoDebug &maybeQuote(const char = '"') { return *this; }
334 inline QNoDebug &verbosity(int) { return *this; }
335
336 template<typename T>
337 inline QNoDebug &operator<<(const T &) { return *this; }
338};
339
340inline QDebug &QDebug::operator=(const QDebug &other)
341{
342 QDebug{other}.swap(*this);
343 return *this;
344}
345
346namespace QtPrivate {
347
348template <typename SequentialContainer>
349inline QDebug printSequentialContainer(QDebug debug, const char *which, const SequentialContainer &c)
350{
351 const QDebugStateSaver saver(debug);
352 debug.nospace() << which << '(';
353 typename SequentialContainer::const_iterator it = c.begin(), end = c.end();
354 if (it != end) {
355 debug << *it;
356 ++it;
357 }
358 while (it != end) {
359 debug << ", " << *it;
360 ++it;
361 }
362 debug << ')';
363 return debug;
364}
365
366template <typename AssociativeContainer>
367inline QDebug printAssociativeContainer(QDebug debug, const char *which, const AssociativeContainer &c)
368{
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() << ')';
374 }
375 debug << ')';
376 return debug;
377}
378
379} // namespace QtPrivate
380
381template<typename ...T>
382using QDebugIfHasDebugStream =
383 std::enable_if_t<std::conjunction_v<QTypeTraits::has_ostream_operator<QDebug, T>...>, QDebug>;
384
385template<typename Container, typename ...T>
386using QDebugIfHasDebugStreamContainer =
387 std::enable_if_t<std::conjunction_v<QTypeTraits::has_ostream_operator_container<QDebug, Container, T>...>, QDebug>;
388
389#ifndef Q_QDOC
390
391template<typename T>
392inline QDebugIfHasDebugStreamContainer<QList<T>, T> operator<<(QDebug debug, const QList<T> &vec)
393{
394 return QtPrivate::printSequentialContainer(std::move(debug), "QList", vec);
395}
396
397template<typename T, qsizetype P>
398inline QDebugIfHasDebugStream<T> operator<<(QDebug debug, const QVarLengthArray<T, P> &vec)
399{
400 return QtPrivate::printSequentialContainer(std::move(debug), "QVarLengthArray", vec);
401}
402
403template <typename T, typename Alloc>
404inline QDebugIfHasDebugStream<T> operator<<(QDebug debug, const std::vector<T, Alloc> &vec)
405{
406 return QtPrivate::printSequentialContainer(std::move(debug), "std::vector", vec);
407}
408
409template <typename T, std::size_t N>
410inline QDebugIfHasDebugStream<T> operator<<(QDebug debug, const std::array<T, N> &array)
411{
412 return QtPrivate::printSequentialContainer(std::move(debug), "std::array", array);
413}
414
415template <typename T, typename Alloc>
416inline QDebugIfHasDebugStream<T> operator<<(QDebug debug, const std::list<T, Alloc> &vec)
417{
418 return QtPrivate::printSequentialContainer(std::move(debug), "std::list", vec);
419}
420
421template <typename T>
422inline QDebugIfHasDebugStream<T> operator<<(QDebug debug, std::initializer_list<T> list)
423{
424 return QtPrivate::printSequentialContainer(std::move(debug), "std::initializer_list", list);
425}
426
427template <typename Key, typename T, typename Compare, typename Alloc>
428inline QDebugIfHasDebugStream<Key, T> operator<<(QDebug debug, const std::map<Key, T, Compare, Alloc> &map)
429{
430 return QtPrivate::printSequentialContainer(std::move(debug), "std::map", map); // yes, sequential: *it is std::pair
431}
432
433template <typename Key, typename T, typename Compare, typename Alloc>
434inline QDebugIfHasDebugStream<Key, T> operator<<(QDebug debug, const std::multimap<Key, T, Compare, Alloc> &map)
435{
436 return QtPrivate::printSequentialContainer(std::move(debug), "std::multimap", map); // yes, sequential: *it is std::pair
437}
438
439template <class Key, class T>
440inline QDebugIfHasDebugStreamContainer<QMap<Key, T>, Key, T> operator<<(QDebug debug, const QMap<Key, T> &map)
441{
442 return QtPrivate::printAssociativeContainer(std::move(debug), "QMap", map);
443}
444
445template <class Key, class T>
446inline QDebugIfHasDebugStreamContainer<QMultiMap<Key, T>, Key, T> operator<<(QDebug debug, const QMultiMap<Key, T> &map)
447{
448 return QtPrivate::printAssociativeContainer(std::move(debug), "QMultiMap", map);
449}
450
451template <class Key, class T>
452inline QDebugIfHasDebugStreamContainer<QHash<Key, T>, Key, T> operator<<(QDebug debug, const QHash<Key, T> &hash)
453{
454 return QtPrivate::printAssociativeContainer(std::move(debug), "QHash", hash);
455}
456
457template <class Key, class T>
458inline QDebugIfHasDebugStreamContainer<QMultiHash<Key, T>, Key, T> operator<<(QDebug debug, const QMultiHash<Key, T> &hash)
459{
460 return QtPrivate::printAssociativeContainer(std::move(debug), "QMultiHash", hash);
461}
462
463template <class T>
464inline QDebugIfHasDebugStream<T> operator<<(QDebug debug, const std::optional<T> &opt)
465{
466 if (!opt)
467 return debug << std::nullopt;
468 const QDebugStateSaver saver(debug);
469 debug.nospace() << "std::optional(" << *opt << ')';
470 return debug;
471}
472
473template <class T1, class T2>
474inline QDebugIfHasDebugStream<T1, T2> operator<<(QDebug debug, const std::pair<T1, T2> &pair)
475{
476 const QDebugStateSaver saver(debug);
477 debug.nospace() << "std::pair(" << pair.first << ", " << pair.second << ')';
478 return debug;
479}
480
481template <typename T>
482inline QDebugIfHasDebugStreamContainer<QSet<T>, T> operator<<(QDebug debug, const QSet<T> &set)
483{
484 return QtPrivate::printSequentialContainer(std::move(debug), "QSet", set);
485}
486
487template <class T>
488inline QDebugIfHasDebugStream<T> operator<<(QDebug debug, const QContiguousCache<T> &cache)
489{
490 const QDebugStateSaver saver(debug);
491 debug.nospace() << "QContiguousCache(";
492 for (qsizetype i = cache.firstIndex(); i <= cache.lastIndex(); ++i) {
493 debug << cache[i];
494 if (i != cache.lastIndex())
495 debug << ", ";
496 }
497 debug << ')';
498 return debug;
499}
500
501#else
502template <class T>
503QDebug operator<<(QDebug debug, const QList<T> &list);
504
505template <class T, qsizetype P>
506QDebug operator<<(QDebug debug, const QVarLengthArray<T, P> &array);
507
508template <typename T, typename Alloc>
509QDebug operator<<(QDebug debug, const std::vector<T, Alloc> &vec);
510
511template <typename T, std::size_t N>
512QDebug operator<<(QDebug debug, const std::array<T, N> &array);
513
514template <typename T, typename Alloc>
515QDebug operator<<(QDebug debug, const std::list<T, Alloc> &vec);
516
517template <typename Key, typename T, typename Compare, typename Alloc>
518QDebug operator<<(QDebug debug, const std::map<Key, T, Compare, Alloc> &map);
519
520template <typename Key, typename T, typename Compare, typename Alloc>
521QDebug operator<<(QDebug debug, const std::multimap<Key, T, Compare, Alloc> &map);
522
523template <class Key, class T>
524QDebug operator<<(QDebug debug, const QMap<Key, T> &map);
525
526template <class Key, class T>
527QDebug operator<<(QDebug debug, const QMultiMap<Key, T> &map);
528
529template <class Key, class T>
530QDebug operator<<(QDebug debug, const QHash<Key, T> &hash);
531
532template <class Key, class T>
533QDebug operator<<(QDebug debug, const QMultiHash<Key, T> &hash);
534
535template <typename T>
536QDebug operator<<(QDebug debug, const QSet<T> &set);
537
538template <class T1, class T2>
539QDebug operator<<(QDebug debug, const std::pair<T1, T2> &pair);
540
541template <typename T>
542QDebug operator<<(QDebug debug, const QContiguousCache<T> &cache);
543
544#endif // Q_QDOC
545
546template <class T>
547inline QDebug operator<<(QDebug debug, const QSharedPointer<T> &ptr)
548{
549 QDebugStateSaver saver(debug);
550 debug.nospace() << "QSharedPointer(" << ptr.data() << ")";
551 return debug;
552}
553
554template <typename T, typename Tag> class QTaggedPointer;
555
556template <typename T, typename Tag>
557inline QDebug operator<<(QDebug debug, const QTaggedPointer<T, Tag> &ptr)
558{
559 QDebugStateSaver saver(debug);
560 debug.nospace() << "QTaggedPointer(" << ptr.pointer() << ", " << ptr.tag() << ")";
561 return debug;
562}
563
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);
566Q_CORE_EXPORT void qt_QMetaEnum_flagDebugOperator(QDebug &debug, size_t sizeofT, uint value);
567Q_CORE_EXPORT void qt_QMetaEnum_flagDebugOperator(QDebug &debug, size_t sizeofT, quint64 value);
568
569template <typename Int>
570void qt_QMetaEnum_flagDebugOperator(QDebug &debug, size_t sizeofT, Int value)
571{
572 static_assert(std::is_unsigned_v<Int>,
573 "Cast value to an unsigned type before calling this function");
574 const QDebugStateSaver saver(debug);
575 debug.resetFormat();
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)) {
580 if (needSeparator)
581 debug << '|';
582 else
583 needSeparator = true;
584 debug << (Int(1) << i);
585 }
586 }
587 debug << ')';
588}
589
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)
594{
595 using UInt = typename QIntegerForSizeof<T>::Unsigned;
596#if !defined(QT_NO_QOBJECT)
597 if constexpr (QtPrivate::IsQEnumHelper<T>::Value || QtPrivate::IsQEnumHelper<Flags>::Value) {
598 // if QFlags<T> is a Q_FLAG, we always zero-extend; if not, we need to
599 // allow it to sign-extend if it is signed (see QMetaEnum::valueToKeys)
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);
605 } else
606#endif
607 {
608 qt_QMetaEnum_flagDebugOperator(debug, sizeof(T), UInt(flags.toInt()));
609 return debug;
610 }
611}
612
613#if !defined(QT_NO_QOBJECT) && !defined(Q_QDOC)
614// Debugging of plain enums. There are three cases:
615// 1) the enum is part of a Q_DECLARE_FLAGS and there's a Q_FLAG for that
616// -> debugs as that QFlags (even if a Q_ENUM is present)
617// 2) the enum is declared a Q_ENUM but is not part of a Q_DECLARE_FLAGS
618// -> debugs via qt_QMetaEnum_debugOperator()
619// 3) the enum is not associated with a QMetaObject
620// -> no streaming
621// To avoid ambiguity in overload resolution, the template conditions are
622// mutually exclusive.
623
624namespace QtPrivate {
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>> {};
628
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> {};
632}
633
634template <typename T>
635std::enable_if_t<QtPrivate::EnumHasQFlag<T>::Value, QDebug> // case 1
636operator<<(QDebug debug, T flag)
637{
638 return debug << QFlags(flag);
639}
640
641template<typename T>
642std::enable_if_t<QtPrivate::EnumHasQEnum<T>::Value, QDebug> // case 2
643operator<<(QDebug dbg, T value)
644{
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);
648}
649#endif // !QT_NO_QOBJECT && !Q_QDOC
650
651inline QDebug operator<<(QDebug debug, QKeyCombination combination)
652{
653 QDebugStateSaver saver(debug);
654 debug.nospace() << "QKeyCombination("
655 << combination.keyboardModifiers()
656 << ", "
657 << combination.key()
658 << ")";
659 return debug;
660}
661
662#ifdef Q_OS_DARWIN
663
664// We provide QDebug stream operators for commonly used Core Foundation
665// and Core Graphics types, as well as NSObject. Additional CF/CG types
666// may be added by the user, using Q_DECLARE_QDEBUG_OPERATOR_FOR_CF_TYPE.
667
668#define QT_FOR_EACH_CORE_FOUNDATION_TYPE(F)
669 F(CFArray)
670 F(CFURL)
671 F(CFData)
672 F(CFNumber)
673 F(CFDictionary)
674 F(CFLocale)
675 F(CFDate)
676 F(CFBoolean)
677 F(CFTimeZone)
678
679#define QT_FOR_EACH_MUTABLE_CORE_FOUNDATION_TYPE(F)
680 F(CFError)
681 F(CFBundle)
682
683#define QT_FOR_EACH_CORE_GRAPHICS_TYPE(F)
684 F(CGPath)
685
686#define QT_FOR_EACH_MUTABLE_CORE_GRAPHICS_TYPE(F)
687 F(CGColorSpace)
688 F(CGImage)
689 F(CGFont)
690 F(CGColor)
691
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);
696
697QT_END_NAMESPACE
698Q_FORWARD_DECLARE_CF_TYPE(CFString);
699struct objc_object;
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)
705QT_BEGIN_NAMESPACE
706
707#define QT_FORWARD_DECLARE_QDEBUG_OPERATOR_FOR_CF_TYPE(CFType)
708 Q_CORE_EXPORT QDebug operator<<(QDebug, CFType##Ref);
709
710#define Q_DECLARE_QDEBUG_OPERATOR_FOR_CF_TYPE(CFType)
711 QDebug operator<<(QDebug debug, CFType##Ref ref)
712 {
713 if (!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);
719 }
720 return debug;
721 }
722
723// Defined in qcore_mac_objc.mm
724#if defined(__OBJC__)
725Q_CORE_EXPORT QDebug operator<<(QDebug, id);
726#endif
727Q_CORE_EXPORT QDebug operator<<(QDebug, objc_object *);
728Q_CORE_EXPORT QDebug operator<<(QDebug, const NSObject *);
729Q_CORE_EXPORT QDebug operator<<(QDebug, CFStringRef);
730
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)
735
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
740
741#endif // Q_OS_DARWIN
742
743QT_END_NAMESPACE
744
745#endif // QDEBUG_H
QByteArray & operator*() noexcept
Definition qbytearray.h:771
QByteArray::Base64DecodingStatus decodingStatus
Definition qbytearray.h:756
friend bool operator==(const QByteArray::FromBase64Result &lhs, const QByteArray::FromBase64Result &rhs) noexcept
Returns true if lhs and rhs are equal, otherwise returns false.
Definition qbytearray.h:775
void swap(QByteArray::FromBase64Result &other) noexcept
Definition qbytearray.h:758
operator bool() const noexcept
\variable QByteArray::FromBase64Result::decoded
Definition qbytearray.h:764
const QByteArray & operator*() const noexcept
Returns the decoded byte array.
Definition qbytearray.h:772
friend bool operator!=(const QByteArray::FromBase64Result &lhs, const QByteArray::FromBase64Result &rhs) noexcept
Returns true if lhs and rhs are different, otherwise returns false.
Definition qbytearray.h:786
\inmodule QtCore
Definition qbytearray.h:57
\inmodule QtCore\reentrant
Definition qdatastream.h:47
int initFrom(const QMessageLogContext &logContext)
void populateBacktrace(int frameCount)
QInternalMessageLogContext(const QMessageLogContext &logContext, const QLoggingCategory &categoryOverride)
Definition qlogging_p.h:65
std::optional< BacktraceStorage > backtrace
Definition qlogging_p.h:57
static constexpr int DefaultBacktraceDepth
Definition qlogging_p.h:47
Definition qlist.h:76
\inmodule QtCore
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.
QBasicAtomicInt enabled
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.
\inmodule QtCore
Definition qlogging.h:43
constexpr QMessageLogContext(const char *fileName, int lineNumber, const char *functionName, const char *categoryName) noexcept
Definition qlogging.h:48
const char * category
Definition qlogging.h:55
constexpr QMessageLogContext() noexcept=default
const char * function
Definition qlogging.h:54
const char * file
Definition qlogging.h:53
\inmodule QtCore
Definition qlogging.h:73
QDebug debug(CategoryFunction catFunc) const
Logs a debug message into category returned by catFunc using a QDebug stream.
Definition qlogging.cpp:514
QDebug debug(const QLoggingCategory &cat) const
Logs a debug message into category cat using a QDebug stream.
Definition qlogging.cpp:495
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.
Definition qlogging.cpp:481
QDebug info(const QLoggingCategory &cat) const
Logs an informational message into the category cat using a QDebug stream.
Definition qlogging.cpp:597
QDebug info() const
Logs an informational message using a QDebug stream.
Definition qlogging.cpp:583
QDebug info(CategoryFunction catFunc) const
Logs an informational message into category returned by catFunc using a QDebug stream.
Definition qlogging.cpp:616
QNoDebug noDebug() const noexcept
Definition qlogging.cpp:526
~QVLABaseBase()=default
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
~QVLABase()=default
void pop_back()
reference front()
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
iterator end() 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
reference back()
T * data() 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
bool isEmpty() const
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)
const T & first() const
T & emplace_back(Args &&...args)
const T & at(qsizetype idx) const
void resize(qsizetype sz)
QVarLengthArray< T, Prealloc > & operator=(const QVarLengthArray< T, Prealloc > &other)
qsizetype count() const
void push_back(T &&t)
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))
const T & last() const
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)
qsizetype length() const
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)
void append(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)
Definition qlogging.cpp:376
static void preformattedMessageHandler(QtMsgType type, const QMessageLogContext &context, const QString &formattedMessage)
static bool systemHasStderr()
Returns true if writing to stderr is supported.
Definition qlogging.cpp:230
static const char endifTokenC[]
static bool isDefaultCategory(const char *category)
Definition qlogging.cpp:938
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)
Definition qlogging.cpp:193
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)
Definition qlogging.cpp:179
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[]
#define IF_TOKEN(LEVEL)
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)
Definition qlogging.cpp:204
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.
Definition qlogging.cpp:255
Combined button and popup list for selecting options.
\macro QT_NO_KEYWORDS >
Definition qcompare.h:24
QDebug printAssociativeContainer(QDebug debug, const char *which, const AssociativeContainer &c)
Definition qdebug.h:367
bool shouldLogToStderr()
Returns true if logging stderr should be ensured.
Definition qlogging.cpp:308
QDebug printSequentialContainer(QDebug debug, const char *which, const SequentialContainer &c)
Definition qdebug.h:349
QByteArray operator""_ba(const char *str, size_t size) noexcept
Definition qbytearray.h:821
Definition qcompare.h:72
QByteArray operator+(const QByteArray &a1, const char *a2)
Definition qbytearray.h:678
QByteArray qUncompress(const QByteArray &data)
Definition qbytearray.h:746
QByteArray operator+(char a1, const QByteArray &a2)
Definition qbytearray.h:688
QByteArray operator+(QByteArray &&lhs, char rhs)
Definition qbytearray.h:684
QByteArray operator+(const QByteArray &a1, char a2)
Definition qbytearray.h:682
QByteArray operator+(const char *a1, const QByteArray &a2)
Definition qbytearray.h:686
QByteArray operator+(QByteArray &&lhs, const QByteArray &rhs)
Definition qbytearray.h:676
qsizetype erase_if(QByteArray &ba, Predicate pred)
Definition qbytearray.h:804
QByteArray operator+(const QByteArray &a1, const QByteArray &a2)
Definition qbytearray.h:674
QByteArray qCompress(const QByteArray &data, int compressionLevel=-1)
Definition qbytearray.h:744
#define QT5_NULL_STRINGS
Definition qbytearray.h:25
qsizetype erase(QByteArray &ba, const T &t)
Definition qbytearray.h:798
QByteArray operator+(QByteArray &&lhs, const char *rhs)
Definition qbytearray.h:680
#define __has_builtin(x)
#define __has_include(x)
void qt_QMetaEnum_flagDebugOperator(QDebug &debug, size_t sizeofT, Int value)
Definition qdebug.h:570
Q_CORE_EXPORT void qt_QMetaEnum_flagDebugOperator(QDebug &debug, size_t sizeofT, quint64 value)
Definition qdebug.cpp:1372
Q_CORE_EXPORT QDebug operator<<(QDebug debug, QDir::Filters filters)
Definition qdir.cpp:2439
#define QT_MESSAGELOG_FUNC
Definition qlogging.h:158
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
Definition qlogging.h:156
#define QT_MESSAGE_LOGGER_NORETURN
Definition qlogging.h:69
#define QT_MESSAGELOG_LINE
Definition qlogging.h:157
Q_CORE_EXPORT void qSetMessagePattern(const QString &messagePattern)
#define QT_MESSAGELOGCONTEXT
Definition qlogging.h:151
QtMsgType
Definition qlogging.h:29
@ QtCriticalMsg
Definition qlogging.h:33
@ QtFatalMsg
Definition qlogging.h:34
@ QtDebugMsg
Definition qlogging.h:30
Q_CORE_EXPORT void qt_message_output(QtMsgType, const QMessageLogContext &context, const QString &message)
void(* QtMessageHandler)(QtMsgType, const QMessageLogContext &, const QString &)
Definition qlogging.h:192
#define Q_LOGGING_CATEGORY(name,...)
#define QT_MESSAGE_LOGGER_COMMON(category, level)
#define Q_DECLARE_LOGGING_CATEGORY(name)
QMutex QBasicMutex
Definition qmutex.h:327
QScopeGuard(F(&)()) -> QScopeGuard< F(*)()>
QScopeGuard< typename std::decay< F >::type > qScopeGuard(F &&f)
[qScopeGuard]
Definition qscopeguard.h:60
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 >)
double d
[1]
void setPattern(const QString &pattern)
std::unique_ptr< std::unique_ptr< const char[]>[]> literals
std::unique_ptr< const char *[]> tokens
QElapsedTimer timer
QList< QString > timeArgs
static QBasicMutex mutex
void operator()(void *p) const noexcept