|
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); |
30 |
| - message(message && other) = default; |
| 27 | + // Constructors |
| 28 | + message(); |
| 29 | + message(message const & other); |
31 | 30 |
|
32 |
| - // Assignment |
33 |
| - message& operator=(message const &other); |
34 |
| - message& operator=(message &&other); |
| 31 | + // Assignment |
| 32 | + message & operator=(message other); |
35 | 33 |
|
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); |
| 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); |
45 | 43 |
|
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(boost::function<void(std::string const &, std::string const &)> inserter) const; |
50 |
| - virtual void get_headers(std::string const & name, |
51 |
| - boost::function<void(std::string const &, std::string const &)> inserter) const; |
52 |
| - virtual void get_headers(boost::function<bool(std::string const &, std::string const &)> predicate, |
53 |
| - boost::function<void(std::string const &, std::string const &)> inserter) const; |
54 |
| - virtual void get_body(std::string & body) const; |
55 |
| - virtual void get_body(boost::function<void(std::string::const_iterator, size_t)> chunk_reader, size_t size) const; |
| 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 | + boost::function<void(std::string const &, std::string const &)> inserter) const; |
| 49 | + virtual void get_headers( |
| 50 | + std::string const & name, |
| 51 | + boost::function<void(std::string const &, std::string const &)> inserter) const; |
| 52 | + virtual void get_headers( |
| 53 | + boost::function<bool(std::string const &, std::string const &)> predicate, |
| 54 | + boost::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 | + boost::function<void(boost::iterator_range<char const *>)> chunk_reader, |
| 58 | + size_t size) const; |
56 | 59 |
|
57 |
| - void swap(message & other); |
| 60 | + void swap(message & other); |
58 | 61 |
|
59 |
| - // Destructor |
60 |
| - virtual ~message(); |
61 |
| - private: |
62 |
| - message_pimpl * pimpl; |
63 |
| - }; |
| 62 | + // Destructor |
| 63 | + virtual ~message(); |
| 64 | + private: |
| 65 | + message_pimpl * pimpl; |
| 66 | +}; |
64 | 67 |
|
65 |
| - inline void swap(message & left, message & right) { |
| 68 | +inline void swap(message & left, message & right) { |
66 | 69 | left.swap(right);
|
67 |
| - } |
| 70 | +} |
68 | 71 |
|
69 |
| - template <class Directive> |
70 |
| - message_base & operator<< (message_base & msg, Directive directive) { |
71 |
| - directive(msg); |
72 |
| - return msg; |
73 |
| - } |
| 72 | +template <class Directive> |
| 73 | +message_base & operator<< (message_base & msg, Directive directive) { |
| 74 | + directive(msg); |
| 75 | + return msg; |
| 76 | +} |
74 | 77 |
|
75 | 78 | } // namespace network
|
76 | 79 |
|
|
0 commit comments