kopete/protocols/messenger/libpapillon
httptransfer.h
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015 #ifndef PAPILLON_HTTPTRANSFER_H
00016 #define PAPILLON_HTTPTRANSFER_H
00017
00018 #include <Papillon/Macros>
00019
00020 #include <QtCore/QList>
00021 #include <QtCore/QPair>
00022
00023 class QHttpHeader;
00024 class QHttpRequestHeader;
00025 class QHttpResponseHeader;
00026
00027 namespace Papillon
00028 {
00029
00038 class PAPILLON_EXPORT HttpTransfer
00039 {
00040 public:
00046 enum HttpTransferType
00047 {
00048 HttpRequest,
00049 HttpResponse
00050 };
00051
00058 HttpTransfer(HttpTransferType type = HttpRequest);
00062 ~HttpTransfer();
00063
00068 HttpTransferType type() const;
00069
00074 bool isValid() const;
00075
00081 uint contentLength() const;
00082
00087 QString contentType() const;
00093 void setContentType(const QString &contentType);
00094
00105 void setRequest(const QString &method, const QString &path, int majorVer = 1, int minorVer = 1);
00106
00112 void setHttpHeader(const QHttpRequestHeader &requestHeader);
00118 void setHttpHeader(const QHttpResponseHeader &responseHeader);
00119
00124 bool hasContentLength() const;
00125
00130 bool hasContentType() const;
00131
00137 bool hasKey(const QString &key) const;
00138
00144 QString value(const QString &key) const;
00145
00150 QList<QPair<QString, QString> > values() const;
00151
00159 void setValue(const QString &key, const QString &value);
00160
00165 void setValues(const QList<QPair<QString, QString> > &values);
00166
00173 int statusCode() const;
00174
00180 QString method() const;
00181
00187 QString path() const;
00188
00193 QByteArray body() const;
00199 void setBody(const QByteArray &body);
00200
00205 QByteArray toRawCommand();
00206
00207 private:
00208 class Private;
00209 Private *d;
00210 };
00211
00212 }
00213 #endif