qdatastream.sip 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651
  1. // qdatastream.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 QDataStream : public QIODeviceBase
  22. {
  23. %TypeHeaderCode
  24. #include <qdatastream.h>
  25. %End
  26. public:
  27. enum Version /BaseType=IntEnum/
  28. {
  29. Qt_1_0,
  30. Qt_2_0,
  31. Qt_2_1,
  32. Qt_3_0,
  33. Qt_3_1,
  34. Qt_3_3,
  35. Qt_4_0,
  36. Qt_4_1,
  37. Qt_4_2,
  38. Qt_4_3,
  39. Qt_4_4,
  40. Qt_4_5,
  41. Qt_4_6,
  42. Qt_4_7,
  43. Qt_4_8,
  44. Qt_4_9,
  45. Qt_5_0,
  46. Qt_5_1,
  47. Qt_5_2,
  48. Qt_5_3,
  49. Qt_5_4,
  50. Qt_5_5,
  51. Qt_5_6,
  52. Qt_5_7,
  53. Qt_5_8,
  54. Qt_5_9,
  55. Qt_5_10,
  56. Qt_5_11,
  57. Qt_5_12,
  58. Qt_5_13,
  59. Qt_5_14,
  60. Qt_5_15,
  61. Qt_6_0,
  62. %If (Qt_6_1_0 -)
  63. Qt_6_1,
  64. %End
  65. %If (Qt_6_2_0 -)
  66. Qt_6_2,
  67. %End
  68. %If (Qt_6_3_0 -)
  69. Qt_6_3,
  70. %End
  71. %If (Qt_6_4_0 -)
  72. Qt_6_4,
  73. %End
  74. %If (Qt_6_5_0 -)
  75. Qt_6_5,
  76. %End
  77. %If (Qt_6_6_0 -)
  78. Qt_6_6,
  79. %End
  80. %If (Qt_6_7_0 -)
  81. Qt_6_7,
  82. %End
  83. %If (Qt_6_8_0 -)
  84. Qt_6_8,
  85. %End
  86. %If (Qt_6_9_0 -)
  87. Qt_6_9,
  88. %End
  89. %If (Qt_6_10_0 -)
  90. Qt_6_10,
  91. %End
  92. %If (Qt_6_11_0 -)
  93. Qt_6_11,
  94. %End
  95. };
  96. enum ByteOrder
  97. {
  98. BigEndian,
  99. LittleEndian,
  100. };
  101. enum Status
  102. {
  103. Ok,
  104. ReadPastEnd,
  105. ReadCorruptData,
  106. WriteFailed,
  107. %If (Qt_6_7_0 -)
  108. SizeLimitExceeded,
  109. %End
  110. };
  111. enum FloatingPointPrecision
  112. {
  113. SinglePrecision,
  114. DoublePrecision,
  115. };
  116. QDataStream();
  117. explicit QDataStream(QIODevice *);
  118. QDataStream(QByteArray * /Constrained/, QIODeviceBase::OpenMode flags);
  119. QDataStream(const QByteArray &);
  120. ~QDataStream();
  121. QIODevice *device() const;
  122. void setDevice(QIODevice *);
  123. bool atEnd() const;
  124. QDataStream::Status status() const;
  125. void setStatus(QDataStream::Status status);
  126. void resetStatus();
  127. QDataStream::FloatingPointPrecision floatingPointPrecision() const;
  128. void setFloatingPointPrecision(QDataStream::FloatingPointPrecision precision);
  129. QDataStream::ByteOrder byteOrder() const;
  130. void setByteOrder(QDataStream::ByteOrder);
  131. int version() const;
  132. void setVersion(int);
  133. %If (Qt_6_7_0 -)
  134. SIP_PYOBJECT readBytes() /ReleaseGIL,TypeHint="bytes"/;
  135. %MethodCode
  136. char *s;
  137. qint64 l;
  138. Py_BEGIN_ALLOW_THREADS
  139. sipCpp->readBytes(s, l);
  140. Py_END_ALLOW_THREADS
  141. if ((sipRes = PyBytes_FromStringAndSize(s, l)) == NULL)
  142. sipIsErr = 1;
  143. if (s)
  144. delete[] s;
  145. %End
  146. %End
  147. %If (- Qt_6_7_0)
  148. SIP_PYOBJECT readBytes() /ReleaseGIL,TypeHint="bytes"/;
  149. %MethodCode
  150. char *s;
  151. uint l;
  152. Py_BEGIN_ALLOW_THREADS
  153. sipCpp->readBytes(s, l);
  154. Py_END_ALLOW_THREADS
  155. if ((sipRes = PyBytes_FromStringAndSize(s, l)) == NULL)
  156. sipIsErr = 1;
  157. if (s)
  158. delete[] s;
  159. %End
  160. %End
  161. %If (Qt_6_7_0 -)
  162. SIP_PYOBJECT readRawData(qint64 len) /Encoding="None",ReleaseGIL,TypeHint="bytes"/;
  163. %MethodCode
  164. // Return the data read or None if there was an error.
  165. if (a0 < 0)
  166. {
  167. PyErr_SetString(PyExc_ValueError, "maximum length of data to be read cannot be negative");
  168. sipIsErr = 1;
  169. }
  170. else
  171. {
  172. char *s = new char[a0];
  173. qint64 len;
  174. Py_BEGIN_ALLOW_THREADS
  175. len = sipCpp->readRawData(s, a0);
  176. Py_END_ALLOW_THREADS
  177. if (len < 0)
  178. {
  179. Py_INCREF(Py_None);
  180. sipRes = Py_None;
  181. }
  182. else
  183. {
  184. sipRes = PyBytes_FromStringAndSize(s, len);
  185. if (!sipRes)
  186. sipIsErr = 1;
  187. }
  188. delete[] s;
  189. }
  190. %End
  191. %End
  192. %If (- Qt_6_7_0)
  193. SIP_PYOBJECT readRawData(int len) /Encoding="None",ReleaseGIL,TypeHint="bytes"/;
  194. %MethodCode
  195. // Return the data read or None if there was an error.
  196. if (a0 < 0)
  197. {
  198. PyErr_SetString(PyExc_ValueError, "maximum length of data to be read cannot be negative");
  199. sipIsErr = 1;
  200. }
  201. else
  202. {
  203. char *s = new char[a0];
  204. int len;
  205. Py_BEGIN_ALLOW_THREADS
  206. len = sipCpp->readRawData(s, a0);
  207. Py_END_ALLOW_THREADS
  208. if (len < 0)
  209. {
  210. Py_INCREF(Py_None);
  211. sipRes = Py_None;
  212. }
  213. else
  214. {
  215. sipRes = PyBytes_FromStringAndSize(s, len);
  216. if (!sipRes)
  217. sipIsErr = 1;
  218. }
  219. delete[] s;
  220. }
  221. %End
  222. %End
  223. %If (Qt_6_7_0 -)
  224. QDataStream &writeBytes(SIP_PYBUFFER) /ReleaseGIL/;
  225. %MethodCode
  226. sipBufferInfoDef bi;
  227. if (sipGetBufferInfo(a0, &bi) > 0)
  228. {
  229. Py_BEGIN_ALLOW_THREADS
  230. sipRes = &sipCpp->writeBytes(reinterpret_cast<char *>(bi.bi_buf),
  231. bi.bi_len);
  232. Py_END_ALLOW_THREADS
  233. sipReleaseBufferInfo(&bi);
  234. }
  235. else
  236. {
  237. sipIsErr = 1;
  238. }
  239. %End
  240. %End
  241. %If (- Qt_6_7_0)
  242. QDataStream &writeBytes(SIP_PYBUFFER) /ReleaseGIL/;
  243. %MethodCode
  244. sipBufferInfoDef bi;
  245. if (sipGetBufferInfo(a0, &bi) > 0)
  246. {
  247. Py_BEGIN_ALLOW_THREADS
  248. sipRes = &sipCpp->writeBytes(reinterpret_cast<char *>(bi.bi_buf),
  249. bi.bi_len);
  250. Py_END_ALLOW_THREADS
  251. sipReleaseBufferInfo(&bi);
  252. }
  253. else
  254. {
  255. sipIsErr = 1;
  256. }
  257. %End
  258. %End
  259. %If (Qt_6_7_0 -)
  260. qint64 writeRawData(SIP_PYBUFFER) /ReleaseGIL/;
  261. %MethodCode
  262. sipBufferInfoDef bi;
  263. if (sipGetBufferInfo(a0, &bi) > 0)
  264. {
  265. Py_BEGIN_ALLOW_THREADS
  266. sipRes = sipCpp->writeRawData(reinterpret_cast<char *>(bi.bi_buf),
  267. bi.bi_len);
  268. Py_END_ALLOW_THREADS
  269. sipReleaseBufferInfo(&bi);
  270. }
  271. else
  272. {
  273. sipIsErr = 1;
  274. }
  275. %End
  276. %End
  277. %If (- Qt_6_7_0)
  278. int writeRawData(SIP_PYBUFFER) /ReleaseGIL/;
  279. %MethodCode
  280. sipBufferInfoDef bi;
  281. if (sipGetBufferInfo(a0, &bi) > 0)
  282. {
  283. Py_BEGIN_ALLOW_THREADS
  284. sipRes = sipCpp->writeRawData(reinterpret_cast<char *>(bi.bi_buf),
  285. bi.bi_len);
  286. Py_END_ALLOW_THREADS
  287. sipReleaseBufferInfo(&bi);
  288. }
  289. else
  290. {
  291. sipIsErr = 1;
  292. }
  293. %End
  294. %End
  295. %If (Qt_6_7_0 -)
  296. qint64 skipRawData(qint64 len) /ReleaseGIL/;
  297. %End
  298. %If (- Qt_6_7_0)
  299. int skipRawData(int len) /ReleaseGIL/;
  300. %End
  301. void startTransaction();
  302. bool commitTransaction();
  303. void rollbackTransaction();
  304. void abortTransaction();
  305. // Extra methods to give explicit control over the simple data types being read and written.
  306. int readInt() /ReleaseGIL/;
  307. %MethodCode
  308. Py_BEGIN_ALLOW_THREADS
  309. *sipCpp >> sipRes;
  310. Py_END_ALLOW_THREADS
  311. %End
  312. qint8 readInt8() /ReleaseGIL/;
  313. %MethodCode
  314. Py_BEGIN_ALLOW_THREADS
  315. *sipCpp >> sipRes;
  316. Py_END_ALLOW_THREADS
  317. %End
  318. quint8 readUInt8() /ReleaseGIL/;
  319. %MethodCode
  320. Py_BEGIN_ALLOW_THREADS
  321. *sipCpp >> sipRes;
  322. Py_END_ALLOW_THREADS
  323. %End
  324. qint16 readInt16() /ReleaseGIL/;
  325. %MethodCode
  326. Py_BEGIN_ALLOW_THREADS
  327. *sipCpp >> sipRes;
  328. Py_END_ALLOW_THREADS
  329. %End
  330. quint16 readUInt16() /ReleaseGIL/;
  331. %MethodCode
  332. Py_BEGIN_ALLOW_THREADS
  333. *sipCpp >> sipRes;
  334. Py_END_ALLOW_THREADS
  335. %End
  336. qint32 readInt32() /ReleaseGIL/;
  337. %MethodCode
  338. Py_BEGIN_ALLOW_THREADS
  339. *sipCpp >> sipRes;
  340. Py_END_ALLOW_THREADS
  341. %End
  342. quint32 readUInt32() /ReleaseGIL/;
  343. %MethodCode
  344. Py_BEGIN_ALLOW_THREADS
  345. *sipCpp >> sipRes;
  346. Py_END_ALLOW_THREADS
  347. %End
  348. qint64 readInt64() /ReleaseGIL/;
  349. %MethodCode
  350. Py_BEGIN_ALLOW_THREADS
  351. *sipCpp >> sipRes;
  352. Py_END_ALLOW_THREADS
  353. %End
  354. quint64 readUInt64() /ReleaseGIL/;
  355. %MethodCode
  356. Py_BEGIN_ALLOW_THREADS
  357. *sipCpp >> sipRes;
  358. Py_END_ALLOW_THREADS
  359. %End
  360. bool readBool() /ReleaseGIL/;
  361. %MethodCode
  362. Py_BEGIN_ALLOW_THREADS
  363. *sipCpp >> sipRes;
  364. Py_END_ALLOW_THREADS
  365. %End
  366. float readFloat() /ReleaseGIL/;
  367. %MethodCode
  368. Py_BEGIN_ALLOW_THREADS
  369. *sipCpp >> sipRes;
  370. Py_END_ALLOW_THREADS
  371. %End
  372. double readDouble() /ReleaseGIL/;
  373. %MethodCode
  374. Py_BEGIN_ALLOW_THREADS
  375. *sipCpp >> sipRes;
  376. Py_END_ALLOW_THREADS
  377. %End
  378. SIP_PYOBJECT readString() /ReleaseGIL,TypeHint="bytes"/;
  379. %MethodCode
  380. // Note that this should really be called readCString().
  381. char *s;
  382. Py_BEGIN_ALLOW_THREADS
  383. *sipCpp >> s;
  384. Py_END_ALLOW_THREADS
  385. if (s)
  386. {
  387. sipRes = PyBytes_FromString(s);
  388. delete[] s;
  389. }
  390. else
  391. {
  392. sipRes = Py_None;
  393. Py_INCREF(Py_None);
  394. }
  395. %End
  396. void writeInt(int i) /ReleaseGIL/;
  397. %MethodCode
  398. Py_BEGIN_ALLOW_THREADS
  399. *sipCpp << a0;
  400. Py_END_ALLOW_THREADS
  401. %End
  402. void writeInt8(qint8 i) /ReleaseGIL/;
  403. %MethodCode
  404. Py_BEGIN_ALLOW_THREADS
  405. *sipCpp << a0;
  406. Py_END_ALLOW_THREADS
  407. %End
  408. void writeUInt8(quint8 i) /ReleaseGIL/;
  409. %MethodCode
  410. Py_BEGIN_ALLOW_THREADS
  411. *sipCpp << a0;
  412. Py_END_ALLOW_THREADS
  413. %End
  414. void writeInt16(qint16 i) /ReleaseGIL/;
  415. %MethodCode
  416. Py_BEGIN_ALLOW_THREADS
  417. *sipCpp << a0;
  418. Py_END_ALLOW_THREADS
  419. %End
  420. void writeUInt16(quint16 i) /ReleaseGIL/;
  421. %MethodCode
  422. Py_BEGIN_ALLOW_THREADS
  423. *sipCpp << a0;
  424. Py_END_ALLOW_THREADS
  425. %End
  426. void writeInt32(qint32 i) /ReleaseGIL/;
  427. %MethodCode
  428. Py_BEGIN_ALLOW_THREADS
  429. *sipCpp << a0;
  430. Py_END_ALLOW_THREADS
  431. %End
  432. void writeUInt32(quint32 i) /ReleaseGIL/;
  433. %MethodCode
  434. Py_BEGIN_ALLOW_THREADS
  435. *sipCpp << a0;
  436. Py_END_ALLOW_THREADS
  437. %End
  438. void writeInt64(qint64 i) /ReleaseGIL/;
  439. %MethodCode
  440. Py_BEGIN_ALLOW_THREADS
  441. *sipCpp << a0;
  442. Py_END_ALLOW_THREADS
  443. %End
  444. void writeUInt64(quint64 i) /ReleaseGIL/;
  445. %MethodCode
  446. Py_BEGIN_ALLOW_THREADS
  447. *sipCpp << a0;
  448. Py_END_ALLOW_THREADS
  449. %End
  450. void writeBool(bool i) /ReleaseGIL/;
  451. %MethodCode
  452. Py_BEGIN_ALLOW_THREADS
  453. *sipCpp << a0;
  454. Py_END_ALLOW_THREADS
  455. %End
  456. void writeFloat(float f) /ReleaseGIL/;
  457. %MethodCode
  458. Py_BEGIN_ALLOW_THREADS
  459. *sipCpp << a0;
  460. Py_END_ALLOW_THREADS
  461. %End
  462. void writeDouble(double f) /ReleaseGIL/;
  463. %MethodCode
  464. Py_BEGIN_ALLOW_THREADS
  465. *sipCpp << a0;
  466. Py_END_ALLOW_THREADS
  467. %End
  468. void writeString(const char *str /Encoding="None"/) /ReleaseGIL/;
  469. %MethodCode
  470. // Note that this should really be called writeCString().
  471. Py_BEGIN_ALLOW_THREADS
  472. *sipCpp << a0;
  473. Py_END_ALLOW_THREADS
  474. %End
  475. QString readQString() /ReleaseGIL/;
  476. %MethodCode
  477. sipRes = new QString;
  478. Py_BEGIN_ALLOW_THREADS
  479. *sipCpp >> *sipRes;
  480. Py_END_ALLOW_THREADS
  481. %End
  482. void writeQString(const QString &qstr) /ReleaseGIL/;
  483. %MethodCode
  484. Py_BEGIN_ALLOW_THREADS
  485. *sipCpp << *a0;
  486. Py_END_ALLOW_THREADS
  487. %End
  488. QStringList readQStringList() /ReleaseGIL/;
  489. %MethodCode
  490. sipRes = new QStringList;
  491. Py_BEGIN_ALLOW_THREADS
  492. *sipCpp >> *sipRes;
  493. Py_END_ALLOW_THREADS
  494. %End
  495. void writeQStringList(const QStringList &qstrlst) /ReleaseGIL/;
  496. %MethodCode
  497. Py_BEGIN_ALLOW_THREADS
  498. *sipCpp << *a0;
  499. Py_END_ALLOW_THREADS
  500. %End
  501. QVariant readQVariant() /ReleaseGIL/;
  502. %MethodCode
  503. sipRes = new QVariant;
  504. Py_BEGIN_ALLOW_THREADS
  505. *sipCpp >> *sipRes;
  506. Py_END_ALLOW_THREADS
  507. %End
  508. void writeQVariant(const QVariant &qvar) /ReleaseGIL/;
  509. %MethodCode
  510. Py_BEGIN_ALLOW_THREADS
  511. *sipCpp << *a0;
  512. Py_END_ALLOW_THREADS
  513. %End
  514. QVariantList readQVariantList() /ReleaseGIL/;
  515. %MethodCode
  516. sipRes = new QVariantList;
  517. Py_BEGIN_ALLOW_THREADS
  518. *sipCpp >> *sipRes;
  519. Py_END_ALLOW_THREADS
  520. %End
  521. void writeQVariantList(const QVariantList &qvarlst) /ReleaseGIL/;
  522. %MethodCode
  523. Py_BEGIN_ALLOW_THREADS
  524. *sipCpp << *a0;
  525. Py_END_ALLOW_THREADS
  526. %End
  527. QVariantMap readQVariantMap() /ReleaseGIL/;
  528. %MethodCode
  529. sipRes = new QVariantMap;
  530. Py_BEGIN_ALLOW_THREADS
  531. *sipCpp >> *sipRes;
  532. Py_END_ALLOW_THREADS
  533. %End
  534. void writeQVariantMap(const QVariantMap &qvarmap) /ReleaseGIL/;
  535. %MethodCode
  536. Py_BEGIN_ALLOW_THREADS
  537. *sipCpp << *a0;
  538. Py_END_ALLOW_THREADS
  539. %End
  540. QVariantHash readQVariantHash() /ReleaseGIL/;
  541. %MethodCode
  542. sipRes = new QVariantHash;
  543. Py_BEGIN_ALLOW_THREADS
  544. *sipCpp >> *sipRes;
  545. Py_END_ALLOW_THREADS
  546. %End
  547. void writeQVariantHash(const QVariantHash &qvarhash) /ReleaseGIL/;
  548. %MethodCode
  549. Py_BEGIN_ALLOW_THREADS
  550. *sipCpp << *a0;
  551. Py_END_ALLOW_THREADS
  552. %End
  553. %If (Qt_6_10_0 -)
  554. operator bool() const;
  555. %End
  556. private:
  557. QDataStream(const QDataStream &);
  558. };
  559. %If (Qt_6_10_0 -)
  560. QDataStream &operator>>(QDataStream &in, QChar &chr /Constrained/) /ReleaseGIL/;
  561. %End
  562. %If (Qt_6_10_0 -)
  563. QDataStream &operator<<(QDataStream &out, QChar chr) /ReleaseGIL/;
  564. %End
  565. QDataStream &operator>>(QDataStream &s, QKeyCombination &combination /Constrained/) /ReleaseGIL/;
  566. QDataStream &operator<<(QDataStream &s, QKeyCombination combination) /ReleaseGIL/;