qtextstream.sip 5.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181
  1. // qtextstream.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. %ModuleCode
  22. #include <qtextstream.h>
  23. %End
  24. class QTextStream : public QIODeviceBase
  25. {
  26. %TypeHeaderCode
  27. #include <qtextstream.h>
  28. %End
  29. public:
  30. enum RealNumberNotation
  31. {
  32. SmartNotation,
  33. FixedNotation,
  34. ScientificNotation,
  35. };
  36. enum FieldAlignment
  37. {
  38. AlignLeft,
  39. AlignRight,
  40. AlignCenter,
  41. AlignAccountingStyle,
  42. };
  43. enum Status
  44. {
  45. Ok,
  46. ReadPastEnd,
  47. ReadCorruptData,
  48. WriteFailed,
  49. };
  50. enum NumberFlag /BaseType=Flag/
  51. {
  52. ShowBase,
  53. ForcePoint,
  54. ForceSign,
  55. UppercaseBase,
  56. UppercaseDigits,
  57. };
  58. typedef QFlags<QTextStream::NumberFlag> NumberFlags;
  59. QTextStream();
  60. explicit QTextStream(QIODevice *device);
  61. QTextStream(QByteArray *array /Constrained/, QIODeviceBase::OpenMode mode = QIODeviceBase::ReadWrite);
  62. virtual ~QTextStream();
  63. void setEncoding(QStringConverter::Encoding encoding);
  64. QStringConverter::Encoding encoding() const;
  65. void setAutoDetectUnicode(bool enabled);
  66. bool autoDetectUnicode() const;
  67. void setGenerateByteOrderMark(bool generate);
  68. bool generateByteOrderMark() const;
  69. void setLocale(const QLocale &locale);
  70. QLocale locale() const;
  71. void setDevice(QIODevice *device);
  72. QIODevice *device() const;
  73. QTextStream::Status status() const;
  74. void setStatus(QTextStream::Status status);
  75. void resetStatus();
  76. bool atEnd() const;
  77. void reset();
  78. void flush() /ReleaseGIL/;
  79. bool seek(qint64 pos);
  80. qint64 pos() const;
  81. void skipWhiteSpace();
  82. QString readLine(qint64 maxLength = 0) /ReleaseGIL/;
  83. QString readAll() /ReleaseGIL/;
  84. QString read(qint64 maxlen) /ReleaseGIL/;
  85. void setFieldAlignment(QTextStream::FieldAlignment alignment);
  86. QTextStream::FieldAlignment fieldAlignment() const;
  87. void setPadChar(QChar ch);
  88. QChar padChar() const;
  89. void setFieldWidth(int width);
  90. int fieldWidth() const;
  91. void setNumberFlags(QTextStream::NumberFlags flags);
  92. QTextStream::NumberFlags numberFlags() const;
  93. void setIntegerBase(int base);
  94. int integerBase() const;
  95. void setRealNumberNotation(QTextStream::RealNumberNotation notation);
  96. QTextStream::RealNumberNotation realNumberNotation() const;
  97. void setRealNumberPrecision(int precision);
  98. int realNumberPrecision() const;
  99. QTextStream &operator>>(QByteArray &array /Constrained/);
  100. QTextStream &operator<<(QStringView s);
  101. QTextStream &operator<<(const QByteArray &array);
  102. QTextStream &operator<<(double f /Constrained/);
  103. QTextStream &operator<<(SIP_PYOBJECT i /TypeHint="int"/);
  104. %MethodCode
  105. qlonglong val = sipLong_AsLongLong(a1);
  106. if (!PyErr_Occurred())
  107. {
  108. sipRes = &(*a0 << val);
  109. }
  110. else
  111. {
  112. // If it is positive then it might fit an unsigned long long.
  113. qulonglong uval = sipLong_AsUnsignedLongLong(a1);
  114. if (!PyErr_Occurred())
  115. {
  116. sipRes = &(*a0 << uval);
  117. }
  118. else
  119. {
  120. sipError = (PyErr_ExceptionMatches(PyExc_OverflowError)
  121. ? sipErrorFail : sipErrorContinue);
  122. }
  123. }
  124. %End
  125. %If (Qt_6_10_0 -)
  126. operator bool() const;
  127. %End
  128. private:
  129. QTextStream(const QTextStream &);
  130. };
  131. class QTextStreamManipulator;
  132. QTextStream &operator<<(QTextStream &s, QTextStreamManipulator m);
  133. QTextStreamManipulator qSetFieldWidth(int width);
  134. QTextStreamManipulator qSetPadChar(QChar ch);
  135. QTextStreamManipulator qSetRealNumberPrecision(int precision);
  136. namespace Qt
  137. {
  138. %TypeHeaderCode
  139. #include <qtextstream.h>
  140. %End
  141. QTextStream &bin(QTextStream &s);
  142. QTextStream &oct(QTextStream &s);
  143. QTextStream &dec(QTextStream &s);
  144. QTextStream &hex(QTextStream &s);
  145. QTextStream &showbase(QTextStream &s);
  146. QTextStream &forcesign(QTextStream &s);
  147. QTextStream &forcepoint(QTextStream &s);
  148. QTextStream &noshowbase(QTextStream &s);
  149. QTextStream &noforcesign(QTextStream &s);
  150. QTextStream &noforcepoint(QTextStream &s);
  151. QTextStream &uppercasebase(QTextStream &s);
  152. QTextStream &uppercasedigits(QTextStream &s);
  153. QTextStream &lowercasebase(QTextStream &s);
  154. QTextStream &lowercasedigits(QTextStream &s);
  155. QTextStream &fixed(QTextStream &s);
  156. QTextStream &scientific(QTextStream &s);
  157. QTextStream &left(QTextStream &s);
  158. QTextStream &right(QTextStream &s);
  159. QTextStream &center(QTextStream &s);
  160. QTextStream &endl(QTextStream &s);
  161. QTextStream &flush(QTextStream &s);
  162. QTextStream &reset(QTextStream &s);
  163. QTextStream &bom(QTextStream &s);
  164. QTextStream &ws(QTextStream &s);
  165. };