From 90825e2392b2d70e43c7a25b8a3752299a933894 Mon Sep 17 00:00:00 2001 From: toma Date: Wed, 25 Nov 2009 17:56:58 +0000 Subject: Copy the KDE 3.5 branch to branches/trinity for new KDE 3.5 features. BUG:215923 git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdebindings@1054174 283d02a7-25f6-0310-bc7c-ecb5cbfe19da --- python/pyqt/sip/qtnetwork/copying.sip | 51 ++++ python/pyqt/sip/qtnetwork/qdns.sip | 274 ++++++++++++++++++++++ python/pyqt/sip/qtnetwork/qftp.sip | 183 +++++++++++++++ python/pyqt/sip/qtnetwork/qhostaddress.sip | 99 ++++++++ python/pyqt/sip/qtnetwork/qhttp.sip | 279 ++++++++++++++++++++++ python/pyqt/sip/qtnetwork/qlocalfs.sip | 56 +++++ python/pyqt/sip/qtnetwork/qnetwork.sip | 34 +++ python/pyqt/sip/qtnetwork/qserversocket.sip | 70 ++++++ python/pyqt/sip/qtnetwork/qsocket.sip | 348 ++++++++++++++++++++++++++++ python/pyqt/sip/qtnetwork/qsocketdevice.sip | 224 ++++++++++++++++++ python/pyqt/sip/qtnetwork/qtnetworkmod.sip | 78 +++++++ 11 files changed, 1696 insertions(+) create mode 100644 python/pyqt/sip/qtnetwork/copying.sip create mode 100644 python/pyqt/sip/qtnetwork/qdns.sip create mode 100644 python/pyqt/sip/qtnetwork/qftp.sip create mode 100644 python/pyqt/sip/qtnetwork/qhostaddress.sip create mode 100644 python/pyqt/sip/qtnetwork/qhttp.sip create mode 100644 python/pyqt/sip/qtnetwork/qlocalfs.sip create mode 100644 python/pyqt/sip/qtnetwork/qnetwork.sip create mode 100644 python/pyqt/sip/qtnetwork/qserversocket.sip create mode 100644 python/pyqt/sip/qtnetwork/qsocket.sip create mode 100644 python/pyqt/sip/qtnetwork/qsocketdevice.sip create mode 100644 python/pyqt/sip/qtnetwork/qtnetworkmod.sip (limited to 'python/pyqt/sip/qtnetwork') diff --git a/python/pyqt/sip/qtnetwork/copying.sip b/python/pyqt/sip/qtnetwork/copying.sip new file mode 100644 index 00000000..463904b2 --- /dev/null +++ b/python/pyqt/sip/qtnetwork/copying.sip @@ -0,0 +1,51 @@ +// This is the SIP file defining the PyQt license. +// +// Copyright (c) 2007 +// Riverbank Computing Limited +// +// This file is part of PyQt. +// +// This copy of PyQt is free software; you can redistribute it and/or modify it +// under the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2, or (at your option) any later +// version. +// +// PyQt is supplied in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS +// FOR A PARTICULAR PURPOSE. See the GNU General Public License for more +// details. +// +// You should have received a copy of the GNU General Public License along with +// PyQt; see the file LICENSE. If not, write to the Free Software Foundation, +// Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + + +%Copying +Copyright (c) 2007 + Riverbank Computing Limited + +This file is part of PyQt. + +This copy of PyQt is free software; you can redistribute it and/or modify it +under the terms of the GNU General Public License as published by the Free +Software Foundation; either version 2, or (at your option) any later +version. + +PyQt is supplied in the hope that it will be useful, but WITHOUT ANY +WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS +FOR A PARTICULAR PURPOSE. See the GNU General Public License for more +details. + +You should have received a copy of the GNU General Public License along with +PyQt; see the file LICENSE. If not, write to the Free Software Foundation, +Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +%End + + +%OptionalInclude pyqt-internal.sip +%OptionalInclude pyqt-gpl.sip +%OptionalInclude pyqt-commercial.sip +%OptionalInclude pyqt-edu.sip +%OptionalInclude pyqt-eval.sip +%OptionalInclude pyqt-nc.sip +%OptionalInclude pyqt-tkc.sip diff --git a/python/pyqt/sip/qtnetwork/qdns.sip b/python/pyqt/sip/qtnetwork/qdns.sip new file mode 100644 index 00000000..b91bb9fc --- /dev/null +++ b/python/pyqt/sip/qtnetwork/qdns.sip @@ -0,0 +1,274 @@ +// This is the SIP interface definition for QDns. +// +// Copyright (c) 2007 +// Riverbank Computing Limited +// +// This file is part of PyQt. +// +// This copy of PyQt is free software; you can redistribute it and/or modify it +// under the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2, or (at your option) any later +// version. +// +// PyQt is supplied in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS +// FOR A PARTICULAR PURPOSE. See the GNU General Public License for more +// details. +// +// You should have received a copy of the GNU General Public License along with +// PyQt; see the file LICENSE. If not, write to the Free Software Foundation, +// Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + + +%ExportedDoc +QDns (Qt v2.2+) + +QDns is fully implemented. + + +%End + + +%If (Qt_DNS) +%If (Qt_2_2_0 -) + +class QDns : QObject +{ +%TypeHeaderCode +#include +%End + +public: + enum RecordType { + None, + A, + Aaaa, + Mx, + Srv, + Cname, + Ptr, + Txt + }; + + QDns(); + QDns(const QString &,RecordType = A); + QDns(const QHostAddress &,RecordType = A); + + virtual void setLabel(const QString &); + virtual void setLabel(const QHostAddress &); + QString label() const; + + virtual void setRecordType(RecordType = A); + RecordType recordType() const; + + bool isWorking() const; + + QValueList addresses() const; + + class MailServer + { + public: + MailServer(const QString & = QString::null,Q_UINT16 = 0); + + QString name; + Q_UINT16 priority; + }; + + QValueList mailServers() const; + + class Server + { + public: + Server(const QString & = QString::null,Q_UINT16 = 0, + Q_UINT16 = 0,Q_UINT16 = 0); + + QString name; + Q_UINT16 priority; + Q_UINT16 weight; + Q_UINT16 port; + }; + + QValueList servers() const; + + QStringList hostNames() const; + + QStringList texts() const; + + QString canonicalName() const; + + QStringList qualifiedNames() const; + +signals: + void resultsReady(); +}; + + +%MappedType QValueList +{ +%TypeHeaderCode +#include +%End + +%ConvertFromTypeCode + // Convert to a Python list of QHostAddress instances. + + int i; + PyObject *l; + + // Create the list. + + if ((l = PyList_New(sipCpp -> count())) == NULL) + return NULL; + + // Get it. + + i = 0; + QValueListConstIterator it; + + for (it = sipCpp -> begin(); it != sipCpp -> end(); ++it) + { + PyObject *tmobj; + + if ((tmobj = sipConvertFromNewInstance(new QHostAddress(*it),sipClass_QHostAddress,sipTransferObj)) == NULL || PyList_SetItem(l,i,tmobj) < 0) + { + Py_XDECREF(tmobj); + Py_DECREF(l); + + return NULL; + } + + ++i; + } + + return l; +%End + +%ConvertToTypeCode + // At the moment this will never be called, so provide a null + // implementation. + + if (sipIsErr == NULL) + return PyList_Check(sipPy); + + PyErr_Format(PyExc_TypeError,"Converting to QValueList not yet implemented"); + + *sipIsErr = 1; + + return 0; +%End +}; + + +%MappedType QValueList +{ +%TypeHeaderCode +#include +%End + +%ConvertFromTypeCode + // Convert to a Python list of QDns::MailServer instances. + + int i; + PyObject *l; + + // Create the list. + + if ((l = PyList_New(sipCpp -> count())) == NULL) + return NULL; + + // Get it. + + i = 0; + QValueListConstIterator it; + + for (it = sipCpp -> begin(); it != sipCpp -> end(); ++it) + { + PyObject *tmobj; + + if ((tmobj = sipConvertFromNewInstance(new QDns::MailServer(*it),sipClass_QDns_MailServer,sipTransferObj)) == NULL || PyList_SetItem(l,i,tmobj) < 0) + { + Py_XDECREF(tmobj); + Py_DECREF(l); + + return NULL; + } + + ++i; + } + + return l; +%End + +%ConvertToTypeCode + // At the moment this will never be called, so provide a null + // implementation. + + if (sipIsErr == NULL) + return PyList_Check(sipPy); + + PyErr_Format(PyExc_TypeError,"Converting to QValueList not yet implemented"); + + *sipIsErr = 1; + + return 0; +%End +}; + + +%MappedType QValueList +{ +%TypeHeaderCode +#include +%End + +%ConvertFromTypeCode + // Convert to a Python list of QDns::Server instances. + + int i; + PyObject *l; + + // Create the list. + + if ((l = PyList_New(sipCpp -> count())) == NULL) + return NULL; + + // Get it. + + i = 0; + QValueListConstIterator it; + + for (it = sipCpp -> begin(); it != sipCpp -> end(); ++it) + { + PyObject *tmobj; + + if ((tmobj = sipConvertFromNewInstance(new QDns::Server(*it),sipClass_QDns_Server,sipTransferObj)) == NULL || PyList_SetItem(l,i,tmobj) < 0) + { + Py_XDECREF(tmobj); + Py_DECREF(l); + + return NULL; + } + + ++i; + } + + return l; +%End + +%ConvertToTypeCode + // At the moment this will never be called, so provide a null + // implementation. + + if (sipIsErr == NULL) + return PyList_Check(sipPy); + + PyErr_Format(PyExc_TypeError,"Converting to QValueList not yet implemented"); + + *sipIsErr = 1; + + return 0; +%End +}; + +%End +%End diff --git a/python/pyqt/sip/qtnetwork/qftp.sip b/python/pyqt/sip/qtnetwork/qftp.sip new file mode 100644 index 00000000..f79ecc12 --- /dev/null +++ b/python/pyqt/sip/qtnetwork/qftp.sip @@ -0,0 +1,183 @@ +// This is the SIP interface definition for QFtp. +// +// Copyright (c) 2007 +// Riverbank Computing Limited +// +// This file is part of PyQt. +// +// This copy of PyQt is free software; you can redistribute it and/or modify it +// under the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2, or (at your option) any later +// version. +// +// PyQt is supplied in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS +// FOR A PARTICULAR PURPOSE. See the GNU General Public License for more +// details. +// +// You should have received a copy of the GNU General Public License along with +// PyQt; see the file LICENSE. If not, write to the Free Software Foundation, +// Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + + +%ExportedDoc +QFtp (Qt v2.2+) + + Q_LONG readBlock + char *data + Q_ULONG maxlen + + +This takes a single maxlen parameter. The +data is returned if there was no error, otherwise +None is returned. + + +%End + + +%If (Qt_NETWORKPROTOCOL_FTP) +%If (Qt_2_2_0 -) + +class QFtp : QNetworkProtocol +{ +%TypeHeaderCode +#include +%End + +public: + QFtp(); +%If (Qt_3_1_0 -) + QFtp(QObject * /TransferThis/,const char * = 0); +%End + virtual ~QFtp(); + +%If (Qt_3_0_0 -) + int supportedOperations() const; +%End +%If (- Qt_3_0_0) + virtual int supportedOperations() const; +%End + +%If (Qt_3_1_0 -) + enum State { + Unconnected, + HostLookup, + Connecting, + Connected, + LoggedIn, + Closing + }; + + enum Error { + NoError, + UnknownError, + HostNotFound, + ConnectionRefused, + NotConnected + }; + + enum Command { + None, + ConnectToHost, + Login, + Close, + List, + Cd, + Get, + Put, + Remove, + Mkdir, + Rmdir, + Rename, + RawCommand + }; + + int connectToHost(const QString &,Q_UINT16 = 21) /ReleaseGIL/; + int login(const QString & = QString::null, + const QString & = QString::null) /ReleaseGIL/; + int close() /ReleaseGIL/; + int list(const QString & = QString::null) /ReleaseGIL/; + int cd(const QString &) /ReleaseGIL/; + int get(const QString &,QIODevice * = 0) /ReleaseGIL/; + int put(const QByteArray &,const QString &) /ReleaseGIL/; + int put(QIODevice *,const QString &) /ReleaseGIL/; + int remove(const QString &) /ReleaseGIL/; + int mkdir(const QString &) /ReleaseGIL/; + int rmdir(const QString &) /ReleaseGIL/; + int rename(const QString &,const QString &) /ReleaseGIL/; + + int rawCommand(const QString &) /ReleaseGIL/; + + unsigned long bytesAvailable() const; + + SIP_PYOBJECT readBlock(Q_ULONG) /ReleaseGIL/ [Q_LONG (char *,Q_ULONG)]; +%MethodCode + char *buf; + + if ((buf = (char *)sipMalloc(a0)) == NULL) + sipIsErr = 1; + else + { + Q_LONG actlen; + + Py_BEGIN_ALLOW_THREADS + actlen = sipCpp -> QFtp::readBlock(buf,a0); + Py_END_ALLOW_THREADS + + if (actlen < 0) + { + Py_INCREF(Py_None); + sipRes = Py_None; + } + else if ((sipRes = PyString_FromStringAndSize(buf,actlen)) == NULL) + sipIsErr = 1; + + sipFree((ANY *)buf); + } +%End + + QByteArray readAll() /ReleaseGIL/; + + int currentId() const; + QIODevice* currentDevice() const; + Command currentCommand() const; + bool hasPendingCommands() const; + void clearPendingCommands(); + + State state() const; + + Error error() const; + QString errorString() const; +%End + +public slots: +%If (Qt_3_1_0 -) + void abort(); +%End + +signals: +%If (Qt_3_1_0 -) + void stateChanged(int); + void listInfo(const QUrlInfo &); + void readyRead(); + void dataTransferProgress(int,int); + void rawCommandReply(int,const QString &); + + void commandStarted(int); + void commandFinished(int,bool); + void done(bool); +%End + +protected: + void parseDir(const QString &,QUrlInfo &); + virtual void operationListChildren(QNetworkOperation *); + virtual void operationMkDir(QNetworkOperation *); + virtual void operationRemove(QNetworkOperation *); + virtual void operationRename(QNetworkOperation *); + virtual void operationGet(QNetworkOperation *); + virtual void operationPut(QNetworkOperation *); +}; + +%End +%End diff --git a/python/pyqt/sip/qtnetwork/qhostaddress.sip b/python/pyqt/sip/qtnetwork/qhostaddress.sip new file mode 100644 index 00000000..e2379e2c --- /dev/null +++ b/python/pyqt/sip/qtnetwork/qhostaddress.sip @@ -0,0 +1,99 @@ +// This is the SIP interface definition for QHostAddress. +// +// Copyright (c) 2007 +// Riverbank Computing Limited +// +// This file is part of PyQt. +// +// This copy of PyQt is free software; you can redistribute it and/or modify it +// under the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2, or (at your option) any later +// version. +// +// PyQt is supplied in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS +// FOR A PARTICULAR PURPOSE. See the GNU General Public License for more +// details. +// +// You should have received a copy of the GNU General Public License along with +// PyQt; see the file LICENSE. If not, write to the Free Software Foundation, +// Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + + +%ExportedDoc +QHostAddress (Qt v2.2+) + + QHostAddress + Q_UINT8 *ip6Addr + + +Not yet implemented. + + + + QHostAddress + const Q_IPV6ADDR &ip6Addr + + +Not yet implemented. + + + + void setAddress + Q_UINT8 *ip6Addr + + +Not yet implemented. + + + + Q_IPV6ADDR toIPv6Address const + + + +Not yet implemented. + + +%End + + +%If (Qt_2_2_0 -) + +class QHostAddress +{ +%TypeHeaderCode +#include +%End + +public: + QHostAddress(); + QHostAddress(Q_UINT32); +// QHostAddress(Q_UINT8 *); +%If (Qt_3_3_0 -) + //QHostAddress(const Q_IPV6ADDR &); + // This isn't mentioned in the documentation. + //QHostAddress(const QString &); +%End + QHostAddress(const QHostAddress &); + + void setAddress(Q_UINT32); +// void setAddress(Q_UINT8 *); + bool setAddress(const QString &); + bool isIp4Addr() const; + Q_UINT32 ip4Addr() const; + +%If (Qt_3_3_0 -) + bool isIPv4Address() const; + Q_UINT32 toIPv4Address() const; + bool isIPv6Address() const; + //Q_IPV6ADDR toIPv6Address() const; +%End + + QString toString() const; + +%If (Qt_3_2_0 -) + bool isNull() const; +%End +}; + +%End diff --git a/python/pyqt/sip/qtnetwork/qhttp.sip b/python/pyqt/sip/qtnetwork/qhttp.sip new file mode 100644 index 00000000..fbcc9999 --- /dev/null +++ b/python/pyqt/sip/qtnetwork/qhttp.sip @@ -0,0 +1,279 @@ +// This is the SIP interface definition for QHttp, QHttpHeader, +// QHttpRequestHeader and QHttpResponseHeader. +// +// Copyright (c) 2007 +// Riverbank Computing Limited +// +// This file is part of PyQt. +// +// This copy of PyQt is free software; you can redistribute it and/or modify it +// under the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2, or (at your option) any later +// version. +// +// PyQt is supplied in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS +// FOR A PARTICULAR PURPOSE. See the GNU General Public License for more +// details. +// +// You should have received a copy of the GNU General Public License along with +// PyQt; see the file LICENSE. If not, write to the Free Software Foundation, +// Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + + +%ExportedDoc +QHttp (Qt v3+) + + Q_LONG readBlock + char *data + Q_ULONG maxlen + + +This takes a single maxlen parameter. The +data is returned if there was no error, otherwise +None is returned. + + + +QHttpHeader (Qt v3.1+) + +QHttpHeader is fully implemented. + + + +QHttpRequestHeader (Qt v3.1+) + +QHttpRequestHeader is fully implemented. + + + +QHttpResponseHeader (Qt v3.1+) + +QHttpResponseHeader is fully implemented. + + +%End + + +%If (Qt_NETWORKPROTOCOL_HTTP) +%If (Qt_3_1_0 -) + +class QHttpHeader +{ +%TypeHeaderCode +#include +%End + +public: + QHttpHeader(); + QHttpHeader(const QHttpHeader &); + QHttpHeader(const QString &); + virtual ~QHttpHeader(); + + QString value(const QString &) const; + void setValue(const QString &,const QString &); + void removeValue(const QString &); + + QStringList keys() const; + bool hasKey(const QString &) const; + + bool hasContentLength() const; + uint contentLength() const; + void setContentLength(int); + + bool hasContentType() const; + QString contentType() const; + void setContentType(const QString &); + + virtual QString toString() const; + bool isValid() const; + + virtual int majorVersion() const = 0; + virtual int minorVersion() const = 0; + +protected: + virtual bool parseLine(const QString &,int); + bool parse(const QString &); + void setValid(bool); +}; + + +class QHttpResponseHeader : QHttpHeader +{ +%TypeHeaderCode +#include +%End + +public: + QHttpResponseHeader(); + QHttpResponseHeader(const QHttpResponseHeader &); + + int statusCode() const; + QString reasonPhrase() const; + + int majorVersion() const; + int minorVersion() const; + + QString toString() const; + +protected: + bool parseLine(const QString &,int); +}; + + +class QHttpRequestHeader : QHttpHeader +{ +%TypeHeaderCode +#include +%End + +public: + QHttpRequestHeader(); + QHttpRequestHeader(const QString &,const QString &,int = 1,int = 1); + QHttpRequestHeader(const QHttpRequestHeader &); + QHttpRequestHeader(const QString &); + + void setRequest(const QString &,const QString &,int = 1,int = 1); + + QString method() const; + QString path() const; + + int majorVersion() const; + int minorVersion() const; + + QString toString() const; + +protected: + bool parseLine(const QString &,int); +}; + +%End + + +%If (Qt_3_0_0 -) + +class QHttp : QNetworkProtocol +{ +%TypeHeaderCode +#include +%End + +public: + QHttp(); +%If (Qt_3_1_0 -) + QHttp(QObject * /TransferThis/,const char * = 0); + QHttp(const QString &,Q_UINT16 = 80,QObject * /TransferThis/ = 0, + const char * = 0); + virtual ~QHttp(); +%End + + int supportedOperations() const; + +%If (Qt_3_1_0 -) + enum State { + Unconnected, + HostLookup, + Connecting, + Sending, + Reading, + Connected, + Closing + }; + + enum Error { + NoError, + UnknownError, + HostNotFound, + ConnectionRefused, + UnexpectedClose, + InvalidResponseHeader, + WrongContentLength, + Aborted + }; + + int setHost(const QString &,Q_UINT16 = 80); + + int get(const QString &,QIODevice * = 0) /ReleaseGIL/; + int post(const QString &,QIODevice *,QIODevice * = 0) /ReleaseGIL/; + int post(const QString &,const QByteArray &, + QIODevice * = 0) /ReleaseGIL/; + int head(const QString &) /ReleaseGIL/; + int request(const QHttpRequestHeader &,QIODevice * = 0, + QIODevice * = 0) /ReleaseGIL/; + int request(const QHttpRequestHeader &,const QByteArray &, + QIODevice * = 0) /ReleaseGIL/; + + int closeConnection(); + + unsigned long bytesAvailable() const; + + SIP_PYOBJECT readBlock(Q_ULONG) /ReleaseGIL/ [Q_LONG (char *,Q_ULONG)]; +%MethodCode + char *buf; + + if ((buf = (char *)sipMalloc(a0)) == NULL) + sipIsErr = 1; + else + { + Q_LONG actlen; + + Py_BEGIN_ALLOW_THREADS + actlen = sipCpp -> QHttp::readBlock(buf,a0); + Py_END_ALLOW_THREADS + + if (actlen < 0) + { + Py_INCREF(Py_None); + sipRes = Py_None; + } + else if ((sipRes = PyString_FromStringAndSize(buf,actlen)) == NULL) + sipIsErr = 1; + + sipFree((ANY *)buf); + } +%End + + QByteArray readAll() /ReleaseGIL/; + + int currentId() const; + QIODevice *currentSourceDevice() const; + QIODevice *currentDestinationDevice() const; + QHttpRequestHeader currentRequest() const; + bool hasPendingRequests() const; + void clearPendingRequests(); + + State state() const; + + Error error() const; + QString errorString() const; +%End + +public slots: +%If (Qt_3_1_0 -) + void abort(); +%End + +signals: +%If (Qt_3_1_0 -) + void stateChanged(int); + void responseHeaderReceived(const QHttpResponseHeader &); + void readyRead(const QHttpResponseHeader &); + void dataSendProgress(int,int); + void dataReadProgress(int,int); + + void requestStarted(int); + void requestFinished(int,bool); + void done(bool); +%End + +protected: + void operationGet(QNetworkOperation *); + void operationPut(QNetworkOperation *); + +%If (Qt_3_1_0 -) + void timerEvent(QTimerEvent *); +%End +}; + +%End +%End diff --git a/python/pyqt/sip/qtnetwork/qlocalfs.sip b/python/pyqt/sip/qtnetwork/qlocalfs.sip new file mode 100644 index 00000000..a8b816f1 --- /dev/null +++ b/python/pyqt/sip/qtnetwork/qlocalfs.sip @@ -0,0 +1,56 @@ +// This is the SIP interface definition for QLocalFs. +// +// Copyright (c) 2007 +// Riverbank Computing Limited +// +// This file is part of PyQt. +// +// This copy of PyQt is free software; you can redistribute it and/or modify it +// under the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2, or (at your option) any later +// version. +// +// PyQt is supplied in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS +// FOR A PARTICULAR PURPOSE. See the GNU General Public License for more +// details. +// +// You should have received a copy of the GNU General Public License along with +// PyQt; see the file LICENSE. If not, write to the Free Software Foundation, +// Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + + +%ExportedDoc +QLocalFs (Qt v2.1+) + +QLocalFs is fully implemented. + + +%End + + +%If (Qt_NETWORKPROTOCOL) +%If (Qt_2_1_0 -) + +class QLocalFs : QNetworkProtocol +{ +%TypeHeaderCode +#include +%End + +public: + QLocalFs(); + + virtual int supportedOperations() const; + +protected: + virtual void operationListChildren(QNetworkOperation *); + virtual void operationMkDir(QNetworkOperation *); + virtual void operationRemove(QNetworkOperation *); + virtual void operationRename(QNetworkOperation *); + virtual void operationGet(QNetworkOperation *); + virtual void operationPut(QNetworkOperation *); +}; + +%End +%End diff --git a/python/pyqt/sip/qtnetwork/qnetwork.sip b/python/pyqt/sip/qtnetwork/qnetwork.sip new file mode 100644 index 00000000..6b87d4e4 --- /dev/null +++ b/python/pyqt/sip/qtnetwork/qnetwork.sip @@ -0,0 +1,34 @@ +// This is the SIP interface definition for qInitNetworkProtocols. +// +// Copyright (c) 2007 +// Riverbank Computing Limited +// +// This file is part of PyQt. +// +// This copy of PyQt is free software; you can redistribute it and/or modify it +// under the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2, or (at your option) any later +// version. +// +// PyQt is supplied in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS +// FOR A PARTICULAR PURPOSE. See the GNU General Public License for more +// details. +// +// You should have received a copy of the GNU General Public License along with +// PyQt; see the file LICENSE. If not, write to the Free Software Foundation, +// Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + + +%If (Qt_NETWORKPROTOCOL) +%If (Qt_2_2_0 -) + +%ModuleHeaderCode +#include +#include +%End + +void qInitNetworkProtocols(); + +%End +%End diff --git a/python/pyqt/sip/qtnetwork/qserversocket.sip b/python/pyqt/sip/qtnetwork/qserversocket.sip new file mode 100644 index 00000000..c130969e --- /dev/null +++ b/python/pyqt/sip/qtnetwork/qserversocket.sip @@ -0,0 +1,70 @@ +// This is the SIP interface definition for QServerSocket. +// +// Copyright (c) 2007 +// Riverbank Computing Limited +// +// This file is part of PyQt. +// +// This copy of PyQt is free software; you can redistribute it and/or modify it +// under the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2, or (at your option) any later +// version. +// +// PyQt is supplied in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS +// FOR A PARTICULAR PURPOSE. See the GNU General Public License for more +// details. +// +// You should have received a copy of the GNU General Public License along with +// PyQt; see the file LICENSE. If not, write to the Free Software Foundation, +// Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + + +%ExportedDoc +QServerSocket (Qt v2.2+) + +QServerSocket is fully implemented. + + +%End + + +%If (Qt_2_2_0 -) + +class QServerSocket : QObject +{ +%TypeHeaderCode +#include +%End + +public: +%If (- Qt_3_0_0) + QServerSocket(Q_UINT16,int = 0,QObject * /TransferThis/ = 0, + const char * = 0); + QServerSocket(const QHostAddress &,Q_UINT16,int = 0, + QObject * /TransferThis/ = 0,const char * = 0); +%End +%If (Qt_3_0_0 -) + QServerSocket(Q_UINT16,int = 1,QObject * /TransferThis/ = 0, + const char * = 0); + QServerSocket(const QHostAddress &,Q_UINT16,int = 1, + QObject * /TransferThis/ = 0,const char * = 0); +%End + QServerSocket(QObject * /TransferThis/ = 0,const char * = 0); + + bool ok() const; + + Q_UINT16 port() const; + + int socket() const; + virtual void setSocket(int); + + QHostAddress address() const ; + + virtual void newConnection(int) = 0; + +protected: + QSocketDevice *socketDevice(); +}; + +%End diff --git a/python/pyqt/sip/qtnetwork/qsocket.sip b/python/pyqt/sip/qtnetwork/qsocket.sip new file mode 100644 index 00000000..1ce9165a --- /dev/null +++ b/python/pyqt/sip/qtnetwork/qsocket.sip @@ -0,0 +1,348 @@ +// This is the SIP interface definition for QSocket. +// +// Copyright (c) 2007 +// Riverbank Computing Limited +// +// This file is part of PyQt. +// +// This copy of PyQt is free software; you can redistribute it and/or modify it +// under the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2, or (at your option) any later +// version. +// +// PyQt is supplied in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS +// FOR A PARTICULAR PURPOSE. See the GNU General Public License for more +// details. +// +// You should have received a copy of the GNU General Public License along with +// PyQt; see the file LICENSE. If not, write to the Free Software Foundation, +// Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + + +%ExportedDoc +QSocket (Qt v2.2+) + + Q_LONG readBlock + char *data + Q_ULONG len + + +This takes a single len parameter. The +data is returned if there was no error, otherwise +Py_None is returned. + + + + Q_LONG readLine + char *data + Q_ULONG maxlen + + +This takes a single maxlen parameter. The +data is returned if there was no error, otherwise +Py_None is returned. + + + + Q_LONG writeBlock + const char *data + Q_ULONG len + + +len is derived from data and not passed +as a parameter. + + +%End + + +%If (Qt_2_2_0 -) + +class QSocket : QObject, QIODevice +{ +%TypeHeaderCode +#include +%End + +public: + enum Error { + ErrConnectionRefused, + ErrHostNotFound, + ErrSocketRead + }; + + QSocket(QObject * /TransferThis/ = 0,const char * = 0); + + enum State { + Idle, + HostLookup, + Connecting, +%If (Qt_3_0_0 -) + Connected, +%End +%If (- Qt_3_0_0) + Listening, +%End + Closing, + Connection + }; + +%ConvertToSubClassCode + static struct class_graph { + char *name; + sipWrapperType **type; + int yes, no; + } graph[] = { + {sipName_QServerSocket, &sipClass_QServerSocket, -1, 1}, + {sipName_QSocket, &sipClass_QSocket, -1, 2}, + {sipName_QFtp, &sipClass_QFtp, -1, 3}, + {sipName_QLocalFs, &sipClass_QLocalFs, -1, 4}, +#if QT_VERSION >= 0x030000 + {sipName_QHttp, &sipClass_QHttp, -1, 5}, +#else + {NULL, NULL, -1, 5}, +#endif + {sipName_QDns, &sipClass_QDns, -1, -1}, + }; + + int i = 0; + + sipClass = NULL; + + do + { + struct class_graph *cg = &graph[i]; + + if (cg->name != NULL && sipCpp->inherits(cg->name)) + { + sipClass = *cg->type; + i = cg->yes; + } + else + i = cg->no; + } + while (i >= 0); +%End + + State state() const; + + int socket() const; + virtual void setSocket(int); + +%If (Qt_3_0_0 -) + QSocketDevice *socketDevice(); + virtual void setSocketDevice(QSocketDevice *); +%End + +%If (Qt_DNS) + virtual void connectToHost(const QString &,Q_UINT16) /ReleaseGIL/; +%End + QString peerName() const; + + bool open(int) /ReleaseGIL/; + void close() /ReleaseGIL/; + void flush() /ReleaseGIL/; +%If (Qt_3_0_0 -) + Offset size() const; + Offset at() const; + bool at(Offset); +%End +%If (- Qt_3_0_0) + uint size() const; + int at() const; + bool at(int); +%End + bool atEnd() const; + +%If (Qt_3_0_0 -) + Q_ULONG bytesAvailable() const; + Q_ULONG waitForMore(int) const /ReleaseGIL/; + //Q_ULONG waitForMore(int,bool *) const /ReleaseGIL/; + Q_ULONG bytesToWrite() const; +%End +%If (- Qt_3_0_0) + int bytesAvailable() const; + int waitForMore(int) const /ReleaseGIL/; + int bytesToWrite() const; +%End +%If (Qt_3_1_0 -) + void clearPendingData(); +%End + +%If (- Qt_3_0_0) + SIP_PYOBJECT readBlock(uint) /ReleaseGIL/ [int (char *,uint)]; +%MethodCode + char *buf; + + if ((buf = (char *)sipMalloc(a0)) == NULL) + sipIsErr = 1; + else + { + int actlen; + + Py_BEGIN_ALLOW_THREADS + actlen = sipSelfWasArg ? sipCpp -> QSocket::readBlock(buf,a0) : sipCpp -> readBlock(buf,a0); + Py_END_ALLOW_THREADS + + if (actlen < 0) + { + sipFree((ANY *)buf); + + Py_INCREF(Py_None); + sipRes = Py_None; + } + else + { + sipRes = PyString_FromStringAndSize(buf,actlen); + + sipFree((ANY *)buf); + + if (sipRes == NULL) + sipIsErr = 1; + } + } +%End + + int writeBlock(const char * /Array/,uint /ArraySize/) /ReleaseGIL/; + + SIP_PYOBJECT readLine(uint) /ReleaseGIL/ [int (char *,uint)]; +%MethodCode + char *buf; + + if ((buf = (char *)sipMalloc(a0)) == NULL) + sipIsErr = 1; + else + { + int actlen; + + Py_BEGIN_ALLOW_THREADS + actlen = sipCpp -> readLine(buf,a0); + Py_END_ALLOW_THREADS + + if (actlen < 0) + { + sipFree((ANY *)buf); + + Py_INCREF(Py_None); + sipRes = Py_None; + } + else + { + sipRes = PyString_FromStringAndSize(buf,actlen); + + sipFree((ANY *)buf); + + if (sipRes == NULL) + sipIsErr = 1; + } + } +%End +%End +%If (Qt_3_0_0 -) + SIP_PYOBJECT readBlock(Q_ULONG) /ReleaseGIL/ [Q_LONG (char *,Q_ULONG)]; +%MethodCode + char *buf; + + if ((buf = (char *)sipMalloc(a0)) == NULL) + sipIsErr = 1; + else + { + Q_LONG actlen; + + Py_BEGIN_ALLOW_THREADS + actlen = sipSelfWasArg ? sipCpp -> QSocket::readBlock(buf,a0) : sipCpp -> readBlock(buf,a0); + Py_END_ALLOW_THREADS + + if (actlen < 0) + { + sipFree((ANY *)buf); + + Py_INCREF(Py_None); + sipRes = Py_None; + } + else + { + sipRes = PyString_FromStringAndSize(buf,actlen); + + sipFree((ANY *)buf); + + if (sipRes == NULL) + sipIsErr = 1; + } + } +%End + + Q_LONG writeBlock(const char * /Array/, + Q_ULONG /ArraySize/) /ReleaseGIL/; + + SIP_PYOBJECT readLine(Q_ULONG) /ReleaseGIL/ [Q_LONG (char *,Q_ULONG)]; +%MethodCode + char *buf; + + if ((buf = (char *)sipMalloc(a0)) == NULL) + sipIsErr = 1; + else + { + Q_LONG actlen; + + Py_BEGIN_ALLOW_THREADS + actlen = sipCpp -> readLine(buf,a0); + Py_END_ALLOW_THREADS + + if (actlen < 0) + { + sipFree((ANY *)buf); + + Py_INCREF(Py_None); + sipRes = Py_None; + } + else + { + sipRes = PyString_FromStringAndSize(buf,actlen); + + sipFree((ANY *)buf); + + if (sipRes == NULL) + sipIsErr = 1; + } + } +%End +%End + + int getch() /ReleaseGIL/; + int putch(int) /ReleaseGIL/; + int ungetch(int); + + bool canReadLine() const; + virtual QString readLine() /ReleaseGIL/; + + Q_UINT16 port() const; + Q_UINT16 peerPort() const; + QHostAddress address() const; + QHostAddress peerAddress() const; + +%If (Qt_3_2_0 -) + void setReadBufferSize(Q_ULONG); + Q_ULONG readBufferSize() const; +%End + +signals: + void hostFound(); + void connected(); + void connectionClosed(); + void delayedCloseFinished(); + void readyRead(); + void bytesWritten(int); + void error(int); + +protected: +%If (- Qt_3_0_0) + QSocketDevice *socketDevice(); +%End + +private: + QSocket(const QSocket &); +}; + +%End diff --git a/python/pyqt/sip/qtnetwork/qsocketdevice.sip b/python/pyqt/sip/qtnetwork/qsocketdevice.sip new file mode 100644 index 00000000..181f6fc4 --- /dev/null +++ b/python/pyqt/sip/qtnetwork/qsocketdevice.sip @@ -0,0 +1,224 @@ +// This is the SIP interface definition for QSocketDevice. +// +// Copyright (c) 2007 +// Riverbank Computing Limited +// +// This file is part of PyQt. +// +// This copy of PyQt is free software; you can redistribute it and/or modify it +// under the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2, or (at your option) any later +// version. +// +// PyQt is supplied in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS +// FOR A PARTICULAR PURPOSE. See the GNU General Public License for more +// details. +// +// You should have received a copy of the GNU General Public License along with +// PyQt; see the file LICENSE. If not, write to the Free Software Foundation, +// Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + + +%ExportedDoc +QSocketDevice (Qt v2.2+) + + Q_LONG readBlock + char *data + Q_ULONG len + + +This takes a single len parameter. The +data is returned if there was no error, otherwise +None is returned. + + + + Q_LONG writeBlock + const char *data + Q_ULONG len + + +len is derived from data and not passed +as a parameter. + + +%End + + +%If (Qt_2_2_0 -) + +class QSocketDevice : QIODevice +{ +%TypeHeaderCode +#include +%End + +public: + enum Type { + Stream, + Datagram + }; + +%If (Qt_3_3_0 -) + enum Protocol { + IPv4, + IPv6, + Unknown + }; +%End + + QSocketDevice(Type = Stream); +%If (Qt_3_3_0 -) + QSocketDevice(Type,Protocol,int); +%End + QSocketDevice(int,Type); + + bool isValid() const; + Type type() const; +%If (Qt_3_3_0 -) + Protocol protocol() const; +%End + + int socket() const; + virtual void setSocket(int,Type); + + bool open(int) /ReleaseGIL/; + void close(); + void flush() /ReleaseGIL/; + +%If (- Qt_3_0_0) + uint size() const; + int at() const; + bool at(int); +%End +%If (Qt_3_0_0 -) + Offset size() const; + Offset at() const; + bool at(Offset); +%End + bool atEnd() const; + + bool blocking() const; + virtual void setBlocking(bool); + + bool addressReusable() const; + virtual void setAddressReusable(bool); + + int receiveBufferSize() const; + virtual void setReceiveBufferSize(uint); + int sendBufferSize() const; + virtual void setSendBufferSize(uint); + + virtual bool connect(const QHostAddress &,Q_UINT16); + + virtual bool bind(const QHostAddress &,Q_UINT16); + virtual bool listen(int); + virtual int accept(); + +%If (- Qt_3_0_0) + int bytesAvailable() const; + int waitForMore(int) const /ReleaseGIL/; +%End +%If (Qt_3_0_0 -) + Q_LONG bytesAvailable() const; + Q_LONG waitForMore(int) const /ReleaseGIL/; +%End + +%If (- Qt_3_0_0) + SIP_PYOBJECT readBlock(uint) /ReleaseGIL/ [int (char *,uint)]; +%MethodCode + char *buf; + + if ((buf = (char *)sipMalloc(a0)) == NULL) + sipIsErr = 1; + else + { + int actlen; + + Py_BEGIN_ALLOW_THREADS + actlen = sipSelfWasArg ? sipCpp -> QSocketDevice::readBlock(buf,a0) : sipCpp -> readBlock(buf,a0); + Py_END_ALLOW_THREADS + + if (actlen < 0) + { + Py_INCREF(Py_None); + sipRes = Py_None; + } + else if ((sipRes = PyString_FromStringAndSize(buf,actlen)) == NULL) + sipIsErr = 1; + + sipFree((ANY *)buf); + } +%End + + int writeBlock(const char * /Array/,uint /ArraySize/) /ReleaseGIL/; + virtual int writeBlock(const char * /Array/,uint /ArraySize/, + const QHostAddress &,Q_UINT16) /ReleaseGIL/; +%End +%If (Qt_3_0_0 -) + SIP_PYOBJECT readBlock(Q_ULONG) /ReleaseGIL/ [Q_LONG (char *,Q_ULONG)]; +%MethodCode + char *buf; + + if ((buf = (char *)sipMalloc(a0)) == NULL) + sipIsErr = 1; + else + { + Q_LONG actlen; + + Py_BEGIN_ALLOW_THREADS + actlen = sipSelfWasArg ? sipCpp -> QSocketDevice::readBlock(buf,a0) : sipCpp -> readBlock(buf,a0); + Py_END_ALLOW_THREADS + + if (actlen < 0) + { + Py_INCREF(Py_None); + sipRes = Py_None; + } + else if ((sipRes = PyString_FromStringAndSize(buf,actlen)) == NULL) + sipIsErr = 1; + + sipFree((ANY *)buf); + } +%End + + + Q_LONG writeBlock(const char * /Array/, + Q_ULONG /ArraySize/) /ReleaseGIL/; + virtual Q_LONG writeBlock(const char * /Array/,Q_ULONG /ArraySize/, + const QHostAddress &,Q_UINT16) /ReleaseGIL/; +%End + + int getch(); + int putch(int); + int ungetch(int); + + Q_UINT16 port() const; + Q_UINT16 peerPort() const; + QHostAddress address() const; + QHostAddress peerAddress() const; + + enum Error { + NoError, + AlreadyBound, + Inaccessible, + NoResources, + Bug, + Impossible, + NoFiles, + ConnectionRefused, + NetworkFailure, + UnknownError + }; + + Error error() const; + +protected: + void setError(Error); + +private: + QSocketDevice(const QSocketDevice &); +}; + +%End diff --git a/python/pyqt/sip/qtnetwork/qtnetworkmod.sip b/python/pyqt/sip/qtnetwork/qtnetworkmod.sip new file mode 100644 index 00000000..ca580d73 --- /dev/null +++ b/python/pyqt/sip/qtnetwork/qtnetworkmod.sip @@ -0,0 +1,78 @@ +// This is the SIP interface definition for the qtnetwork module of PyQt. +// +// Copyright (c) 2007 +// Riverbank Computing Limited +// +// This file is part of PyQt. +// +// This copy of PyQt is free software; you can redistribute it and/or modify it +// under the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2, or (at your option) any later +// version. +// +// PyQt is supplied in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS +// FOR A PARTICULAR PURPOSE. See the GNU General Public License for more +// details. +// +// You should have received a copy of the GNU General Public License along with +// PyQt; see the file LICENSE. If not, write to the Free Software Foundation, +// Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + + +%Module qtnetwork 1 + +%Import qt/qtmod.sip + +%Include copying.sip + + +%Include qdns.sip +%Include qhostaddress.sip +%Include qftp.sip +%Include qhttp.sip +%Include qlocalfs.sip +%Include qnetwork.sip +%Include qserversocket.sip +%Include qsocket.sip +%Include qsocketdevice.sip + + +// The build file template. + +%Makefile qtnetwork.pro.in +# The project file for the qtnetwork module. +# +# Copyright (c) 2007 +# Riverbank Computing Limited +# +# This file is part of PyQt. +# +# This copy of PyQt is free software; you can redistribute it and/or modify it +# under the terms of the GNU General Public License as published by the Free +# Software Foundation; either version 2, or (at your option) any later +# version. +# +# PyQt is supplied in the hope that it will be useful, but WITHOUT ANY +# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS +# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more +# details. +# +# You should have received a copy of the GNU General Public License along with +# PyQt; see the file LICENSE. If not, write to the Free Software Foundation, +# Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + + +TEMPLATE = lib +TARGET = @BLX_TARGET_LIB@ +DESTDIR = @PYQT_MODDIR@ +CONFIG += @BLX_CONFIG_LIB@ @PYQT_WARN@ +INCLUDEPATH = @BLX_INCLUDEPATH@ +DEFINES = @BLX_DEFINES@ +LIBS += @PYQT_QT_MODULE@ @BLX_LIBS@ +macx:QMAKE_LFLAGS += -framework Python + +SOURCES = $B + +HEADERS = $H +%End -- cgit v1.2.1