13#include "private/qdebug_p.h"
15#include <private/qtextstream_p.h>
16#include <private/qtools_p.h>
165 if (
stream->message_output) {
177void QDebug::putUcs4(
uint ucs4)
182 }
else if (ucs4 < 0x80) {
202template <
typename Char>
208 bool lastWasHexEscape =
false;
218 lastWasHexEscape =
false;
224 while (
p + runLength !=
end &&
225 isPrintable(
p[runLength]) &&
p[runLength] !=
'\\' &&
p[runLength] !=
'"')
228 d->write(
reinterpret_cast<const QChar *
>(
p), runLength);
240 char16_t buf[std::char_traits<char>::length(
"\\U12345678")];
270 lastWasHexEscape =
true;
305 d->write(
reinterpret_cast<QChar *
>(
buf), buflen);
324 stream->ts.d_ptr->params.reset();
333void QDebug::putByteArray(
const char *
begin,
size_t length, Latin1Content content)
340 stream->ts.d_ptr->putString(
string);
344 stream->ts.d_ptr->params.reset();
346 length, content == ContainsLatin1);
352 using namespace std::chrono;
355 if (
num == 1 && den > 1) {
358 auto tryprefix = [&](
auto d,
char c) {
359 static_assert(
decltype(
d)
::num == 1,
"not an SI prefix");
360 if (den ==
decltype(
d)::den)
365 tryprefix(std::milli{},
'm');
366 tryprefix(std::micro{},
'u');
367 tryprefix(std::nano{},
'n');
368 tryprefix(std::pico{},
'p');
369 tryprefix(std::femto{},
'f');
370 tryprefix(std::atto{},
'a');
372 tryprefix(std::centi{},
'c');
373 tryprefix(std::deci{},
'd');
375 char unit[3] = { prefix,
's' };
380 const char *unit =
nullptr;
381 if (
num > 1 && den == 1) {
383 auto tryunit = [&](
auto d,
const char *
name) {
384 static_assert(
decltype(
d)::period::den == 1,
"not a multiple of a second");
385 if (unit ||
num %
decltype(
d)::period::num)
388 num /=
decltype(
d)::period::num;
390 tryunit(
years{},
"yr");
391 tryunit(
weeks{},
"wk");
392 tryunit(
days{},
"d");
393 tryunit(hours{},
"h");
394 tryunit(minutes{},
"min");
399 if (
num == 1 && den == 1)
406 char buf[2 * (std::numeric_limits<qint64>::digits10 + 2) + 10];
408 auto appendChar = [&](
char c) {
425 memcpy(
buf +
len, unit, strlen(unit));
453QDebug &QDebug::resetFormat()
458 stream->verbosity = DefaultVerbosity;
1089 const bool currentSpaces =
m_stream->space;
1091 if (
m_stream->buffer.endsWith(u
' '))
1121QDebugStateSaver::QDebugStateSaver(
QDebug &dbg)
1132QDebugStateSaver::~QDebugStateSaver()
1147 qt_QMetaEnum_flagDebugOperator<int>(
debug, sizeofT,
value);
1150#ifndef QT_NO_QOBJECT
1192 const int verbosity = dbg.verbosity();
1193 if (verbosity >= QDebug::DefaultVerbosity) {
1194 if (
const char *scope = me.
scope())
1195 dbg << scope << u
"::";
1199 const bool scoped = me.
isScoped() || verbosity & 1;
1206 dbg <<
value <<
')';
1242 const int verbosity =
debug.verbosity();
1245 debug.resetFormat();
1251 const bool classScope = verbosity >= QDebug::DefaultVerbosity;
1253 debug << u
"QFlags<";
1255 if (
const char *scope = me.
scope())
1256 debug << scope << u
"::";
1259 const bool enumScope = me.
isScoped() || verbosity > QDebug::MinimumVerbosity;
static constexpr char32_t surrogateToUcs4(char16_t high, char16_t low) noexcept
Converts a UTF16 surrogate pair with the given high and low values to it's UCS-4-encoded code point.
constexpr bool isLowSurrogate() const noexcept
Returns true if the QChar is the low part of a UTF16 surrogate (for example if its code point is in r...
bool isPrint() const noexcept
Returns true if the character is a printable character; otherwise returns false.
constexpr bool isHighSurrogate() const noexcept
Returns true if the QChar is the high part of a UTF16 surrogate (for example if its code point is in ...
const QTextStreamPrivate::Params m_streamParams
QDebug::Stream * m_stream
QDebugStateSaverPrivate(QDebug::Stream *stream)
\macro QT_RESTRICTED_CAST_FROM_ASCII
QByteArray toLatin1() const &
static QString fromLatin1(QByteArrayView ba)
This is an overloaded member function, provided for convenience. It differs from the above function o...
static QString static QString asprintf(const char *format,...) Q_ATTRIBUTE_FORMAT_PRINTF(1
void qt_message_output(QtMsgType msgType, const QMessageLogContext &context, const QString &message)
Combined button and popup list for selecting options.
qsizetype fromUtf8(uchar b, OutputPtr &dst, InputPtr &src, InputPtr end)
Q_CORE_EXPORT QByteArray toPrintable(const char *data, qint64 len, qsizetype maxSize)
constexpr int isAsciiPrintable(char32_t ch) noexcept
constexpr char toHexUpper(char32_t value) noexcept
constexpr char toHexLower(char32_t value) noexcept
constexpr int fromHex(char32_t c) noexcept
QTextStream & hex(QTextStream &stream)
Calls QTextStream::setIntegerBase(16) on stream and returns stream.
QTextStream & reset(QTextStream &stream)
Calls QTextStream::reset() on stream and returns stream.
std::chrono::duration< IntRep, std::ratio< 86400 > > days
std::chrono::duration< IntRep, std::ratio_multiply< std::ratio< 146097, 400 >, days::period > > years
std::chrono::duration< IntRep, std::ratio_multiply< std::ratio< 7 >, days::period > > weeks
Q_CORE_EXPORT int qsnprintf(char *str, size_t n, const char *fmt,...)
QDebug qt_QMetaEnum_debugOperator(QDebug &dbg, qint64 value, const QMetaObject *meta, const char *name)
void qt_QMetaEnum_flagDebugOperator(QDebug &debug, size_t sizeofT, int value)
static void putEscapedString(QTextStreamPrivate *d, const Char *begin, size_t length, bool isUnicode=true)
static QByteArray timeUnit(qint64 num, qint64 den)
static bool isPrintable(char32_t ucs4)
EGLOutputLayerEXT EGLint EGLAttrib value
[5]
constexpr const T & qMin(const T &a, const T &b)
GLenum GLuint GLenum GLsizei length
GLenum GLuint GLenum GLsizei const GLchar * buf
GLint GLsizei GLsizei GLenum GLenum GLsizei void * data
QtPrivate::QRegularExpressionMatchIteratorRangeBasedForIterator begin(const QRegularExpressionMatchIterator &iterator)
QTextStreamManipulator qSetPadChar(QChar ch)
QTextStreamManipulator qSetFieldWidth(int width)
unsigned long long quint64
static QString quote(const QString &str)
QTextStream out(stdout)
[7]
\inmodule QtCore \reentrant