diff options
author | Adrian Herrmann <adrian.herrmann@qt.io> | 2023-08-30 19:05:38 +0200 |
---|---|---|
committer | Adrian Herrmann <adrian.herrmann@qt.io> | 2023-08-31 13:10:20 +0200 |
commit | 762cffbd319834245e8994f3104fc722e1394bd2 (patch) | |
tree | b7e645a634ff03321bd93343a01f7a7701da8879 /sources/pyside6/PySide6/QtCore/typesystem_core_common.xml | |
parent | c2ad08a6d2e5b9bb743194ce46643d113dc895ed (diff) |
QIODevice: Implement buffered reads
Some users of QIODevice read functions (read, readLine and peek) might
want to use fixed buffers to avoid reallocation, e.g., asyncio's
buffered protocols. This adds overloads of said read functions that take
an input buffer (as a bytearray) and return the number of read bytes.
Pick-to: 6.5
Change-Id: I0c3678d3a87811029278c5ae8f829eef0432099a
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Reviewed-by: Shyamnath Premnadh <Shyamnath.Premnadh@qt.io>
Diffstat (limited to 'sources/pyside6/PySide6/QtCore/typesystem_core_common.xml')
-rw-r--r-- | sources/pyside6/PySide6/QtCore/typesystem_core_common.xml | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/sources/pyside6/PySide6/QtCore/typesystem_core_common.xml b/sources/pyside6/PySide6/QtCore/typesystem_core_common.xml index f1d3609b0..07a03b3e3 100644 --- a/sources/pyside6/PySide6/QtCore/typesystem_core_common.xml +++ b/sources/pyside6/PySide6/QtCore/typesystem_core_common.xml @@ -2301,12 +2301,21 @@ <modify-function signature="write(const QByteArray&)" allow-thread="yes"/> <modify-function signature="waitForReadyRead(int)" allow-thread="yes"/> <modify-function signature="waitForBytesWritten(int)" allow-thread="yes"/> - <!-- ### peek(qint64) do the job --> <modify-function signature="peek(char*,qint64)" remove="all"/> - <!-- ### read(qint64) do the job --> + <add-function signature="peek(PyBuffer@buffer@,qint64@maxlen@)" return-type="qint64"> + <modify-argument index="1" pyi-type="bytearray"/> + <inject-code class="target" position="beginning" file="../glue/qtcore.cpp" snippet="qiodevice-bufferedread"/> + </add-function> <modify-function signature="read(char*,qint64)" remove="all"/> - <!-- ### readLine(qint64) do the job --> + <add-function signature="read(PyBuffer@buffer@,qint64@maxlen@)" return-type="qint64"> + <modify-argument index="1" pyi-type="bytearray"/> + <inject-code class="target" position="beginning" file="../glue/qtcore.cpp" snippet="qiodevice-bufferedread"/> + </add-function> <modify-function signature="readLine(char*,qint64)" remove="all"/> + <add-function signature="readLine(PyBuffer@buffer@,qint64@maxlen@)" return-type="qint64"> + <modify-argument index="1" pyi-type="bytearray"/> + <inject-code class="target" position="beginning" file="../glue/qtcore.cpp" snippet="qiodevice-bufferedread"/> + </add-function> <!-- ### write(str) do the job --> <modify-function signature="write(const char*,qint64)" remove="all"/> <modify-function signature="write(const char*)" remove="all"/> |