Menu

[r26]: / http_tests / boost / network / message.hpp  Maximize  Restore  History

Download this file

90 lines (66 with data), 2.3 kB

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
// Copyright Dean Michael Berris 2007.
// Distributed under the Boost Software License, Version 1.0.
// (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
#ifndef __NETWORK_MESSAGE_HPP__
#define __NETWORK_MESSAGE_HPP__
#include <map>
#include <string>
// forward declarations
namespace boost { namespace network {
template <class tag>
class basic_message;
} // namespace network
} // namespace boost
#include <boost/network/detail/directive_base.hpp>
#include <boost/network/detail/wrapper_base.hpp>
/** message.hpp
*
* This header file implements the common message type which
* all networking implementations under the boost::network
* namespace. The common message type allows for easy message
* construction and manipulation suited for networked
* application development.
*/
namespace boost { namespace network {
struct tags {
struct default_ {
typedef std::string str_type;
};
};
/** The common message type.
*/
template <class tag=tags::default_>
class basic_message {
public:
typedef std::multimap<std::string, std::string> headers_container_type;
headers_container_type & headers() const {
return _headers;
};
std::string & body() const {
return _body;
};
std::string & source() const {
return _source;
};
std::string & destination() const {
return _destination;
};
private:
friend struct detail::directive_base<tag> ;
friend struct detail::wrapper_base<tag> ;
mutable headers_container_type _headers;
mutable std::string _body;
mutable std::string _source;
mutable std::string _destination;
};
typedef basic_message<> message; // default message type
} // namespace network
} // namespace boost
#include <boost/network/message/directives.hpp>
// pull in directives header file
#include <boost/network/message/wrappers.hpp>
// pull in wrappers header file
#include <boost/network/message/transformers.hpp>
// pull in transformer header file
#endif // __NETWORK_MESSAGE_HPP__