| 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 QBINARYJSONOBJECT_H |
| 5 | #define QBINARYJSONOBJECT_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 QBinaryJsonObject |
| 23 | { |
| 24 | Q_DISABLE_COPY(QBinaryJsonObject) |
| 25 | public: |
| 26 | QBinaryJsonObject() = default; |
| 27 | ~QBinaryJsonObject(); |
| 28 | |
| 29 | QBinaryJsonObject(QBinaryJsonObject &&other) noexcept |
| 30 | : d(other.d), o(other.o) |
| 31 | { |
| 32 | other.d = nullptr; |
| 33 | other.o = nullptr; |
| 34 | } |
| 35 | |
| 36 | QBinaryJsonObject &operator =(QBinaryJsonObject &&other) noexcept |
| 37 | { |
| 38 | qSwap(value1&: d, value2&: other.d); |
| 39 | qSwap(value1&: o, value2&: other.o); |
| 40 | return *this; |
| 41 | } |
| 42 | |
| 43 | static QBinaryJsonObject fromJsonObject(const QJsonObject &object); |
| 44 | char *takeRawData(uint *size) const; |
| 45 | |
| 46 | private: |
| 47 | friend class QBinaryJsonValue; |
| 48 | |
| 49 | void insert(const QString &key, const QBinaryJsonValue &value); |
| 50 | bool detach(uint reserve = 0); |
| 51 | void compact(); |
| 52 | |
| 53 | QBinaryJsonPrivate::MutableData *d = nullptr; |
| 54 | QBinaryJsonPrivate::Object *o = nullptr; |
| 55 | }; |
| 56 | |
| 57 | QT_END_NAMESPACE |
| 58 | |
| 59 | #endif // QBINARYJSONOBJECT_P_H |
| 60 | |