QDjango
 All Classes Functions Typedefs Enumerations Enumerator Properties Groups Pages
QDjangoHttpResponse.h
1 /*
2  * Copyright (C) 2010-2012 Jeremy LainĂ©
3  * Contact: http://code.google.com/p/qdjango/
4  *
5  * This file is part of the QDjango Library.
6  *
7  * This library is free software; you can redistribute it and/or
8  * modify it under the terms of the GNU Lesser General Public
9  * License as published by the Free Software Foundation; either
10  * version 2.1 of the License, or (at your option) any later version.
11  *
12  * This library is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15  * Lesser General Public License for more details.
16  */
17 
18 #ifndef QDJANGO_HTTP_RESPONSE_H
19 #define QDJANGO_HTTP_RESPONSE_H
20 
21 #include <QObject>
22 
23 #include "QDjangoHttp_p.h"
24 
25 class QDjangoHttpResponsePrivate;
26 
31 class QDJANGO_EXPORT QDjangoHttpResponse : public QObject
32 {
33  Q_OBJECT
34 
35 public:
38  enum HttpStatus {
39  OK = 200,
40  MovedPermanently = 301,
41  Found = 302,
42  NotModified = 304,
43  BadRequest = 400,
44  AuthorizationRequired = 401,
45  Forbidden = 403,
46  NotFound = 404,
47  MethodNotAllowed = 405,
48  InternalServerError = 500,
49  };
50 
53 
54  QByteArray body() const;
55  void setBody(const QByteArray &body);
56 
57  QString header(const QString &key) const;
58  void setHeader(const QString &key, const QString &value);
59 
60  virtual bool isReady() const;
61 
62  int statusCode() const;
63  void setStatusCode(int code);
64 
65 signals:
71  void ready();
72 
73 private:
74  Q_DISABLE_COPY(QDjangoHttpResponse)
75  QDjangoHttpResponsePrivate* const d;
76  friend class QDjangoFastCgiConnection;
77  friend class QDjangoHttpConnection;
78 };
79 
80 #endif