aboutsummaryrefslogtreecommitdiffstats
path: root/sources/pyside2/PySide2/QtNetwork/typesystem_network.xml
diff options
context:
space:
mode:
authorCristian Maureira-Fredes <cristian.maureira-fredes@qt.io>2018-10-11 17:45:43 +0200
committerCristian Maureira-Fredes <cristian.maureira-fredes@qt.io>2018-11-22 17:00:11 +0000
commita57a202a70801f766094c3ed11664b03c9a6a3e4 (patch)
tree73c2c1f4fc902ccbc10b73811bbf299a2c555728 /sources/pyside2/PySide2/QtNetwork/typesystem_network.xml
parentf93a7369657814206bfbce49817c8fbd9a1bfcba (diff)
Move inject-code snippets to separate files
When code must be modified or added to certain functions, we currently have two options: * Write a template and include it into the typesystem, * inject code directly at a certain place of the function entry. The problem with injecting raw code is that since it is an XML file, one need to escape protected symbols, like "<" and "&". Thanks to a couple of complementary commits, now we can place this code snippets on a separate file without triggering a whole module compiling process, since the typesystem itself will not be alterered. All the injected code from the typesystem was removed and placed into a single file per module inside a top-level directory called glue. Some small fixes were included mainly regarding styling of the code. Task-number: PYSIDE-834 Change-Id: I823e92d241a528d75d5940090008db9bf297f49e Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Diffstat (limited to 'sources/pyside2/PySide2/QtNetwork/typesystem_network.xml')
-rw-r--r--sources/pyside2/PySide2/QtNetwork/typesystem_network.xml93
1 files changed, 27 insertions, 66 deletions
diff --git a/sources/pyside2/PySide2/QtNetwork/typesystem_network.xml b/sources/pyside2/PySide2/QtNetwork/typesystem_network.xml
index d277b3228..3ffd9077e 100644
--- a/sources/pyside2/PySide2/QtNetwork/typesystem_network.xml
+++ b/sources/pyside2/PySide2/QtNetwork/typesystem_network.xml
@@ -55,7 +55,7 @@
<enum-type name="EncodingFormat"/>
<enum-type name="KeyAlgorithm"/>
<enum-type name="KeyType"/>
- <enum-type name="SslOption" flags="SslOptions" />
+ <enum-type name="SslOption" flags="SslOptions"/>
<enum-type name="SslProtocol"/>
<extra-includes>
<include file-name="qssl.h" location="global"/>
@@ -65,18 +65,18 @@
<rejection class="QIPv6Address" field-name="c"/>
<object-type name="QAbstractSocket">
- <enum-type name="BindFlag" flags="BindMode" />
+ <enum-type name="BindFlag" flags="BindMode"/>
<enum-type name="NetworkLayerProtocol"/>
- <enum-type name="PauseMode" flags="PauseModes" />
+ <enum-type name="PauseMode" flags="PauseModes"/>
<enum-type name="SocketError"/>
<enum-type name="SocketOption" since="4.6"/>
<enum-type name="SocketState"/>
<enum-type name="SocketType"/>
- <modify-function signature="connectToHost(const QString&amp;,quint16,QFlags&lt;QIODevice::OpenModeFlag>,QAbstractSocket::NetworkLayerProtocol)" allow-thread="yes" />
- <modify-function signature="connectToHost(const QHostAddress&amp;,quint16,QFlags&lt;QIODevice::OpenModeFlag>)" allow-thread="yes" />
- <modify-function signature="disconnectFromHost()" allow-thread="yes" />
- <modify-function signature="waitForConnected(int)" allow-thread="yes" />
- <modify-function signature="waitForDisconnected(int)" allow-thread="yes" />
+ <modify-function signature="connectToHost(const QString&amp;,quint16,QFlags&lt;QIODevice::OpenModeFlag>,QAbstractSocket::NetworkLayerProtocol)" allow-thread="yes"/>
+ <modify-function signature="connectToHost(const QHostAddress&amp;,quint16,QFlags&lt;QIODevice::OpenModeFlag>)" allow-thread="yes"/>
+ <modify-function signature="disconnectFromHost()" allow-thread="yes"/>
+ <modify-function signature="waitForConnected(int)" allow-thread="yes"/>
+ <modify-function signature="waitForDisconnected(int)" allow-thread="yes"/>
</object-type>
<value-type name="QDnsDomainNameRecord"/>
@@ -135,19 +135,7 @@
<modify-argument index="return">
<replace-type modified-type="(data, address, port)"/>
</modify-argument>
- <inject-code class="target" position="beginning">
- Shiboken::AutoArrayPointer&lt;char&gt; data(%ARGUMENT_NAMES);
- QHostAddress ha;
- quint16 port;
- %BEGIN_ALLOW_THREADS
- %RETURN_TYPE retval = %CPPSELF.%FUNCTION_NAME(data, %ARGUMENT_NAMES, &amp;ha, &amp;port);
- %END_ALLOW_THREADS
- QByteArray ba(data, retval);
- %PYARG_0 = PyTuple_New(3);
- PyTuple_SET_ITEM(%PYARG_0, 0, %CONVERTTOPYTHON[QByteArray](ba));
- PyTuple_SET_ITEM(%PYARG_0, 1, %CONVERTTOPYTHON[QHostAddress](ha));
- PyTuple_SET_ITEM(%PYARG_0, 2, %CONVERTTOPYTHON[quint16](port));
- </inject-code>
+ <inject-code class="target" position="beginning" file="../glue/qtnetwork.cpp" snippet="qudpsocket-readdatagram"/>
</modify-function>
<modify-function signature="writeDatagram(const QByteArray&amp;,const QHostAddress&amp;,quint16)" allow-thread="yes"/>
<!-- ### writeDatagram(QByteArray, ...) does the trick -->
@@ -156,7 +144,7 @@
</object-type>
<object-type name="QLocalServer">
- <enum-type name="SocketOption" flags="SocketOptions" />
+ <enum-type name="SocketOption" flags="SocketOptions"/>
<modify-function signature="waitForNewConnection(int,bool*)" allow-thread="yes">
<!-- FIXME -->
<modify-argument index="1">
@@ -193,7 +181,7 @@
<modify-function signature="post(const QNetworkRequest &amp;,const QByteArray &amp;)" allow-thread="yes"/>
<modify-function signature="put(const QNetworkRequest &amp;,QIODevice*)" allow-thread="yes"/>
<modify-function signature="put(const QNetworkRequest &amp;,const QByteArray &amp;)" allow-thread="yes"/>
- <modify-function signature="sendCustomRequest(const QNetworkRequest &amp;,const QByteArray &amp;,QIODevice*)" allow-thread="yes" since="4.7" />
+ <modify-function signature="sendCustomRequest(const QNetworkRequest &amp;,const QByteArray &amp;,QIODevice*)" allow-thread="yes" since="4.7"/>
<modify-function signature="setCookieJar(QNetworkCookieJar*)">
<modify-argument index="1">
<define-ownership class="target" owner="c++"/>
@@ -210,11 +198,11 @@
<enum-type name="ConversionModeFlag" flags="ConversionMode" since="5.8"/>
<enum-type name="SpecialAddress"/>
<!-- ### QHostAddress(QIPv6Address) does this -->
- <modify-function signature="QHostAddress(quint8*)" remove="all" />
- <modify-function signature="QHostAddress(const quint8*)" remove="all" />
+ <modify-function signature="QHostAddress(quint8*)" remove="all"/>
+ <modify-function signature="QHostAddress(const quint8*)" remove="all"/>
<!-- ### -->
- <modify-function signature="setAddress(quint8*)" remove="all" />
- <modify-function signature="setAddress(const quint8*)" remove="all" />
+ <modify-function signature="setAddress(quint8*)" remove="all"/>
+ <modify-function signature="setAddress(const quint8*)" remove="all"/>
</value-type>
<value-type name="QHostInfo">
@@ -232,55 +220,28 @@
</value-type>
<value-type name="QNetworkProxy">
- <enum-type name="Capability" flags="Capabilities" />
+ <enum-type name="Capability" flags="Capabilities"/>
<enum-type name="ProxyType"/>
</value-type>
- <object-type name="QNetworkProxyFactory" />
+ <object-type name="QNetworkProxyFactory"/>
<value-type name="QNetworkProxyQuery">
- <enum-type name="QueryType" />
+ <enum-type name="QueryType"/>
</value-type>
<value-type name="QIPv6Address">
<add-function signature="__len__">
- <inject-code class="target" position="beginning">
- return 16;
- </inject-code>
+ <inject-code class="target" position="beginning" file="../glue/qtnetwork.cpp" snippet="qipv6address-len"/>
</add-function>
<add-function signature="__getitem__">
- <inject-code class="target" position="beginning">
- if (_i >= 16) {
- PyErr_SetString(PyExc_IndexError, "index out of bounds");
- return 0;
- }
- if (_i &lt; 0)
- _i = 16 - qAbs(_i);
-
- uint item = %CPPSELF.c[_i];
- return %CONVERTTOPYTHON[uint](item);
- </inject-code>
- </add-function>
- <add-function signature="__len__">
- <inject-code class="target" position="beginning">
- return 16;
- </inject-code>
+ <inject-code class="target" position="beginning" file="../glue/qtnetwork.cpp" snippet="qipv6address-getitem"/>
</add-function>
<add-function signature="__setitem__">
- <inject-code class="target" position="beginning">
- if (_i >= 16) {
- PyErr_SetString(PyExc_IndexError, "index out of bounds");
- return -1;
- }
- if (_i &lt; 0)
- _i = 16 - qAbs(_i);
- quint8 item = %CONVERTTOCPP[quint8](_value);
- %CPPSELF.c[_i] = item;
- return 0;
- </inject-code>
+ <inject-code class="target" position="beginning" file="../glue/qtnetwork.cpp" snippet="qipv6address-setitem"/>
</add-function>
</value-type>
- <value-type name="QAuthenticator" />
+ <value-type name="QAuthenticator"/>
<value-type name="QNetworkCookie">
<enum-type name="RawForm"/>
<extra-includes>
@@ -297,7 +258,7 @@
</value-type>
<value-type name="QNetworkConfiguration" since="4.7">
- <enum-type name="BearerType" />
+ <enum-type name="BearerType"/>
<enum-type name="Purpose" since="4.7"/>
<enum-type name="StateFlag" flags="StateFlags" since="4.7"/>
<enum-type name="Type" since="4.7"/>
@@ -308,7 +269,7 @@
<object-type name="QNetworkSession" since="4.7">
<enum-type name="SessionError" since="4.7"/>
<enum-type name="State" since="4.7"/>
- <enum-type name="UsagePolicy" flags="UsagePolicies" />
+ <enum-type name="UsagePolicy" flags="UsagePolicies"/>
</object-type>
<object-type name="QAbstractNetworkCache"/>
@@ -328,7 +289,7 @@
<value-type name="QSslCipher"/>
<value-type name="QSslConfiguration">
- <enum-type name="NextProtocolNegotiationStatus" />
+ <enum-type name="NextProtocolNegotiationStatus"/>
</value-type>
<value-type name="QSslDiffieHellmanParameters" since="5.8">
@@ -347,8 +308,8 @@
<object-type name="QSslSocket">
<enum-type name="SslMode"/>
<enum-type name="PeerVerifyMode"/>
- <modify-function signature="connectToHostEncrypted(const QString&amp;,quint16,QFlags&lt;QIODevice::OpenModeFlag>,QAbstractSocket::NetworkLayerProtocol)" allow-thread="yes" />
- <modify-function signature="waitForEncrypted(int)" allow-thread="yes" />
+ <modify-function signature="connectToHostEncrypted(const QString&amp;,quint16,QFlags&lt;QIODevice::OpenModeFlag>,QAbstractSocket::NetworkLayerProtocol)" allow-thread="yes"/>
+ <modify-function signature="waitForEncrypted(int)" allow-thread="yes"/>
</object-type>
<value-type name="QSslPreSharedKeyAuthenticator"/>