]> git.tdb.fi Git - libs/net.git/blob - source/message.h
Rename data to content in Message
[libs/net.git] / source / message.h
1 /* $Id$
2
3 This file is part of libmsphttp
4 Copyright © 2008  Mikkosoft Productions, Mikko Rasa
5 Distributed under the LGPL
6 */
7
8 #ifndef MSP_HTTP_MESSAGE_H_
9 #define MSP_HTTP_MESSAGE_H_
10
11 #include <map>
12 #include <string>
13 #include <msp/core/variant.h>
14 #include "version.h"
15
16 namespace Msp {
17 namespace Http {
18
19 class Message
20 {
21 protected:
22         typedef std::map<std::string, std::string> HeaderMap;
23
24         Version http_version;
25         HeaderMap headers;
26         std::string content;
27         unsigned chunk_length;
28         bool complete;
29         Variant user_data;
30
31         Message();
32 public:
33         virtual ~Message() { }
34
35         void set_header(const std::string &, const std::string &);
36         const std::string &get_header(const std::string &) const;
37         void add_content(const std::string &);
38         const std::string &get_content() const { return content; }
39         void set_user_data(const Variant &);
40         const Variant &get_user_data() const { return user_data; }
41         bool get_complete() const { return complete; }
42         unsigned parse_content(const std::string &);
43         virtual std::string str() const =0;
44 protected:
45         std::string str_common() const;
46 };
47
48 } // namespace Http
49 } // namespace Msp
50
51 #endif