33// (See accompanying file LICENSE_1_0.txt or copy at
44// http://www.boost.org/LICENSE_1_0.txt)
55
6- #ifndef __NETWORK_MESSAGE_HPP__
7- #define __NETWORK_MESSAGE_HPP__
6+ #ifndef BOOST_NETWORK_MESSAGE_HPP__
7+ #define BOOST_NETWORK_MESSAGE_HPP__
88
9- #include < boost/network/message_fwd.hpp>
10- #include < boost/network/traits/string.hpp>
11- #include < boost/utility/enable_if.hpp>
129#include < boost/network/detail/directive_base.hpp>
1310#include < boost/network/detail/wrapper_base.hpp>
1411#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>
1813#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>
2015#include < boost/network/message/modifiers/clear_headers.hpp>
21- #include < boost/network/message/modifiers/source.hpp>
2216#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>
2624
2725/* * message.hpp
2826 *
@@ -46,72 +44,67 @@ struct basic_message {
4644 typedef typename headers_container_type::value_type header_type;
4745 typedef typename string<Tag>::type string_type;
4846
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_message const &) = default ;
51+ basic_message& operator =(basic_message&&) = default ;
52+ ~basic_message () = default ;
6153
6254 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_);
6760 }
6861
69- headers_container_type& headers () { return _headers ; }
62+ headers_container_type& headers () { return headers_ ; }
7063
71- void headers (headers_container_type const & headers_ ) const {
72- _headers = headers_ ;
64+ void headers (headers_container_type headers ) const {
65+ headers_ = std::move (headers) ;
7366 }
7467
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_);
7871 }
7972
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);
8376 }
8477
85- headers_container_type const & headers () const { return _headers ; }
78+ headers_container_type const & headers () const { return headers_ ; }
8679
87- string_type& body () { return _body ; }
80+ string_type& body () { return body_ ; }
8881
89- void body (string_type const & body_ ) const { _body = body_ ; }
82+ void body (string_type body ) const { body_ = std::move (body) ; }
9083
91- string_type const & body () const { return _body ; }
84+ string_type const & body () const { return body_ ; }
9285
93- string_type& source () { return _source ; }
86+ string_type& source () { return source_ ; }
9487
95- void source (string_type const & source_ ) const { _source = source_ ; }
88+ void source (string_type source ) const { source_ = std::move (source) ; }
9689
97- string_type const & source () const { return _source ; }
90+ string_type const & source () const { return source_ ; }
9891
99- string_type& destination () { return _destination ; }
92+ string_type& destination () { return destination_ ; }
10093
101- void destination (string_type const & destination_ ) const {
102- _destination = destination_ ;
94+ void destination (string_type destination ) const {
95+ destination_ = std::move (destination) ;
10396 }
10497
105- string_type const & destination () const { return _destination ; }
98+ string_type const & destination () const { return destination_ ; }
10699
107100 private:
108101 friend struct detail ::directive_base<Tag>;
109102 friend struct detail ::wrapper_base<Tag, basic_message<Tag> >;
110103
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_type headers_ ;
105+ mutable string_type body_ ;
106+ mutable string_type source_ ;
107+ mutable string_type destination_ ;
115108};
116109
117110template <class Tag >
@@ -131,4 +124,4 @@ typedef basic_message<tags::default_wstring> wmessage;
131124} // namespace network
132125} // namespace boost
133126
134- #endif // __NETWORK_MESSAGE_HPP__
127+ #endif // BOOST_NETWORK_MESSAGE_HPP__
0 commit comments