1// qdatastream.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 QDataStream 24{ 25%TypeHeaderCode 26#include <qdatastream.h> 27%End 28 29public: 30 enum Version 31 { 32 Qt_1_0, 33 Qt_2_0, 34 Qt_2_1, 35 Qt_3_0, 36 Qt_3_1, 37 Qt_3_3, 38 Qt_4_0, 39 Qt_4_1, 40 Qt_4_2, 41 Qt_4_3, 42 Qt_4_4, 43 Qt_4_5, 44 Qt_4_6, 45 Qt_4_7, 46 Qt_4_8, 47 Qt_4_9, 48 Qt_5_0, 49%If (Qt_5_1_0 -) 50 Qt_5_1, 51%End 52%If (Qt_5_2_0 -) 53 Qt_5_2, 54%End 55%If (Qt_5_3_0 -) 56 Qt_5_3, 57%End 58%If (Qt_5_4_0 -) 59 Qt_5_4, 60%End 61%If (Qt_5_5_0 -) 62 Qt_5_5, 63%End 64%If (Qt_5_6_0 -) 65 Qt_5_6, 66%End 67%If (Qt_5_7_0 -) 68 Qt_5_7, 69%End 70%If (Qt_5_8_0 -) 71 Qt_5_8, 72%End 73%If (Qt_5_9_0 -) 74 Qt_5_9, 75%End 76%If (Qt_5_10_0 -) 77 Qt_5_10, 78%End 79%If (Qt_5_11_0 -) 80 Qt_5_11, 81%End 82%If (Qt_5_12_0 -) 83 Qt_5_12, 84%End 85%If (Qt_5_13_0 -) 86 Qt_5_13, 87%End 88%If (Qt_5_14_0 -) 89 Qt_5_14, 90%End 91%If (Qt_5_15_0 -) 92 Qt_5_15, 93%End 94 }; 95 96 enum ByteOrder 97 { 98 BigEndian, 99 LittleEndian, 100 }; 101 102 enum Status 103 { 104 Ok, 105 ReadPastEnd, 106 ReadCorruptData, 107 WriteFailed, 108 }; 109 110 QDataStream(); 111 explicit QDataStream(QIODevice *); 112 QDataStream(QByteArray * /Constrained/, QIODevice::OpenMode flags); 113 QDataStream(const QByteArray & /Constrained/); 114 ~QDataStream(); 115 QIODevice *device() const; 116 void setDevice(QIODevice *); 117 bool atEnd() const; 118 QDataStream::Status status() const; 119 void setStatus(QDataStream::Status status); 120 void resetStatus(); 121 QDataStream::ByteOrder byteOrder() const; 122 void setByteOrder(QDataStream::ByteOrder); 123 int version() const; 124 void setVersion(int v); 125 int skipRawData(int len) /ReleaseGIL/; 126// Extra methods to give explicit control over the simple data types being read and written. 127int readInt() /ReleaseGIL/; 128%MethodCode 129 Py_BEGIN_ALLOW_THREADS 130 *sipCpp >> sipRes; 131 Py_END_ALLOW_THREADS 132%End 133 134qint8 readInt8() /ReleaseGIL/; 135%MethodCode 136 Py_BEGIN_ALLOW_THREADS 137 *sipCpp >> sipRes; 138 Py_END_ALLOW_THREADS 139%End 140 141quint8 readUInt8() /ReleaseGIL/; 142%MethodCode 143 Py_BEGIN_ALLOW_THREADS 144 *sipCpp >> sipRes; 145 Py_END_ALLOW_THREADS 146%End 147 148qint16 readInt16() /ReleaseGIL/; 149%MethodCode 150 Py_BEGIN_ALLOW_THREADS 151 *sipCpp >> sipRes; 152 Py_END_ALLOW_THREADS 153%End 154 155quint16 readUInt16() /ReleaseGIL/; 156%MethodCode 157 Py_BEGIN_ALLOW_THREADS 158 *sipCpp >> sipRes; 159 Py_END_ALLOW_THREADS 160%End 161 162qint32 readInt32() /ReleaseGIL/; 163%MethodCode 164 Py_BEGIN_ALLOW_THREADS 165 *sipCpp >> sipRes; 166 Py_END_ALLOW_THREADS 167%End 168 169quint32 readUInt32() /ReleaseGIL/; 170%MethodCode 171 Py_BEGIN_ALLOW_THREADS 172 *sipCpp >> sipRes; 173 Py_END_ALLOW_THREADS 174%End 175 176qint64 readInt64() /ReleaseGIL/; 177%MethodCode 178 Py_BEGIN_ALLOW_THREADS 179 *sipCpp >> sipRes; 180 Py_END_ALLOW_THREADS 181%End 182 183quint64 readUInt64() /ReleaseGIL/; 184%MethodCode 185 Py_BEGIN_ALLOW_THREADS 186 *sipCpp >> sipRes; 187 Py_END_ALLOW_THREADS 188%End 189 190bool readBool() /ReleaseGIL/; 191%MethodCode 192 Py_BEGIN_ALLOW_THREADS 193 *sipCpp >> sipRes; 194 Py_END_ALLOW_THREADS 195%End 196 197float readFloat() /ReleaseGIL/; 198%MethodCode 199 Py_BEGIN_ALLOW_THREADS 200 *sipCpp >> sipRes; 201 Py_END_ALLOW_THREADS 202%End 203 204double readDouble() /ReleaseGIL/; 205%MethodCode 206 Py_BEGIN_ALLOW_THREADS 207 *sipCpp >> sipRes; 208 Py_END_ALLOW_THREADS 209%End 210 211SIP_PYOBJECT readString() /ReleaseGIL,TypeHint="Py_v3:bytes;str"/; 212%MethodCode 213 char *s; 214 215 Py_BEGIN_ALLOW_THREADS 216 *sipCpp >> s; 217 Py_END_ALLOW_THREADS 218 219 if (s) 220 { 221 sipRes = SIPBytes_FromString(s); 222 delete[] s; 223 } 224 else 225 { 226 sipRes = Py_None; 227 Py_INCREF(Py_None); 228 } 229%End 230 231void writeInt(int i) /ReleaseGIL/; 232%MethodCode 233 Py_BEGIN_ALLOW_THREADS 234 *sipCpp << a0; 235 Py_END_ALLOW_THREADS 236%End 237 238void writeInt8(qint8 i) /ReleaseGIL/; 239%MethodCode 240 Py_BEGIN_ALLOW_THREADS 241 *sipCpp << a0; 242 Py_END_ALLOW_THREADS 243%End 244 245void writeUInt8(quint8 i) /ReleaseGIL/; 246%MethodCode 247 Py_BEGIN_ALLOW_THREADS 248 *sipCpp << a0; 249 Py_END_ALLOW_THREADS 250%End 251 252void writeInt16(qint16 i) /ReleaseGIL/; 253%MethodCode 254 Py_BEGIN_ALLOW_THREADS 255 *sipCpp << a0; 256 Py_END_ALLOW_THREADS 257%End 258 259void writeUInt16(quint16 i) /ReleaseGIL/; 260%MethodCode 261 Py_BEGIN_ALLOW_THREADS 262 *sipCpp << a0; 263 Py_END_ALLOW_THREADS 264%End 265 266void writeInt32(qint32 i) /ReleaseGIL/; 267%MethodCode 268 Py_BEGIN_ALLOW_THREADS 269 *sipCpp << a0; 270 Py_END_ALLOW_THREADS 271%End 272 273void writeUInt32(quint32 i) /ReleaseGIL/; 274%MethodCode 275 Py_BEGIN_ALLOW_THREADS 276 *sipCpp << a0; 277 Py_END_ALLOW_THREADS 278%End 279 280void writeInt64(qint64 i) /ReleaseGIL/; 281%MethodCode 282 Py_BEGIN_ALLOW_THREADS 283 *sipCpp << a0; 284 Py_END_ALLOW_THREADS 285%End 286 287void writeUInt64(quint64 i) /ReleaseGIL/; 288%MethodCode 289 Py_BEGIN_ALLOW_THREADS 290 *sipCpp << a0; 291 Py_END_ALLOW_THREADS 292%End 293 294void writeBool(bool i) /ReleaseGIL/; 295%MethodCode 296 Py_BEGIN_ALLOW_THREADS 297 *sipCpp << a0; 298 Py_END_ALLOW_THREADS 299%End 300 301void writeFloat(float f) /ReleaseGIL/; 302%MethodCode 303 Py_BEGIN_ALLOW_THREADS 304 *sipCpp << a0; 305 Py_END_ALLOW_THREADS 306%End 307 308void writeDouble(double f) /ReleaseGIL/; 309%MethodCode 310 Py_BEGIN_ALLOW_THREADS 311 *sipCpp << a0; 312 Py_END_ALLOW_THREADS 313%End 314 315void writeString(const char *str /Encoding="None"/) /ReleaseGIL/; 316%MethodCode 317 Py_BEGIN_ALLOW_THREADS 318 *sipCpp << a0; 319 Py_END_ALLOW_THREADS 320%End 321// Extra methods to support v2 of the QString and QVariant APIs. 322QString readQString() /ReleaseGIL/; 323%MethodCode 324 sipRes = new QString; 325 326 Py_BEGIN_ALLOW_THREADS 327 *sipCpp >> *sipRes; 328 Py_END_ALLOW_THREADS 329%End 330 331void writeQString(const QString &qstr) /ReleaseGIL/; 332%MethodCode 333 Py_BEGIN_ALLOW_THREADS 334 *sipCpp << *a0; 335 Py_END_ALLOW_THREADS 336%End 337 338QStringList readQStringList() /ReleaseGIL/; 339%MethodCode 340 sipRes = new QStringList; 341 342 Py_BEGIN_ALLOW_THREADS 343 *sipCpp >> *sipRes; 344 Py_END_ALLOW_THREADS 345%End 346 347void writeQStringList(const QStringList &qstrlst) /ReleaseGIL/; 348%MethodCode 349 Py_BEGIN_ALLOW_THREADS 350 *sipCpp << *a0; 351 Py_END_ALLOW_THREADS 352%End 353 354QVariant readQVariant() /ReleaseGIL/; 355%MethodCode 356 sipRes = new QVariant; 357 358 Py_BEGIN_ALLOW_THREADS 359 *sipCpp >> *sipRes; 360 Py_END_ALLOW_THREADS 361%End 362 363void writeQVariant(const QVariant &qvar) /ReleaseGIL/; 364%MethodCode 365 Py_BEGIN_ALLOW_THREADS 366 *sipCpp << *a0; 367 Py_END_ALLOW_THREADS 368%End 369 370QVariantList readQVariantList() /ReleaseGIL/; 371%MethodCode 372 sipRes = new QVariantList; 373 374 Py_BEGIN_ALLOW_THREADS 375 *sipCpp >> *sipRes; 376 Py_END_ALLOW_THREADS 377%End 378 379void writeQVariantList(const QVariantList &qvarlst) /ReleaseGIL/; 380%MethodCode 381 Py_BEGIN_ALLOW_THREADS 382 *sipCpp << *a0; 383 Py_END_ALLOW_THREADS 384%End 385 386QVariantMap readQVariantMap() /ReleaseGIL/; 387%MethodCode 388 sipRes = new QVariantMap; 389 390 Py_BEGIN_ALLOW_THREADS 391 *sipCpp >> *sipRes; 392 Py_END_ALLOW_THREADS 393%End 394 395void writeQVariantMap(const QVariantMap &qvarmap) /ReleaseGIL/; 396%MethodCode 397 Py_BEGIN_ALLOW_THREADS 398 *sipCpp << *a0; 399 Py_END_ALLOW_THREADS 400%End 401 402QVariantHash readQVariantHash() /ReleaseGIL/; 403%MethodCode 404 sipRes = new QVariantHash; 405 406 Py_BEGIN_ALLOW_THREADS 407 *sipCpp >> *sipRes; 408 Py_END_ALLOW_THREADS 409%End 410 411void writeQVariantHash(const QVariantHash &qvarhash) /ReleaseGIL/; 412%MethodCode 413 Py_BEGIN_ALLOW_THREADS 414 *sipCpp << *a0; 415 Py_END_ALLOW_THREADS 416%End 417 SIP_PYOBJECT readBytes() /TypeHint="Py_v3:bytes;str",ReleaseGIL/; 418%MethodCode 419 char *s; 420 uint l; 421 422 Py_BEGIN_ALLOW_THREADS 423 sipCpp->readBytes(s, l); 424 Py_END_ALLOW_THREADS 425 426 if ((sipRes = SIPBytes_FromStringAndSize(s, l)) == NULL) 427 sipIsErr = 1; 428 429 if (s) 430 delete[] s; 431%End 432 433 SIP_PYOBJECT readRawData(int len) /TypeHint="Py_v3:bytes;str",ReleaseGIL/; 434%MethodCode 435 char *s = new char[a0]; 436 437 Py_BEGIN_ALLOW_THREADS 438 sipCpp->readRawData(s, a0); 439 Py_END_ALLOW_THREADS 440 441 sipRes = SIPBytes_FromStringAndSize(s, a0); 442 443 if (!sipRes) 444 sipIsErr = 1; 445 446 delete[] s; 447%End 448 449 QDataStream &writeBytes(const char * /Array/, uint len /ArraySize/) /ReleaseGIL/; 450 int writeRawData(const char * /Array/, int len /ArraySize/) /ReleaseGIL/; 451 452 enum FloatingPointPrecision 453 { 454 SinglePrecision, 455 DoublePrecision, 456 }; 457 458 QDataStream::FloatingPointPrecision floatingPointPrecision() const; 459 void setFloatingPointPrecision(QDataStream::FloatingPointPrecision precision); 460%If (Qt_5_7_0 -) 461 void startTransaction(); 462%End 463%If (Qt_5_7_0 -) 464 bool commitTransaction(); 465%End 466%If (Qt_5_7_0 -) 467 void rollbackTransaction(); 468%End 469%If (Qt_5_7_0 -) 470 void abortTransaction(); 471%End 472 473private: 474 QDataStream(const QDataStream &); 475}; 476