20#if QT_CONFIG(cborstreamreader)
24#include <private/qglobal_p.h>
25#include <private/qstringconverter_p.h>
71static_assert(
sizeof(
Element) == 16);
77 const char *
byte()
const {
return reinterpret_cast<const char *
>(
this + 1); }
78 char *
byte() {
return reinterpret_cast<char *
>(
this + 1); }
92static_assert(std::is_trivial<ByteData>::value);
93static_assert(std::is_standard_layout<ByteData>::value);
138 memcpy(
b->byte(), block,
len);
150 if ((e.
flags & QtCbor::Element::HasByteData) == 0)
169 if (e.
type !=
type || (e.
flags & QtCbor::Element::IsContainer) == 0)
181 if (
value.isContainer())
187 if (e.
flags & QtCbor::Element::IsContainer) {
214 QtCbor::Element::ValueFlags extraFlags = {})
217 QtCbor::Element::HasByteData | extraFlags));
235 QtCbor::Element::StringIsAscii);
263 return data->toByteArray();
271 if (e.flags & QtCbor::Element::StringIsUtf16)
272 return data->toString();
273 if (e.flags & QtCbor::Element::StringIsAscii)
274 return data->asLatin1();
275 return data->toUtf8String();
280 v.container =
nullptr;
298 if (e.flags & QtCbor::Element::IsContainer) {
303 return makeValue(e.type, -1, e.container);
304 }
else if (e.flags & QtCbor::Element::HasByteData) {
315 if (e.
flags & QtCbor::Element::IsContainer) {
322 }
else if (e.
flags & QtCbor::Element::HasByteData) {
336 if (
value.container) {
338 e.
flags = QtCbor::Element::IsContainer;
353 template<
typename String>
361 return s.isEmpty() ? 0 : -1;
363 if (e.
flags & QtCbor::Element::StringIsUtf16) {
371 template<
typename String>
377 template<
typename String>
406 if constexpr (std::is_same_v<std::decay_t<KeyType>,
QCborValue>) {
408 }
else if constexpr (std::is_integral_v<KeyType>) {
417 return {
this,
i + 1 };
421 if (self.isMap() && self.container) {
424 return self.container->valueAt(idx);
428 template <
typename KeyType>
static QCborValueRef
449 return { container,
index };
453 template <
typename KeyType>
static QCborValueRef
findOrAddMapKey(QCborValueRef self, KeyType
key);
455#if QT_CONFIG(cborstreamreader)
static QByteArray fromRawData(const char *data, qsizetype size)
Constructs a QByteArray that uses the first size bytes of the data array.
QString stringAt(qsizetype idx) const
void insertAt(qsizetype idx, const QCborValue &value, ContainerDisposition disp=CopyContainer)
QByteArray::size_type usedData
const QtCbor::ByteData * byteData(QtCbor::Element e) const
static int compareUtf8(const QtCbor::ByteData *b, QStringView s)
void replaceAt_internal(QtCbor::Element &e, const QCborValue &value, ContainerDisposition disp)
void append(QStringView s)
void appendUtf8String(const char *str, qsizetype len)
void append(const QString &s)
void append(const QCborValue &v)
const QtCbor::ByteData * byteData(qsizetype idx) const
void appendByteData(const char *data, qsizetype len, QCborValue::Type type, QtCbor::Element::ValueFlags extraFlags={})
static QCborContainerPrivate * grow(QCborContainerPrivate *d, qsizetype index)
Prepare for an insertion at position index.
int stringCompareElement(const QtCbor::Element &e, String s, QtCbor::Comparison mode) const
static int compareElement_helper(const QCborContainerPrivate *c1, QtCbor::Element e1, const QCborContainerPrivate *c2, QtCbor::Element e2, QtCbor::Comparison mode) noexcept
static QCborContainerPrivate * detach(QCborContainerPrivate *d, qsizetype reserved)
bool stringEqualsElement(const QtCbor::Element &e, String s) const
void removeAt(qsizetype idx)
static int compareUtf8(const QtCbor::ByteData *b, QLatin1StringView s)
void append(QLatin1StringView s)
QCborValueConstRef findCborMapKey(KeyType key)
void replaceAt(qsizetype idx, const QCborValue &value, ContainerDisposition disp=CopyContainer)
QList< QtCbor::Element > elements
void append(QCborTag tag)
void appendAsciiString(const char *str, qsizetype len)
QCborValue extractAt(qsizetype idx)
void appendNonAsciiString(QStringView s)
void append(QtCbor::Undefined)
static qptrdiff addByteDataImpl(QByteArray &target, QByteArray::size_type &targetUsed, const char *block, qsizetype len)
QByteArray byteArrayAt(qsizetype idx) const
QCborContainerPrivate * containerAt(qsizetype idx, QCborValue::Type type) const
static QCborValue makeValue(QCborValue::Type type, qint64 n, QCborContainerPrivate *d=nullptr, ContainerDisposition disp=CopyContainer)
int compareElement(qsizetype idx, const QCborValue &value, QtCbor::Comparison mode) const
static QCborValueRef findOrAddMapKey(QCborContainerPrivate *container, KeyType key)
QCborValue extractAt_complex(QtCbor::Element e)
void appendAsciiString(const QString &s)
qptrdiff addByteData(const char *block, qsizetype len)
static QtCbor::Element elementFromValue(const QCborValue &value)
void replaceAt_complex(QtCbor::Element &e, const QCborValue &value, ContainerDisposition disp)
static void resetValue(QCborValue &v)
static QCborValue findCborMapKey(const QCborValue &self, KeyType key)
bool stringEqualsElement(qsizetype idx, String s) const
QCborValue valueAt(qsizetype idx) const
void append(qint64 value)
static QCborContainerPrivate * clone(QCborContainerPrivate *d, qsizetype reserved=-1)
\inmodule QtCore\reentrant
\inmodule QtCore\reentrant
\inmodule QtCore\reentrant
Type
This enum represents the QCborValue type.
qsizetype size() const noexcept
iterator insert(qsizetype i, parameter_type t)
const_reference at(qsizetype i) const noexcept
void remove(qsizetype i, qsizetype n=1)
void append(parameter_type t)
\macro QT_RESTRICTED_CAST_FROM_ASCII
static QString fromUtf8(QByteArrayView utf8)
This is an overloaded member function, provided for convenience. It differs from the above function o...
static QString fromRawData(const QChar *, qsizetype size)
Constructs a QString that uses the first size Unicode characters in the array unicode.
QMap< QString, QString > map
[6]
Combined button and popup list for selecting options.
Q_CORE_EXPORT Q_DECL_PURE_FUNCTION bool equalStrings(QStringView lhs, QStringView rhs) noexcept
Q_CORE_EXPORT Q_DECL_PURE_FUNCTION int compareStrings(QStringView lhs, QStringView rhs, Qt::CaseSensitivity cs=Qt::CaseSensitive) noexcept
Q_CORE_EXPORT Q_DECL_PURE_FUNCTION bool isAscii(QLatin1StringView s) noexcept
AudioChannelLayoutTag tag
DBusConnection const char DBusError * error
typedef QByteArray(EGLAPIENTRYP PFNQGSGETDISPLAYSPROC)()
EGLOutputLayerEXT EGLint EGLAttrib value
[5]
#define Q_DECLARE_FLAGS(Flags, Enum)
#define Q_DECLARE_OPERATORS_FOR_FLAGS(Flags)
static ControlElement< T > * ptr(QWidget *widget)
constexpr const T & qMax(const T &a, const T &b)
GLboolean GLboolean GLboolean b
GLsizei const GLfloat * v
[13]
GLenum GLuint GLintptr GLsizeiptr size
[1]
GLint GLsizei GLsizei GLenum GLenum GLsizei void * data
GLenum GLuint GLintptr offset
QBasicUtf8StringView< false > QUtf8StringView
QStringView qToStringViewIgnoringNull(const QStringLike &s) noexcept
QT_BEGIN_NAMESPACE constexpr void qSwap(T &value1, T &value2) noexcept(std::is_nothrow_swappable_v< T >)
#define Q_DECLARE_TYPEINFO(TYPE, FLAGS)
QtConcurrent::task([]{ qDebug("Hello, world!");}).spawn(FutureResult void increment(QPromise< int > &promise, int i)
[10]
QCborValue(QCborTag(2), QByteArray("\x01\0\0\0\0\0\0\0\0", 9))
[0]
\inmodule QtCore \inheaderfile QtCborCommon \reentrant
static int compareUtf8(QByteArrayView utf8, QStringView utf16, Qt::CaseSensitivity cs=Qt::CaseSensitive) noexcept
QString toUtf8String() const
QStringView asStringView() const
QUtf8StringView asUtf8StringView() const
QLatin1StringView asLatin1() const
QString asQStringRaw() const
const QChar * utf16() const
const char * byte() const
QByteArray::size_type len
QByteArray asByteArrayView() const
QByteArray toByteArray() const
Element(qint64 v=0, QCborValue::Type t=QCborValue::Undefined, ValueFlags f={})
Element(QCborContainerPrivate *d, QCborValue::Type t, ValueFlags f={})
QCborContainerPrivate * container