| 1 | /****************************************************************************
|
|---|
| 2 | **
|
|---|
| 3 | ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
|
|---|
| 4 | ** Contact: Qt Software Information ([email protected])
|
|---|
| 5 | **
|
|---|
| 6 | ** This file is part of the QtNetwork module of the Qt Toolkit.
|
|---|
| 7 | **
|
|---|
| 8 | ** $QT_BEGIN_LICENSE:LGPL$
|
|---|
| 9 | ** Commercial Usage
|
|---|
| 10 | ** Licensees holding valid Qt Commercial licenses may use this file in
|
|---|
| 11 | ** accordance with the Qt Commercial License Agreement provided with the
|
|---|
| 12 | ** Software or, alternatively, in accordance with the terms contained in
|
|---|
| 13 | ** a written agreement between you and Nokia.
|
|---|
| 14 | **
|
|---|
| 15 | ** GNU Lesser General Public License Usage
|
|---|
| 16 | ** Alternatively, this file may be used under the terms of the GNU Lesser
|
|---|
| 17 | ** General Public License version 2.1 as published by the Free Software
|
|---|
| 18 | ** Foundation and appearing in the file LICENSE.LGPL included in the
|
|---|
| 19 | ** packaging of this file. Please review the following information to
|
|---|
| 20 | ** ensure the GNU Lesser General Public License version 2.1 requirements
|
|---|
| 21 | ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
|---|
| 22 | **
|
|---|
| 23 | ** In addition, as a special exception, Nokia gives you certain
|
|---|
| 24 | ** additional rights. These rights are described in the Nokia Qt LGPL
|
|---|
| 25 | ** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
|
|---|
| 26 | ** package.
|
|---|
| 27 | **
|
|---|
| 28 | ** GNU General Public License Usage
|
|---|
| 29 | ** Alternatively, this file may be used under the terms of the GNU
|
|---|
| 30 | ** General Public License version 3.0 as published by the Free Software
|
|---|
| 31 | ** Foundation and appearing in the file LICENSE.GPL included in the
|
|---|
| 32 | ** packaging of this file. Please review the following information to
|
|---|
| 33 | ** ensure the GNU General Public License version 3.0 requirements will be
|
|---|
| 34 | ** met: http://www.gnu.org/copyleft/gpl.html.
|
|---|
| 35 | **
|
|---|
| 36 | ** If you are unsure which license is appropriate for your use, please
|
|---|
| 37 | ** contact the sales department at [email protected].
|
|---|
| 38 | ** $QT_END_LICENSE$
|
|---|
| 39 | **
|
|---|
| 40 | ****************************************************************************/
|
|---|
| 41 |
|
|---|
| 42 | #ifndef QNETWORKACCESSMANAGER_H
|
|---|
| 43 | #define QNETWORKACCESSMANAGER_H
|
|---|
| 44 |
|
|---|
| 45 | #include <QtCore/QObject>
|
|---|
| 46 |
|
|---|
| 47 | QT_BEGIN_HEADER
|
|---|
| 48 |
|
|---|
| 49 | QT_BEGIN_NAMESPACE
|
|---|
| 50 |
|
|---|
| 51 | QT_MODULE(Network)
|
|---|
| 52 |
|
|---|
| 53 | class QIODevice;
|
|---|
| 54 | class QAbstractNetworkCache;
|
|---|
| 55 | class QAuthenticator;
|
|---|
| 56 | class QByteArray;
|
|---|
| 57 | template<typename T> class QList;
|
|---|
| 58 | class QNetworkCookie;
|
|---|
| 59 | class QNetworkCookieJar;
|
|---|
| 60 | class QNetworkRequest;
|
|---|
| 61 | class QNetworkReply;
|
|---|
| 62 | class QNetworkProxy;
|
|---|
| 63 | class QNetworkProxyFactory;
|
|---|
| 64 | class QSslError;
|
|---|
| 65 |
|
|---|
| 66 | class QNetworkReplyImplPrivate;
|
|---|
| 67 | class QNetworkAccessManagerPrivate;
|
|---|
| 68 | class Q_NETWORK_EXPORT QNetworkAccessManager: public QObject
|
|---|
| 69 | {
|
|---|
| 70 | Q_OBJECT
|
|---|
| 71 | public:
|
|---|
| 72 | enum Operation {
|
|---|
| 73 | HeadOperation = 1,
|
|---|
| 74 | GetOperation,
|
|---|
| 75 | PutOperation,
|
|---|
| 76 | PostOperation,
|
|---|
| 77 |
|
|---|
| 78 | UnknownOperation = 0
|
|---|
| 79 | };
|
|---|
| 80 |
|
|---|
| 81 | explicit QNetworkAccessManager(QObject *parent = 0);
|
|---|
| 82 | ~QNetworkAccessManager();
|
|---|
| 83 |
|
|---|
| 84 | #ifndef QT_NO_NETWORKPROXY
|
|---|
| 85 | QNetworkProxy proxy() const;
|
|---|
| 86 | void setProxy(const QNetworkProxy &proxy);
|
|---|
| 87 | QNetworkProxyFactory *proxyFactory() const;
|
|---|
| 88 | void setProxyFactory(QNetworkProxyFactory *factory);
|
|---|
| 89 | #endif
|
|---|
| 90 |
|
|---|
| 91 | QAbstractNetworkCache *cache() const;
|
|---|
| 92 | void setCache(QAbstractNetworkCache *cache);
|
|---|
| 93 |
|
|---|
| 94 | QNetworkCookieJar *cookieJar() const;
|
|---|
| 95 | void setCookieJar(QNetworkCookieJar *cookieJar);
|
|---|
| 96 |
|
|---|
| 97 | QNetworkReply *head(const QNetworkRequest &request);
|
|---|
| 98 | QNetworkReply *get(const QNetworkRequest &request);
|
|---|
| 99 | QNetworkReply *post(const QNetworkRequest &request, QIODevice *data);
|
|---|
| 100 | QNetworkReply *post(const QNetworkRequest &request, const QByteArray &data);
|
|---|
| 101 | QNetworkReply *put(const QNetworkRequest &request, QIODevice *data);
|
|---|
| 102 | QNetworkReply *put(const QNetworkRequest &request, const QByteArray &data);
|
|---|
| 103 |
|
|---|
| 104 | Q_SIGNALS:
|
|---|
| 105 | #ifndef QT_NO_NETWORKPROXY
|
|---|
| 106 | void proxyAuthenticationRequired(const QNetworkProxy &proxy, QAuthenticator *authenticator);
|
|---|
| 107 | #endif
|
|---|
| 108 | void authenticationRequired(QNetworkReply *reply, QAuthenticator *authenticator);
|
|---|
| 109 | void finished(QNetworkReply *reply);
|
|---|
| 110 | #ifndef QT_NO_OPENSSL
|
|---|
| 111 | void sslErrors(QNetworkReply *reply, const QList<QSslError> &errors);
|
|---|
| 112 | #endif
|
|---|
| 113 |
|
|---|
| 114 | protected:
|
|---|
| 115 | virtual QNetworkReply *createRequest(Operation op, const QNetworkRequest &request,
|
|---|
| 116 | QIODevice *outgoingData = 0);
|
|---|
| 117 |
|
|---|
| 118 | private:
|
|---|
| 119 | friend class QNetworkReplyImplPrivate;
|
|---|
| 120 | Q_DECLARE_PRIVATE(QNetworkAccessManager)
|
|---|
| 121 | Q_PRIVATE_SLOT(d_func(), void _q_replyFinished())
|
|---|
| 122 | Q_PRIVATE_SLOT(d_func(), void _q_replySslErrors(QList<QSslError>))
|
|---|
| 123 | };
|
|---|
| 124 |
|
|---|
| 125 | QT_END_NAMESPACE
|
|---|
| 126 |
|
|---|
| 127 | QT_END_HEADER
|
|---|
| 128 |
|
|---|
| 129 | #endif
|
|---|