3
3
// (See accompanying file LICENSE_1_0.txt or copy at
4
4
// http://www.boost.org/LICENSE_1_0.txt)
5
5
6
- #ifndef __NETWORK_MESSAGE_HPP__
7
- #define __NETWORK_MESSAGE_HPP__
6
+ #ifndef BOOST_NETWORK_MESSAGE_HPP__
7
+ #define BOOST_NETWORK_MESSAGE_HPP__
8
8
9
- #include < boost/network/message_fwd.hpp>
10
- #include < boost/network/traits/string.hpp>
11
- #include < boost/utility/enable_if.hpp>
12
9
#include < boost/network/detail/directive_base.hpp>
13
10
#include < boost/network/detail/wrapper_base.hpp>
14
11
#include < boost/network/message/directives.hpp>
15
- #include < boost/network/message/wrappers.hpp>
16
- #include < boost/network/message/transformers.hpp>
17
-
12
+ #include < boost/network/message/message_concept.hpp>
18
13
#include < boost/network/message/modifiers/add_header.hpp>
19
- #include < boost/network/message/modifiers/remove_header .hpp>
14
+ #include < boost/network/message/modifiers/body .hpp>
20
15
#include < boost/network/message/modifiers/clear_headers.hpp>
21
- #include < boost/network/message/modifiers/source.hpp>
22
16
#include < boost/network/message/modifiers/destination.hpp>
23
- #include < boost/network/message/modifiers/body.hpp>
24
-
25
- #include < boost/network/message/message_concept.hpp>
17
+ #include < boost/network/message/modifiers/remove_header.hpp>
18
+ #include < boost/network/message/modifiers/source.hpp>
19
+ #include < boost/network/message/transformers.hpp>
20
+ #include < boost/network/message/wrappers.hpp>
21
+ #include < boost/network/message_fwd.hpp>
22
+ #include < boost/network/traits/string.hpp>
23
+ #include < boost/utility/enable_if.hpp>
26
24
27
25
/* * message.hpp
28
26
*
@@ -46,72 +44,67 @@ struct basic_message {
46
44
typedef typename headers_container_type::value_type header_type;
47
45
typedef typename string<Tag>::type string_type;
48
46
49
- basic_message () : _headers(), _body(), _source(), _destination() {}
50
-
51
- basic_message (const basic_message& other)
52
- : _headers(other._headers),
53
- _body (other._body),
54
- _source(other._source),
55
- _destination(other._destination) {}
56
-
57
- basic_message&operator =(basic_message<Tag> rhs) {
58
- rhs.swap (*this );
59
- return *this ;
60
- }
47
+ basic_message () =default ;
48
+ basic_message (const basic_message&) =default ;
49
+ basic_message (basic_message&&)noexcept =default ;
50
+ basic_message&operator =(basic_messageconst &) =default ;
51
+ basic_message&operator =(basic_message&&) =default ;
52
+ ~basic_message () =default ;
61
53
62
54
void swap (basic_message<Tag>& other) {
63
- std::swap (other._headers , _headers);
64
- std::swap (other._body , _body);
65
- std::swap (other._source , _source);
66
- std::swap (other._destination , _destination);
55
+ using std::swap;
56
+ swap (other.headers_ , headers_);
57
+ swap (other.body_ , body_);
58
+ swap (other.source_ , source_);
59
+ swap (other.destination_ , destination_);
67
60
}
68
61
69
- headers_container_type&headers () {return _headers ; }
62
+ headers_container_type&headers () {return headers_ ; }
70
63
71
- void headers (headers_container_typeconst & headers_ )const {
72
- _headers =headers_ ;
64
+ void headers (headers_container_typeheaders )const {
65
+ headers_ =std::move (headers) ;
73
66
}
74
67
75
- void add_header (typename headers_container_type::value_type const & pair_)
76
- const {
77
- _headers .insert (pair_);
68
+ void add_header (
69
+ typename headers_container_type::value_type const & pair_) const {
70
+ headers_ .insert (pair_);
78
71
}
79
72
80
- void remove_header (typename headers_container_type::key_type const & key)
81
- const {
82
- _headers .erase (key);
73
+ void remove_header (
74
+ typename headers_container_type::key_type const & key) const {
75
+ headers_ .erase (key);
83
76
}
84
77
85
- headers_container_typeconst &headers ()const {return _headers ; }
78
+ headers_container_typeconst &headers ()const {return headers_ ; }
86
79
87
- string_type&body () {return _body ; }
80
+ string_type&body () {return body_ ; }
88
81
89
- void body (string_typeconst & body_ )const {_body =body_ ; }
82
+ void body (string_typebody )const {body_ =std::move (body) ; }
90
83
91
- string_typeconst &body ()const {return _body ; }
84
+ string_typeconst &body ()const {return body_ ; }
92
85
93
- string_type&source () {return _source ; }
86
+ string_type&source () {return source_ ; }
94
87
95
- void source (string_typeconst & source_ )const {_source =source_ ; }
88
+ void source (string_typesource )const {source_ =std::move (source) ; }
96
89
97
- string_typeconst &source ()const {return _source ; }
90
+ string_typeconst &source ()const {return source_ ; }
98
91
99
- string_type&destination () {return _destination ; }
92
+ string_type&destination () {return destination_ ; }
100
93
101
- void destination (string_typeconst & destination_ )const {
102
- _destination =destination_ ;
94
+ void destination (string_typedestination )const {
95
+ destination_ =std::move (destination) ;
103
96
}
104
97
105
- string_typeconst &destination ()const {return _destination ; }
98
+ string_typeconst &destination ()const {return destination_ ; }
106
99
107
100
private:
108
101
friend struct detail ::directive_base<Tag>;
109
102
friend struct detail ::wrapper_base<Tag, basic_message<Tag> >;
110
103
111
- mutable headers_container_type_headers ;
112
- mutable string_type_body ;
113
- mutable string_type_source ;
114
- mutable string_type_destination ;
104
+ mutable headers_container_typeheaders_ ;
105
+ mutable string_typebody_ ;
106
+ mutable string_typesource_ ;
107
+ mutable string_typedestination_ ;
115
108
};
116
109
117
110
template <class Tag >
@@ -131,4 +124,4 @@ typedef basic_message<tags::default_wstring> wmessage;
131
124
}// namespace network
132
125
}// namespace boost
133
126
134
- #endif // __NETWORK_MESSAGE_HPP__
127
+ #endif // BOOST_NETWORK_MESSAGE_HPP__