Menu

[r211]: / trunk / boost / network / message / directives / body.hpp  Maximize  Restore  History

Download this file

72 lines (54 with data), 1.5 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
// 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_DIRECTIVES_BODY_HPP__
#define __NETWORK_MESSAGE_DIRECTIVES_BODY_HPP__
#include <boost/network/traits/string.hpp>
/** body.hpp
*
* Defines the types involved and the semantics of adding
* body contents into message objects.
*
* WARNING: DO NOT INCLUDE THIS HEADER DIRECTLY. THIS REQUIRES
* TYPES TO BE DEFINED FROM EARLIER FILES THAT INCLUDE THIS
* HEADER.
*/
namespace boost { namespace network {
namespace impl {
template <
class T
>
struct body_directive {
explicit body_directive(T body) :
_body(body)
{ };
template <class MessageTag>
void operator() (basic_message<MessageTag> & msg) const {
msg.body() = _body;
}
private:
T _body;
};
} // namespace impl
// template <
// class T
// >
// inline
// impl::body_directive<T>
// body(T body_, boost::disable_if<T::message>::type) {
// return impl::body_directive<T>(body_);
// }
inline
impl::body_directive<std::string>
body(std::string body_) {
return impl::body_directive<std::string>(body_);
}
inline
impl::body_directive<std::wstring>
body(std::wstring body_) {
return impl::body_directive<std::wstring>(body_);
}
} // namespace network
} // namespace boost
#endif // __NETWORK_MESSAGE_DIRECTIVES_BODY_HPP__