1// qjsondocument.sip generated by MetaSIP 2// 3// This file is part of the QtCore Python extension module. 4// 5// Copyright (c) 2021 Riverbank Computing Limited <info@riverbankcomputing.com> 6// 7// This file is part of PyQt5. 8// 9// This file may be used under the terms of the GNU General Public License 10// version 3.0 as published by the Free Software Foundation and appearing in 11// the file LICENSE included in the packaging of this file. Please review the 12// following information to ensure the GNU General Public License version 3.0 13// requirements will be met: http://www.gnu.org/copyleft/gpl.html. 14// 15// If you do not wish to use this file under the terms of the GPL version 3.0 16// then you may purchase a commercial license. For more information contact 17// info@riverbankcomputing.com. 18// 19// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE 20// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. 21 22 23struct QJsonParseError 24{ 25%TypeHeaderCode 26#include <qjsondocument.h> 27%End 28 29 enum ParseError 30 { 31 NoError, 32 UnterminatedObject, 33 MissingNameSeparator, 34 UnterminatedArray, 35 MissingValueSeparator, 36 IllegalValue, 37 TerminationByNumber, 38 IllegalNumber, 39 IllegalEscapeSequence, 40 IllegalUTF8String, 41 UnterminatedString, 42 MissingObject, 43 DeepNesting, 44 DocumentTooLarge, 45%If (Qt_5_4_0 -) 46 GarbageAtEnd, 47%End 48 }; 49 50 QString errorString() const; 51 int offset; 52 QJsonParseError::ParseError error; 53}; 54 55class QJsonDocument 56{ 57%TypeHeaderCode 58#include <qjsondocument.h> 59%End 60 61public: 62 QJsonDocument(); 63 explicit QJsonDocument(const QJsonObject &object); 64 explicit QJsonDocument(const QJsonArray &array); 65 QJsonDocument(const QJsonDocument &other); 66 ~QJsonDocument(); 67 68 enum DataValidation 69 { 70 Validate, 71 BypassValidation, 72 }; 73 74 static QJsonDocument fromRawData(const char *data /Encoding="None"/, int size, QJsonDocument::DataValidation validation = QJsonDocument::Validate); 75 const char *rawData(int *size /Out/) const /Encoding="None"/; 76 static QJsonDocument fromBinaryData(const QByteArray &data, QJsonDocument::DataValidation validation = QJsonDocument::Validate); 77 QByteArray toBinaryData() const; 78 static QJsonDocument fromVariant(const QVariant &variant); 79 QVariant toVariant() const; 80 81 enum JsonFormat 82 { 83 Indented, 84 Compact, 85 }; 86 87 static QJsonDocument fromJson(const QByteArray &json, QJsonParseError *error = 0); 88 QByteArray toJson() const; 89 QByteArray toJson(QJsonDocument::JsonFormat format) const; 90 bool isEmpty() const; 91 bool isArray() const; 92 bool isObject() const; 93 QJsonObject object() const; 94 QJsonArray array() const; 95 void setObject(const QJsonObject &object); 96 void setArray(const QJsonArray &array); 97 bool operator==(const QJsonDocument &other) const; 98 bool operator!=(const QJsonDocument &other) const; 99 bool isNull() const; 100%If (Qt_5_10_0 -) 101 void swap(QJsonDocument &other /Constrained/); 102%End 103%If (Qt_5_10_0 -) 104 const QJsonValue operator[](const QString &key) const; 105%End 106%If (Qt_5_10_0 -) 107 const QJsonValue operator[](int i) const; 108%End 109}; 110 111%If (Qt_5_13_0 -) 112QDataStream &operator<<(QDataStream &, const QJsonDocument & /Constrained/) /ReleaseGIL/; 113%End 114%If (Qt_5_13_0 -) 115QDataStream &operator>>(QDataStream &, QJsonDocument & /Constrained/) /ReleaseGIL/; 116%End 117