10#include <private/qnumeric_p.h>
12#include <private/qtools_p.h>
19class DiagnosticNotation
24 DiagnosticNotation dn(opts);
33 QCborValue::DiagnosticNotationOptions opts;
37 enum { IndentationWidth = 4 };
38 DiagnosticNotation *dn;
39 Nest(DiagnosticNotation *that) : dn(that)
42 static const char indent[IndentationWidth + 1] =
" ";
50 dn->separator.chop(IndentationWidth);
54 DiagnosticNotation(QCborValue::DiagnosticNotationOptions opts_)
55 : separator(opts_ &
QCborValue::LineWrapped ?
"\n"_L1 :
""_L1), opts(opts_)
75 }
else if (convertDoubleTo(
d, &
v)) {
81 if (!
s.contains(u
'.') && !
s.contains(u
'e'))
98void DiagnosticNotation::appendString(
const QString &
s)
109 if (uc ==
'\\' || uc ==
'"' || uc <
' ' || uc >= 0x7f)
120 static const char escapeMap[16] = {
132 char16_t uc =
ptr->unicode();
134 if (uc <
sizeof(escapeMap))
136 else if (uc ==
'"' || uc ==
'\\')
144 if (
ptr->isHighSurrogate() && (
ptr + 1) !=
end &&
ptr[1].isLowSurrogate()) {
175void DiagnosticNotation::appendArray(
const QCborArray &
a)
185 result += comma + separator;
191 result += separator + u
']';
194void DiagnosticNotation::appendMap(
const QCborMap &
m)
204 result += comma + separator;
206 appendValue(
v.first);
208 appendValue(
v.second);
212 result += separator + u
'}';
215void DiagnosticNotation::appendValue(
const QCborValue &
v)
222 switch (byteArrayFormatStack.
top()) {
239 return appendString(
v.toString());
241 return appendArray(
v.toArray());
273 byteArrayFormatStack.
push(
int(
v.tag()));
275 appendValue(
v.taggedValue());
278 byteArrayFormatStack.
pop();
313 return DiagnosticNotation::create(*
this, opts);
\inmodule QtCore\reentrant
\inmodule QtCore\reentrant
\inmodule QtCore\reentrant
QString toDiagnosticNotation(DiagnosticNotationOptions opts=Compact) const
Creates the diagnostic notation equivalent of this CBOR object and returns it.
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.
T & top()
Returns a reference to the stack's top item.
T pop()
Removes the top item from the stack and returns it.
void push(const T &t)
Adds element t to the top of the stack.
\macro QT_RESTRICTED_CAST_FROM_ASCII
static QString fromLatin1(QByteArrayView ba)
This is an overloaded member function, provided for convenience. It differs from the above function o...
QString arg(qlonglong a, int fieldwidth=0, int base=10, QChar fillChar=u' ') const
static QString number(int, int base=10)
This is an overloaded member function, provided for convenience. It differs from the above function o...
QString & prepend(QChar c)
const char * toHex(ushort u, char *buffer)
Combined button and popup list for selecting options.
constexpr char toHexUpper(char32_t value) noexcept
void toByteArray(QByteArray &)
static QString makeFpString(double d)
static bool isByteArrayEncodingTag(QCborTag tag)
AudioChannelLayoutTag tag
EGLOutputLayerEXT EGLint EGLAttrib value
[5]
static ControlElement< T > * ptr(QWidget *widget)
static Q_DECL_CONST_FUNCTION bool qt_is_nan(double d)
static Q_DECL_CONST_FUNCTION bool qt_is_inf(double d)
GLsizei const GLfloat * v
[13]
GLboolean GLboolean GLboolean GLboolean a
[7]
GLenum GLuint GLenum GLsizei const GLchar * buf
QtPrivate::QRegularExpressionMatchIteratorRangeBasedForIterator begin(const QRegularExpressionMatchIterator &iterator)
#define QStringLiteral(str)
unsigned long long quint64
void appendMap(QCborStreamWriter &writer, const QList< QPair< int, QString > > &values)
[21]
\inmodule QtCore \reentrant