| 1 | // Copyright (C) 2019 The Qt Company Ltd. |
| 2 | // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only |
| 3 | |
| 4 | #ifndef QBINARYJSONARRAY_P_H |
| 5 | #define QBINARYJSONARRAY_P_H |
| 6 | |
| 7 | // |
| 8 | // W A R N I N G |
| 9 | // ------------- |
| 10 | // |
| 11 | // This file is not part of the Qt API. It exists purely as an |
| 12 | // implementation detail. This header file may change from version to |
| 13 | // version without notice, or even be removed. |
| 14 | // |
| 15 | // We mean it. |
| 16 | // |
| 17 | |
| 18 | #include "qbinaryjsonvalue_p.h" |
| 19 | |
| 20 | QT_BEGIN_NAMESPACE |
| 21 | |
| 22 | class QBinaryJsonArray |
| 23 | { |
| 24 | Q_DISABLE_COPY(QBinaryJsonArray) |
| 25 | public: |
| 26 | QBinaryJsonArray() = default; |
| 27 | ~QBinaryJsonArray(); |
| 28 | |
| 29 | QBinaryJsonArray(QBinaryJsonArray &&other) noexcept |
| 30 | : d(other.d), |
| 31 | a(other.a) |
| 32 | { |
| 33 | other.d = nullptr; |
| 34 | other.a = nullptr; |
| 35 | } |
| 36 | |
| 37 | QBinaryJsonArray &operator =(QBinaryJsonArray &&other) noexcept |
| 38 | { |
| 39 | qt_ptr_swap(lhs&: d, rhs&: other.d); |
| 40 | qt_ptr_swap(lhs&: a, rhs&: other.a); |
| 41 | return *this; |
| 42 | } |
| 43 | |
| 44 | static QBinaryJsonArray fromJsonArray(const QJsonArray &array); |
| 45 | char *takeRawData(uint *size); |
| 46 | |
| 47 | private: |
| 48 | friend class QBinaryJsonValue; |
| 49 | |
| 50 | void append(const QBinaryJsonValue &value); |
| 51 | void compact(); |
| 52 | bool detach(uint reserve = 0); |
| 53 | |
| 54 | QBinaryJsonPrivate::MutableData *d = nullptr; |
| 55 | QBinaryJsonPrivate::Array *a = nullptr; |
| 56 | }; |
| 57 | |
| 58 | QT_END_NAMESPACE |
| 59 | |
| 60 | #endif // QBINARYJSONARRAY_P_H |
| 61 | |