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