]> git.tdb.fi Git - libs/net.git/blobdiff - source/message.h
Rename data to content in Message
[libs/net.git] / source / message.h
index c9dc618a61eb31ce05e972a89f09f49d38ce792c..1ccc976ac71c76c3a8517e181a79ac2ab54f27c6 100644 (file)
@@ -8,32 +8,40 @@ Distributed under the LGPL
 #ifndef MSP_HTTP_MESSAGE_H_
 #define MSP_HTTP_MESSAGE_H_
 
+#include <map>
 #include <string>
-#include "misc.h"
+#include <msp/core/variant.h>
+#include "version.h"
 
 namespace Msp {
 namespace Http {
 
 class Message
 {
+protected:
+       typedef std::map<std::string, std::string> HeaderMap;
+
+       Version http_version;
+       HeaderMap headers;
+       std::string content;
+       unsigned chunk_length;
+       bool complete;
+       Variant user_data;
+
+       Message();
 public:
        virtual ~Message() { }
 
        void set_header(const std::string &, const std::string &);
        const std::string &get_header(const std::string &) const;
-       const std::string &get_data() const { return data; }
+       void add_content(const std::string &);
+       const std::string &get_content() const { return content; }
+       void set_user_data(const Variant &);
+       const Variant &get_user_data() const { return user_data; }
        bool get_complete() const { return complete; }
-       void add_data(const std::string &);
-       unsigned parse_data(const std::string &);
+       unsigned parse_content(const std::string &);
        virtual std::string str() const =0;
 protected:
-       Version http_version;
-       HeaderMap headers;
-       std::string data;
-       unsigned chunk_length;
-       bool complete;
-
-       Message();
        std::string str_common() const;
 };