|
1 | | -// Copyright (c) Glyn Matthews 2010. |
2 | | -// Copyright 2010 (c) Dean Michael Berris. |
3 | | -// Copyright 2010 (c) Sinefunc, Inc. |
4 | | -// Distributed under the Boost Software License, Version 1.0. |
5 | | -// (See accompanying file LICENSE_1_0.txt or copy at |
6 | | -// http://www.boost.org/LICENSE_1_0.txt) |
7 | | - |
8 | | - |
9 | | -#ifndef __BOOST_NETWORK_MESSAGE_MESSAGE_CONCEPT_INC__ |
10 | | -# define __BOOST_NETWORK_MESSAGE_MESSAGE_CONCEPT_INC__ |
11 | | - |
12 | | - |
13 | | -# include <boost/concept_check.hpp> |
14 | | - |
15 | | - |
16 | | -namespace boost { |
17 | | -namespace network { |
18 | | -template < |
19 | | - class M |
20 | | - > |
21 | | -struct Message |
22 | | - : DefaultConstructible<M>, |
23 | | - CopyConstructible<M>, |
24 | | - Assignable<M> { |
25 | | - typedef typename M::string_type string_type; |
26 | | - typedef typename M::headers_container_type headers_container_type; |
27 | | - |
28 | | - BOOST_CONCEPT_USAGE(Message) { |
29 | | - M message_; |
30 | | - swap(message, message_); |
31 | 1 |
|
32 | | - typedef typename traits::body<M>::type body_type; |
33 | | - typedef typename traits::source<M>::type source_type; |
34 | | - typedef typename traits::destination<M>::type destination_type; |
| 2 | +#ifndef BOOST_NETWORK_MESSAGE_MESSAGE_CONCEPT_HPP_20100903 |
| 3 | +#define BOOST_NETWORK_MESSAGE_MESSAGE_CONCEPT_HPP_20100903 |
35 | 4 |
|
36 | | - typedef typename traits::header_key<M>::type header_key_type; |
37 | | - typedef typename traits::header_value<M>::type header_value_type; |
38 | | - |
39 | | - headers_container_type headers_ = headers(message); |
40 | | - string_type body_ = body(message); |
41 | | - string_type source_ = source(message); |
42 | | - string_type destination_ = destination(message); |
43 | | - |
44 | | - message << source(source_type()) |
45 | | - << destination(destination_type()) |
46 | | - << header(string_type(), string_type()) |
47 | | - << body(body_type()); |
48 | | - |
49 | | - add_header(message, string_type(), string_type()); |
50 | | - remove_header(message, string_type()); |
51 | | - clear_headers(message); |
52 | | - source(message, source_type()); |
53 | | - destination(message, destination_type()); |
54 | | - body(message, body_type()); |
55 | | - |
56 | | - (void)headers_; |
57 | | - (void)body_; |
58 | | - (void)source_; |
59 | | - (void)destination_; |
60 | | - } |
61 | | - |
62 | | -private: |
| 5 | +// Copyright (c) Glyn Matthews 2010. |
| 6 | +// Copyright 2010 (c) Dean Michael Berris. |
| 7 | +// Copyright 2010 (c) Sinefunc, Inc. |
| 8 | +// Distributed under the Boost Software License, Version 1.0. |
| 9 | +// (See accompanying file LICENSE_1_0.txt or copy at |
| 10 | +// http://www.boost.org/LICENSE_1_0.txt) |
| 11 | + |
| 12 | +#include <boost/concept_check.hpp> |
| 13 | +#include <boost/network/message/traits/body.hpp> |
| 14 | +#include <boost/network/message/traits/source.hpp> |
| 15 | +#include <boost/network/message/traits/destination.hpp> |
| 16 | +#include <boost/network/message/traits/headers.hpp> |
| 17 | +#include <boost/network/message/wrappers.hpp> |
| 18 | +#include <boost/network/message/transformers.hpp> |
| 19 | +#include <boost/network/message/directives.hpp> |
| 20 | + |
| 21 | +namespace boost { namespace network { |
| 22 | + |
| 23 | + template <class M> |
| 24 | + struct Message |
| 25 | + : DefaultConstructible<M>, CopyConstructible<M>, Assignable<M> { |
| 26 | + typedef typename M::string_type string_type; |
| 27 | + typedef typename M::headers_container_type headers_container_type; |
| 28 | + |
| 29 | + BOOST_CONCEPT_USAGE(Message) { |
| 30 | + M message_; |
| 31 | + swap(message, message_); |
| 32 | + |
| 33 | + typedef typename traits::body<M>::type body_type; |
| 34 | + typedef typename traits::source<M>::type source_type; |
| 35 | + typedef typename traits::destination<M>::type destination_type; |
| 36 | + |
| 37 | + typedef typename traits::header_key<M>::type header_key_type; |
| 38 | + typedef typename traits::header_value<M>::type header_value_type; |
| 39 | + |
| 40 | + headers_container_type headers_ = headers(message); |
| 41 | + string_type body_ = body(message); |
| 42 | + string_type source_ = source(message); |
| 43 | + string_type destination_ = destination(message); |
| 44 | + |
| 45 | + message << source(source_type()) |
| 46 | + << destination(destination_type()) |
| 47 | + << header(string_type(), string_type()) |
| 48 | + << body(body_type()); |
| 49 | + |
| 50 | + add_header(message, string_type(), string_type()); |
| 51 | + remove_header(message, string_type()); |
| 52 | + clear_headers(message); |
| 53 | + source(message, source_type()); |
| 54 | + destination(message, destination_type()); |
| 55 | + body(message, body_type()); |
| 56 | + |
| 57 | + (void)headers_; |
| 58 | + (void)body_; |
| 59 | + (void)source_; |
| 60 | + (void)destination_; |
| 61 | + } |
| 62 | + |
| 63 | + private: |
| 64 | + |
| 65 | + M message; |
| 66 | + }; |
63 | 67 |
|
64 | | - M message; |
65 | | -}; |
66 | 68 | } // namespace network |
| 69 | + |
67 | 70 | } // namespace boost |
68 | 71 |
|
| 72 | +#endif // BOOST_NETWORK_MESSAGE_MESSAGE_CONCEPT_HPP_20100903 |
69 | 73 |
|
70 | | -#endif // __BOOST_NETWORK_MESSAGE_MESSAGE_CONCEPT_INC__ |
|
0 commit comments