OSDN Git Service

Editorのデータ構造変更前、一時保存。
[wordring-tm/wordring-tm.git] / http / httpresponse.h
1 #ifndef HTTPRESPONSE_H
2 #define HTTPRESPONSE_H
3
4 #include <QString>
5 #include <QByteArray>
6 #include <QPair>
7 #include <QList>
8
9 class HttpResponse
10 {
11 public:
12         typedef QPair<QByteArray, QByteArray> pair_type;
13         typedef QList<pair_type> list_type;
14         typedef list_type::const_iterator const_iterator;
15
16         enum : int { Error = -1, };
17
18 public:
19         HttpResponse();
20
21         void clear();
22
23         QByteArray version() const;
24         void set_version(QByteArray const &ver);
25         int status() const;
26         void set_status(int code);
27
28         int index_of(QByteArray const &name) const;
29         bool has_attribute(QByteArray const &name) const;
30         QByteArray attribute(QByteArray const &name) const;
31         void set_attribute(QByteArray const &name, QByteArray const &value);
32         void set_attribute(QByteArray const &name, int value);
33
34         int content_length() const;
35
36         char const* status_string() const;
37
38         QByteArray to_latin_1() const;
39
40 private:
41         QByteArray m_version;
42         int m_status;
43         list_type m_attributes;
44 };
45
46 #endif // HTTPRESPONSE_H