|
15 | 15 |
|
16 | 16 | namespace network {
|
17 | 17 |
|
18 |
| -struct message_pimpl; |
| 18 | + struct message_pimpl; |
19 | 19 |
|
20 |
| -// The common message type. |
21 |
| -struct message : message_base { |
22 |
| - // Nested types |
23 |
| - typedef boost::iterator_range< |
| 20 | + // The common message type. |
| 21 | + struct message : message_base { |
| 22 | + // Nested types |
| 23 | + typedef boost::iterator_range< |
24 | 24 | std::multimap<std::string, std::string>::const_iterator>
|
25 | 25 | headers_range;
|
26 | 26 |
|
27 |
| - // Constructors |
28 |
| - message(); |
29 |
| - message(message const & other); |
| 27 | + // Constructors |
| 28 | + message(); |
| 29 | + message(message const & other); |
| 30 | + message(message && other) = default; |
30 | 31 |
|
31 |
| - // Assignment |
32 |
| - message & operator=(message other); |
| 32 | + // Assignment |
| 33 | + message& operator=(message const &other); |
| 34 | + message& operator=(message &&other); |
33 | 35 |
|
34 |
| - // Mutators |
35 |
| - virtual void set_destination(std::string const & destination); |
36 |
| - virtual void set_source(std::string const & source); |
37 |
| - virtual void append_header(std::string const & name, |
38 |
| - std::string const & value); |
39 |
| - virtual void remove_headers(std::string const & name); |
40 |
| - virtual void remove_headers(); |
41 |
| - virtual void set_body(std::string const & body); |
42 |
| - virtual void append_body(std::string const & data); |
| 36 | + // Mutators |
| 37 | + virtual void set_destination(std::string const & destination); |
| 38 | + virtual void set_source(std::string const & source); |
| 39 | + virtual void append_header(std::string const & name, |
| 40 | + std::string const & value); |
| 41 | + virtual void remove_headers(std::string const & name); |
| 42 | + virtual void remove_headers(); |
| 43 | + virtual void set_body(std::string const & body); |
| 44 | + virtual void append_body(std::string const & data); |
43 | 45 |
|
44 |
| - // Retrievers |
45 |
| - virtual void get_destination(std::string & destination) const; |
46 |
| - virtual void get_source(std::string & source) const; |
47 |
| - virtual void get_headers( |
48 |
| - std::function<void(std::string const &, std::string const &)> inserter) const; |
49 |
| - virtual void get_headers( |
50 |
| - std::string const & name, |
51 |
| - std::function<void(std::string const &, std::string const &)> inserter) const; |
52 |
| - virtual void get_headers( |
53 |
| - std::function<bool(std::string const &, std::string const &)> predicate, |
54 |
| - std::function<void(std::string const &, std::string const &)> inserter) const; |
55 |
| - virtual void get_body(std::string & body) const; |
56 |
| - virtual void get_body( |
57 |
| - std::function<void(boost::iterator_range<char const *>)> chunk_reader, |
58 |
| - size_t size) const; |
| 46 | + // Retrievers |
| 47 | + virtual void get_destination(std::string & destination) const; |
| 48 | + virtual void get_source(std::string & source) const; |
| 49 | + virtual void get_headers(std::function<void(std::string const &, std::string const &)> inserter) const; |
| 50 | + virtual void get_headers(std::string const & name, |
| 51 | + std::function<void(std::string const &, std::string const &)> inserter) const; |
| 52 | + virtual void get_headers(std::function<bool(std::string const &, std::string const &)> predicate, |
| 53 | + std::function<void(std::string const &, std::string const &)> inserter) const; |
| 54 | + virtual void get_body(std::string & body) const; |
| 55 | + virtual void get_body(std::function<void(std::string::const_iterator, size_t)> chunk_reader, size_t size) const; |
59 | 56 |
|
60 |
| - void swap(message & other); |
| 57 | + void swap(message & other); |
61 | 58 |
|
62 |
| - // Destructor |
63 |
| - virtual ~message(); |
64 |
| - private: |
65 |
| - message_pimpl * pimpl; |
66 |
| -}; |
| 59 | + // Destructor |
| 60 | + virtual ~message(); |
| 61 | + private: |
| 62 | + message_pimpl * pimpl; |
| 63 | + }; |
67 | 64 |
|
68 |
| -inline void swap(message & left, message & right) { |
| 65 | + inline void swap(message & left, message & right) { |
69 | 66 | left.swap(right);
|
70 |
| -} |
| 67 | + } |
71 | 68 |
|
72 |
| -template <class Directive> |
73 |
| -message_base & operator<< (message_base & msg, Directive directive) { |
74 |
| - directive(msg); |
75 |
| - return msg; |
76 |
| -} |
| 69 | + template <class Directive> |
| 70 | + message_base & operator<< (message_base & msg, Directive directive) { |
| 71 | + directive(msg); |
| 72 | + return msg; |
| 73 | + } |
77 | 74 |
|
78 | 75 | } // namespace network
|
79 | 76 |
|
|
0 commit comments