// qabstractnetworkcache.sip generated by MetaSIP on Mon Oct 24 12:34:01 2011 // // This file is part of the QtNetwork Python extension module. // // Copyright (c) 2011 Riverbank Computing Limited // // This file is part of PyQt. // // This file may be used under the terms of the GNU General Public // License versions 2.0 or 3.0 as published by the Free Software // Foundation and appearing in the files LICENSE.GPL2 and LICENSE.GPL3 // included in the packaging of this file. Alternatively you may (at // your option) use any later version of the GNU General Public // License if such license has been publicly approved by Riverbank // Computing Limited (or its successors, if any) and the KDE Free Qt // Foundation. In addition, as a special exception, Riverbank gives you // certain additional rights. These rights are described in the Riverbank // GPL Exception version 1.1, which can be found in the file // GPL_EXCEPTION.txt in this package. // // If you are unsure which license is appropriate for your use, please // contact the sales department at sales@riverbankcomputing.com. // // This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE // WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. %If (Qt_4_5_0 -) %ModuleCode #include %End %End %If (Qt_4_5_0 -) // QHash is implemented as a Python dict. %MappedType QHash /DocType="Py_v3:dict-of-QNetworkRequest.Attribute-object;dict-of-QNetworkRequest.Attribute-QVariant"/ { %TypeHeaderCode #include #include #include %End %ConvertFromTypeCode // Create the dictionary. PyObject *d = PyDict_New(); if (!d) return NULL; // Set the dictionary elements. QHash::const_iterator i = sipCpp->constBegin(); while (i != sipCpp->constEnd()) { PyObject *t1obj = sipConvertFromEnum((int)i.key(), sipType_QNetworkRequest_Attribute); QVariant *t2 = new QVariant(i.value()); PyObject *t2obj = sipConvertFromNewType(t2, sipType_QVariant, sipTransferObj); if (!t1obj || !t2obj || PyDict_SetItem(d, t1obj, t2obj) < 0) { Py_DECREF(d); Py_XDECREF(t1obj); if (t2obj) { Py_DECREF(t2obj); } else { delete t2; } return 0; } Py_DECREF(t1obj); Py_DECREF(t2obj); ++i; } return d; %End %ConvertToTypeCode PyObject *t1obj, *t2obj; SIP_SSIZE_T i = 0; // Check the type if that is all that is required. if (!sipIsErr) { if (!PyDict_Check(sipPy)) return 0; while (PyDict_Next(sipPy, &i, &t1obj, &t2obj)) { if (!sipCanConvertToEnum(t1obj, sipType_QNetworkRequest_Attribute)) return 0; if (!sipCanConvertToType(t2obj, sipType_QVariant, SIP_NOT_NONE)) return 0; } return 1; } QHash *qm = new QHash; while (PyDict_Next(sipPy, &i, &t1obj, &t2obj)) { PyErr_Clear(); QNetworkRequest::Attribute t1 = (QNetworkRequest::Attribute)SIPLong_AsLong(t1obj); if (PyErr_Occurred()) *sipIsErr = 1; int state2; QVariant *t2 = reinterpret_cast(sipConvertToType(t2obj, sipType_QVariant, sipTransferObj, SIP_NOT_NONE, &state2, sipIsErr)); if (*sipIsErr) { delete qm; return 0; } qm->insert(t1, *t2); sipReleaseType(t2, sipType_QVariant, state2); } *sipCppPtr = qm; return sipGetState(sipTransferObj); %End }; %End %If (Qt_4_5_0 -) class QNetworkCacheMetaData { %TypeHeaderCode #include %End typedef QList> RawHeaderList; typedef QHash AttributesMap; public: QNetworkCacheMetaData(); QNetworkCacheMetaData(const QNetworkCacheMetaData &other); ~QNetworkCacheMetaData(); bool operator==(const QNetworkCacheMetaData &other) const; bool operator!=(const QNetworkCacheMetaData &other) const; bool isValid() const; QUrl url() const; void setUrl(const QUrl &url); RawHeaderList rawHeaders() const; void setRawHeaders(const RawHeaderList &headers); QDateTime lastModified() const; void setLastModified(const QDateTime &dateTime); QDateTime expirationDate() const; void setExpirationDate(const QDateTime &dateTime); bool saveToDisk() const; void setSaveToDisk(bool allow); AttributesMap attributes() const; void setAttributes(const AttributesMap &attributes); }; %End %If (Qt_4_5_0 -) QDataStream &operator<<(QDataStream &, const QNetworkCacheMetaData & /Constrained/); %End %If (Qt_4_5_0 -) QDataStream &operator>>(QDataStream &, QNetworkCacheMetaData & /Constrained/); %End %If (Qt_4_5_0 -) class QAbstractNetworkCache : QObject { %TypeHeaderCode #include %End public: virtual ~QAbstractNetworkCache(); virtual QNetworkCacheMetaData metaData(const QUrl &url) = 0; virtual void updateMetaData(const QNetworkCacheMetaData &metaData) = 0; virtual QIODevice *data(const QUrl &url) = 0 /Factory/; virtual bool remove(const QUrl &url) = 0; virtual qint64 cacheSize() const = 0; virtual QIODevice *prepare(const QNetworkCacheMetaData &metaData) = 0; virtual void insert(QIODevice *device) = 0; public slots: virtual void clear() = 0; protected: explicit QAbstractNetworkCache(QObject *parent /TransferThis/ = 0); private: QAbstractNetworkCache(const QAbstractNetworkCache &); }; %End