Skip to content

Commit 4777601

Browse files
committed
Moving headers around for better organization.
1 parent c066d2e commit 4777601

29 files changed

+267
-231
lines changed

boost/network/message.hpp

Lines changed: 11 additions & 77 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
1-
// Copyright Dean Michael Berris 2007.
2-
// Distributed under the Boost Software License, Version 1.0.
3-
// (See accompanying file LICENSE_1_0.txt or copy at
4-
// http://www.boost.org/LICENSE_1_0.txt)
1+
#ifndef BOOST_NETWORK_MESSAGE_HPP_20111021
2+
#define BOOST_NETWORK_MESSAGE_HPP_20111021
53

6-
#ifndef __NETWORK_MESSAGE_HPP__
7-
#define __NETWORK_MESSAGE_HPP__
4+
// Copyright Dean Michael Berris 2007.
5+
// Copyright 2011 Dean Michael Berris (dberris@google.com).
6+
// Copyright 2011 Google, Inc.
7+
// Distributed under the Boost Software License, Version 1.0.
8+
// (See accompanying file LICENSE_1_0.txt or copy at
9+
// http://www.boost.org/LICENSE_1_0.txt)
810

911
#include <boost/network/message_fwd.hpp>
1012
#include <boost/network/detail/directive_base.hpp>
@@ -20,78 +22,10 @@
2022
#include <boost/network/message/modifiers/destination.hpp>
2123
#include <boost/network/message/modifiers/body.hpp>
2224

25+
#include <boost/network/message/message.hpp>
26+
2327
#ifdef BOOST_NETWORK_DEBUG
2428
#include <boost/network/message/message_concept.hpp>
2529
#endif
2630

27-
/** message.hpp
28-
*
29-
* This header file implements the common message type which
30-
* all networking implementations under the boost::network
31-
* namespace. The common message type allows for easy message
32-
* construction and manipulation suited for networked
33-
* application development.
34-
*/
35-
namespace boost { namespace network {
36-
37-
struct message_pimpl;
38-
39-
/** The common message type.
40-
*/
41-
struct message : message_base {
42-
// Nested types
43-
typedef iterator_range<
44-
shared_container_iterator<std::multimap<std::string, std::string> > >
45-
headers_range;
46-
47-
// Constructors
48-
message();
49-
message(message const & other);
50-
51-
// Assignment
52-
message & operator=(message other);
53-
54-
// Mutators
55-
virtual void set_destination(std::string const & destination);
56-
virtual void set_source(std::string const & source);
57-
virtual void append_header(std::string const & name,
58-
std::string const & value);
59-
virtual void remove_headers(std::string const & name);
60-
virtual void remove_headers();
61-
virtual void set_body(std::string const & body);
62-
virtual void append_body(std::string const & data);
63-
64-
// Retrievers
65-
virtual void get_destination(std::string & destination);
66-
virtual void get_source(std::string & source);
67-
virtual void get_headers(function<void(std::string const &, std::string const &)> inserter);
68-
virtual void get_headers(std::string const & name, function<void(std::string const &, std::string const &)> inserter);
69-
virtual void get_headers(function<bool(std::string const &, std::string const &)> predicate, function<void(std::string const &, std::string const &)> inserter);
70-
virtual void get_body(std::string & body);
71-
virtual void get_body(function<void(iterator_range<char const *>)> chunk_reader, size_t size);
72-
void swap(message & other);
73-
74-
// Destructor
75-
virtual ~message();
76-
private:
77-
message_pimpl * pimpl;
78-
};
79-
80-
inline void swap(message & left, message & right) {
81-
left.swap(right);
82-
}
83-
84-
template <class Directive>
85-
message_base & operator<< (message_base & msg, Directive directive) {
86-
directive(msg);
87-
return msg;
88-
}
89-
90-
} // namespace network
91-
} // namespace boost
92-
93-
#ifdef BOOST_NETWORK_NO_LIB
94-
#include <boost/network/message/message.ipp>
95-
#endif
96-
97-
#endif // __NETWORK_MESSAGE_HPP__
31+
#endif // BOOST_NETWORK_MESSAGE_HPP_20111021

boost/network/message/directives/header.hpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
// (See accompanying file LICENSE_1_0.txt or copy at
88
// http://www.boost.org/LICENSE_1_0.txt)
99

10-
#include <boost/network/message_base.hpp>
10+
#include <boost/network/message/message_base.hpp>
1111

1212
namespace boost { namespace network {
1313

@@ -41,4 +41,3 @@ header(std::string const & header_name, std::string const & header_value) {
4141
} // namespace boost
4242

4343
#endif // __NETWORK_MESSAGE_DIRECTIVES_HEADER_HPP__
44-

boost/network/message/message.hpp

Lines changed: 86 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,86 @@
1+
#ifndef BOOST_NETWORK_MESSAGE_MESSAGE_HPP_20111021
2+
#define BOOST_NETWORK_MESSAGE_MESSAGE_HPP_20111021
3+
4+
// Copyright 2011 Dean Michael Berris (dberris@google.com).
5+
// Copyright 2011 Google, Inc.
6+
// Distributed under the Boost Software License, Version 1.0.
7+
// (See accompanying file LICENSE_1_0.txt or copy at
8+
// http://www.boost.org/LICENSE_1_0.txt)
9+
10+
#include <string>
11+
#include <map>
12+
#include <boost/function.hpp>
13+
#include <boost/network/message/message_base.hpp>
14+
#include <boost/shared_container_iterator.hpp>
15+
16+
namespace boost { namespace network {
17+
18+
struct message_pimpl;
19+
20+
/** The common message type.
21+
*/
22+
struct message : message_base {
23+
// Nested types
24+
typedef iterator_range<
25+
shared_container_iterator<std::multimap<std::string, std::string> > >
26+
headers_range;
27+
28+
// Constructors
29+
message();
30+
message(message const & other);
31+
32+
// Assignment
33+
message & operator=(message other);
34+
35+
// Mutators
36+
virtual void set_destination(std::string const & destination);
37+
virtual void set_source(std::string const & source);
38+
virtual void append_header(std::string const & name,
39+
std::string const & value);
40+
virtual void remove_headers(std::string const & name);
41+
virtual void remove_headers();
42+
virtual void set_body(std::string const & body);
43+
virtual void append_body(std::string const & data);
44+
45+
// Retrievers
46+
virtual void get_destination(std::string & destination);
47+
virtual void get_source(std::string & source);
48+
virtual void get_headers(
49+
function<void(std::string const &, std::string const &)> inserter);
50+
virtual void get_headers(
51+
std::string const & name,
52+
function<void(std::string const &, std::string const &)> inserter);
53+
virtual void get_headers(
54+
function<bool(std::string const &, std::string const &)> predicate,
55+
function<void(std::string const &, std::string const &)> inserter);
56+
virtual void get_body(std::string & body);
57+
virtual void get_body(
58+
function<void(iterator_range<char const *>)> chunk_reader,
59+
size_t size);
60+
void swap(message & other);
61+
62+
// Destructor
63+
virtual ~message();
64+
private:
65+
message_pimpl * pimpl;
66+
};
67+
68+
inline void swap(message & left, message & right) {
69+
left.swap(right);
70+
}
71+
72+
template <class Directive>
73+
message_base & operator<< (message_base & msg, Directive directive) {
74+
directive(msg);
75+
return msg;
76+
}
77+
78+
} /* network */
79+
80+
} /* boost */
81+
82+
#ifdef BOOST_NETWORK_NO_LIB
83+
#include <boost/network/message/message.ipp>
84+
#endif
85+
86+
#endif /* BOOST_NETWORK_MESSAGE_MESSAGE_HPP_20111021 */

boost/network/message.ipp renamed to boost/network/message/message.ipp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
#include <iterator>
1111
#include <utility>
1212
#include <algorithm>
13-
#include <boost/network/message.hpp>
13+
#include <boost/network/message/message.hpp>
1414

1515
namespace boost { namespace network {
1616

boost/network/message/modifiers/clear_headers.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
// (See accompanying file LICENSE_1_0.txt or copy at
88
// http://www.boost.org/LICENSE_1_0.txt)
99

10-
#include <boost/network/message_base.hpp>
10+
#include <boost/network/message/message_base.hpp>
1111

1212
namespace boost { namespace network {
1313

boost/network/message/modifiers/remove_header.hpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
// http://www.boost.org/LICENSE_1_0.txt)
99

1010
#include <string>
11-
#include <boost/network/message_base.hpp>
11+
#include <boost/network/message/message_base.hpp>
1212

1313
namespace boost { namespace network {
1414

@@ -22,4 +22,3 @@ void remove_header(message_base & message, std::string const & key) {
2222
} // namespace boost
2323

2424
#endif // BOOST_NETWORK_MESSAGE_MODIFIER_REMOVE_HEADER_HPP_20100824
25-

boost/network/message/wrappers/body.hpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010

1111
#include <boost/range/iterator.hpp>
1212
#include <boost/optional.hpp>
13-
#include <boost/network/message_base.hpp>
13+
#include <boost/network/message/message_base.hpp>
1414

1515
namespace boost { namespace network {
1616

@@ -49,4 +49,3 @@ body(message_base & message_) {
4949
#endif
5050

5151
#endif // __NETWORK_MESSAGE_WRAPPERS_BODY_HPP__
52-

boost/network/message/wrappers/destination.hpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
// (See accompanying file LICENSE_1_0.txt or copy at
88
// http://www.boost.org/LICENSE_1_0.txt)
99

10-
#include <boost/network/message_base.hpp>
10+
#include <boost/network/message/message_base.hpp>
1111

1212
namespace boost { namespace network {
1313

@@ -34,4 +34,3 @@ destination(message_base & message_) {
3434
#endif
3535

3636
#endif // __NETWORK_MESSAGE_WRAPPERS_DESTINATION_HPP__
37-

0 commit comments

Comments
 (0)