util/src/network/access/qnetworkaccessmanager.h
changeset 7 f7bc934e204c
equal deleted inserted replaced
3:41300fa6a67c 7:f7bc934e204c
       
     1 /****************************************************************************
       
     2 **
       
     3 ** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
       
     4 ** All rights reserved.
       
     5 ** Contact: Nokia Corporation (qt-info@nokia.com)
       
     6 **
       
     7 ** This file is part of the QtNetwork module of the Qt Toolkit.
       
     8 **
       
     9 ** $QT_BEGIN_LICENSE:LGPL$
       
    10 ** No Commercial Usage
       
    11 ** This file contains pre-release code and may not be distributed.
       
    12 ** You may use this file in accordance with the terms and conditions
       
    13 ** contained in the Technology Preview License Agreement accompanying
       
    14 ** this package.
       
    15 **
       
    16 ** GNU Lesser General Public License Usage
       
    17 ** Alternatively, this file may be used under the terms of the GNU Lesser
       
    18 ** General Public License version 2.1 as published by the Free Software
       
    19 ** Foundation and appearing in the file LICENSE.LGPL included in the
       
    20 ** packaging of this file.  Please review the following information to
       
    21 ** ensure the GNU Lesser General Public License version 2.1 requirements
       
    22 ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
       
    23 **
       
    24 ** In addition, as a special exception, Nokia gives you certain additional
       
    25 ** rights.  These rights are described in the Nokia Qt LGPL Exception
       
    26 ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
       
    27 **
       
    28 ** If you have questions regarding the use of this file, please contact
       
    29 ** Nokia at qt-info@nokia.com.
       
    30 **
       
    31 **
       
    32 **
       
    33 **
       
    34 **
       
    35 **
       
    36 **
       
    37 **
       
    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         DeleteOperation,
       
    78 
       
    79         UnknownOperation = 0
       
    80     };
       
    81 
       
    82     explicit QNetworkAccessManager(QObject *parent = 0);
       
    83     ~QNetworkAccessManager();
       
    84 
       
    85 #ifndef QT_NO_NETWORKPROXY
       
    86     QNetworkProxy proxy() const;
       
    87     void setProxy(const QNetworkProxy &proxy);
       
    88     QNetworkProxyFactory *proxyFactory() const;
       
    89     void setProxyFactory(QNetworkProxyFactory *factory);
       
    90 #endif
       
    91 
       
    92     QAbstractNetworkCache *cache() const;
       
    93     void setCache(QAbstractNetworkCache *cache);
       
    94 
       
    95     QNetworkCookieJar *cookieJar() const;
       
    96     void setCookieJar(QNetworkCookieJar *cookieJar);
       
    97 
       
    98     QNetworkReply *head(const QNetworkRequest &request);
       
    99     QNetworkReply *get(const QNetworkRequest &request);
       
   100     QNetworkReply *post(const QNetworkRequest &request, QIODevice *data);
       
   101     QNetworkReply *post(const QNetworkRequest &request, const QByteArray &data);
       
   102     QNetworkReply *put(const QNetworkRequest &request, QIODevice *data);
       
   103     QNetworkReply *put(const QNetworkRequest &request, const QByteArray &data);
       
   104     QNetworkReply *deleteResource(const QNetworkRequest &request);
       
   105 
       
   106 Q_SIGNALS:
       
   107 #ifndef QT_NO_NETWORKPROXY
       
   108     void proxyAuthenticationRequired(const QNetworkProxy &proxy, QAuthenticator *authenticator);
       
   109 #endif
       
   110     void authenticationRequired(QNetworkReply *reply, QAuthenticator *authenticator);
       
   111     void finished(QNetworkReply *reply);
       
   112 #ifndef QT_NO_OPENSSL
       
   113     void sslErrors(QNetworkReply *reply, const QList<QSslError> &errors);
       
   114 #endif
       
   115 
       
   116 protected:
       
   117     virtual QNetworkReply *createRequest(Operation op, const QNetworkRequest &request,
       
   118                                          QIODevice *outgoingData = 0);
       
   119 
       
   120 private:
       
   121     friend class QNetworkReplyImplPrivate;
       
   122     Q_DECLARE_PRIVATE(QNetworkAccessManager)
       
   123     Q_PRIVATE_SLOT(d_func(), void _q_replyFinished())
       
   124     Q_PRIVATE_SLOT(d_func(), void _q_replySslErrors(QList<QSslError>))
       
   125 };
       
   126 
       
   127 QT_END_NAMESPACE
       
   128 
       
   129 QT_END_HEADER
       
   130 
       
   131 #endif