|
1 |
| - |
2 | 1 | #ifndef BOOST_NETWORK_MESSAGE_MODIFIER_ADD_HEADER_HPP_20100824
|
3 | 2 | #define BOOST_NETWORK_MESSAGE_MODIFIER_ADD_HEADER_HPP_20100824
|
4 | 3 |
|
5 |
| -// Copyright 2010 (c) Dean Michael Berris |
| 4 | +// Copyright 2011 Dean Michael Berris <dberris@google.com>. |
| 5 | +// Copyright 2011 Google, Inc. |
6 | 6 | // Distributed under the Boost Software License, Version 1.0.
|
7 | 7 | // (See accompanying file LICENSE_1_0.txt or copy at
|
8 | 8 | // http://www.boost.org/LICENSE_1_0.txt)
|
|
13 | 13 |
|
14 | 14 | namespace boost { namespace network {
|
15 | 15 |
|
16 |
| - namespace impl { |
17 |
| - template <class Message, class KeyType, class ValueType, class Tag> |
18 |
| - inline typename enable_if< |
19 |
| - mpl::and_< |
20 |
| - mpl::not_<is_pod<Tag> > |
21 |
| - , mpl::not_<is_async<Tag> > |
22 |
| - > |
23 |
| - , void |
24 |
| - >::type |
25 |
| - add_header(Message & message, KeyType const & key, ValueType const & value, Tag) { |
26 |
| - message.headers().insert(std::make_pair(key, value)); |
27 |
| - } |
28 |
| - |
29 |
| - template <class Message, class KeyType, class ValueType, class Tag> |
30 |
| - inline typename enable_if< |
31 |
| - mpl::and_< |
32 |
| - mpl::not_<is_pod<Tag> > |
33 |
| - , is_async<Tag> |
34 |
| - > |
35 |
| - , void |
36 |
| - >::type |
37 |
| - add_header(Message & message, KeyType const & key, ValueType const & value, Tag) { |
38 |
| - typedef typename Message::header_type header_type; |
39 |
| - message.add_header(header_type(key,value)); |
40 |
| - } |
41 |
| - |
42 |
| - template <class Message, class KeyType, class ValueType, class Tag> |
43 |
| - inline typename enable_if< |
44 |
| - is_pod<Tag> |
45 |
| - , void |
46 |
| - >::type |
47 |
| - add_header(Message & message, KeyType const & key, ValueType const & value, Tag) { |
48 |
| - typename Message::header_type header = { key, value }; |
49 |
| - message.headers.insert(message.headers.end(), header); |
50 |
| - } |
51 |
| - |
52 |
| - } |
53 |
| - |
54 |
| - template <class Tag, template <class> class Message, class KeyType, class ValueType> |
55 |
| - inline void add_header(Message<Tag> & message, KeyType const & key, ValueType const & value) { |
56 |
| - impl::add_header(message, key, value, Tag()); |
57 |
| - } |
| 16 | +inline |
| 17 | +void add_header(message_base & message, std::string const & key, std::string const & value) { |
| 18 | + message.append_header(key, value); |
| 19 | +} |
58 | 20 |
|
59 | 21 | } // namespace network
|
60 | 22 |
|
|
0 commit comments