qjsonvalue.sip 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103
  1. // qjsonvalue.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. class QJsonValue /AllowNone,TypeHintIn="Union[QJsonValue, QJsonValue.Type, QJsonArray, QJsonObject, bool, int, float, None, QString]"/
  22. {
  23. %TypeHeaderCode
  24. #include <qjsonvalue.h>
  25. %End
  26. %ConvertToTypeCode
  27. if (!sipIsErr)
  28. return qpycore_canConvertTo_QJsonValue(sipPy);
  29. return qpycore_convertTo_QJsonValue(sipPy, sipTransferObj, sipCppPtr, sipIsErr);
  30. %End
  31. public:
  32. enum Type
  33. {
  34. Null,
  35. Bool,
  36. Double,
  37. String,
  38. Array,
  39. Object,
  40. Undefined,
  41. };
  42. QJsonValue(QJsonValue::Type type /Constrained/ = QJsonValue::Null);
  43. QJsonValue(const QJsonValue &other);
  44. ~QJsonValue();
  45. static QJsonValue fromVariant(const QVariant &variant);
  46. QVariant toVariant() const;
  47. QJsonValue::Type type() const;
  48. bool isNull() const;
  49. bool isBool() const;
  50. bool isDouble() const;
  51. bool isString() const;
  52. bool isArray() const;
  53. bool isObject() const;
  54. bool isUndefined() const;
  55. bool toBool(bool defaultValue = false) const;
  56. int toInt(int defaultValue = 0) const;
  57. qint64 toInteger(qint64 defaultValue = 0) const;
  58. double toDouble(double defaultValue = 0) const;
  59. QJsonArray toArray() const;
  60. QJsonArray toArray(const QJsonArray &defaultValue) const;
  61. QJsonObject toObject() const;
  62. QJsonObject toObject(const QJsonObject &defaultValue) const;
  63. %If (- Qt_6_8_0)
  64. bool operator==(const QJsonValue &other) const;
  65. %End
  66. %If (- Qt_6_8_0)
  67. bool operator!=(const QJsonValue &other) const;
  68. %End
  69. QString toString() const;
  70. QString toString(const QString &defaultValue) const;
  71. void swap(QJsonValue &other /Constrained/);
  72. const QJsonValue operator[](qsizetype i) const;
  73. const QJsonValue operator[](const QString &key) const;
  74. Py_hash_t __hash__() const;
  75. %MethodCode
  76. sipRes = qHash(*sipCpp);
  77. %End
  78. %If (Qt_6_9_0 -)
  79. typedef QJsonDocument::JsonFormat JsonFormat;
  80. %End
  81. %If (Qt_6_9_0 -)
  82. static QJsonValue fromJson(QByteArrayView json, QJsonParseError *error /Out/ = 0);
  83. %End
  84. %If (Qt_6_9_0 -)
  85. QByteArray toJson(QJsonValue::JsonFormat format = QJsonDocument::Indented) const;
  86. %End
  87. };
  88. QDataStream &operator<<(QDataStream &, const QJsonValue & /Constrained/) /ReleaseGIL/;
  89. QDataStream &operator>>(QDataStream &, QJsonValue & /Constrained/) /ReleaseGIL/;
  90. %If (Qt_6_8_0 -)
  91. bool operator==(const QJsonValue &lhs, const QJsonValue &rhs);
  92. %End
  93. %If (Qt_6_8_0 -)
  94. bool operator!=(const QJsonValue &lhs, const QJsonValue &rhs);
  95. %End