qjsondocument.sip 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106
  1. // qjsondocument.sip generated by MetaSIP
  2. //
  3. // This file is part of the QtCore Python extension module.
  4. //
  5. // Copyright (c) 2026 Riverbank Computing Limited <info@riverbankcomputing.com>
  6. //
  7. // This file is part of PyQt6.
  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. %If (- Qt_6_9_0)
  22. struct QJsonParseError
  23. {
  24. %TypeHeaderCode
  25. #include <qjsondocument.h>
  26. %End
  27. enum ParseError
  28. {
  29. NoError,
  30. UnterminatedObject,
  31. MissingNameSeparator,
  32. UnterminatedArray,
  33. MissingValueSeparator,
  34. IllegalValue,
  35. TerminationByNumber,
  36. IllegalNumber,
  37. IllegalEscapeSequence,
  38. IllegalUTF8String,
  39. UnterminatedString,
  40. MissingObject,
  41. DeepNesting,
  42. DocumentTooLarge,
  43. GarbageAtEnd,
  44. };
  45. QString errorString() const;
  46. int offset;
  47. QJsonParseError::ParseError error;
  48. };
  49. %End
  50. class QJsonDocument
  51. {
  52. %TypeHeaderCode
  53. #include <qjsondocument.h>
  54. %End
  55. public:
  56. QJsonDocument();
  57. explicit QJsonDocument(const QJsonObject &object);
  58. explicit QJsonDocument(const QJsonArray &array);
  59. QJsonDocument(const QJsonDocument &other);
  60. ~QJsonDocument();
  61. static QJsonDocument fromVariant(const QVariant &variant);
  62. QVariant toVariant() const;
  63. enum JsonFormat
  64. {
  65. Indented,
  66. Compact,
  67. };
  68. static QJsonDocument fromJson(const QByteArray &json, QJsonParseError *error = 0);
  69. QByteArray toJson(QJsonDocument::JsonFormat format = QJsonDocument::Indented) const;
  70. bool isEmpty() const;
  71. bool isArray() const;
  72. bool isObject() const;
  73. QJsonObject object() const;
  74. QJsonArray array() const;
  75. void setObject(const QJsonObject &object);
  76. void setArray(const QJsonArray &array);
  77. %If (- Qt_6_8_0)
  78. bool operator==(const QJsonDocument &other) const;
  79. %End
  80. %If (- Qt_6_8_0)
  81. bool operator!=(const QJsonDocument &other) const;
  82. %End
  83. bool isNull() const;
  84. void swap(QJsonDocument &other /Constrained/);
  85. const QJsonValue operator[](qsizetype i) const;
  86. const QJsonValue operator[](const QString &key) const;
  87. };
  88. QDataStream &operator<<(QDataStream &, const QJsonDocument & /Constrained/) /ReleaseGIL/;
  89. QDataStream &operator>>(QDataStream &, QJsonDocument & /Constrained/) /ReleaseGIL/;
  90. %If (Qt_6_8_0 -)
  91. bool operator!=(const QJsonDocument &lhs, const QJsonDocument &rhs);
  92. %End
  93. %If (Qt_6_8_0 -)
  94. bool operator==(const QJsonDocument &lhs, const QJsonDocument &rhs);
  95. %End