File tree 5 files changed +73
-1
lines changed
boost/network/protocol/http
5 files changed +73
-1
lines changed Original file line number Diff line number Diff line change 17
17
18
18
namespace boost { namespace network { namespace http {
19
19
20
+ namespace impl {
21
+
22
+ template <class Tag >
23
+ struct ready_wrapper ;
24
+
25
+ } /* impl */
26
+
20
27
template <class Tag >
21
28
struct async_message {
22
29
@@ -137,7 +144,7 @@ namespace boost { namespace network { namespace http {
137
144
mutable std::set<string_type> removed_headers;
138
145
mutable boost::shared_future<string_type> body_;
139
146
140
- friend struct boost ::network::detail::wrapper_base <Tag, async_message<Tag> >;
147
+ friend struct boost ::network::http::impl::ready_wrapper <Tag>;
141
148
};
142
149
143
150
template <class Tag >
Original file line number Diff line number Diff line change
1
+ #ifndef BOOST_NETWORK_PROTOCOL_HTTP_MESSAGE_WRAPPERS_READY_HPP_20100618
2
+ #define BOOST_NETWORK_PROTOCOL_HTTP_MESSAGE_WRAPPERS_READY_HPP_20100618
3
+
4
+ // Copyright 2010 Dean Michael Berris.
5
+ // Distributed under the Boost Software License, Version 1.0.
6
+ // (See accompanying file LICENSE_1_0.txt or copy at
7
+ // http://www.boost.org/LICENSE_1_0.txt)
8
+
9
+ #include < boost/network/detail/wrapper_base.hpp>
10
+
11
+ namespace boost { namespace network { namespace http {
12
+
13
+ template <class Tag >
14
+ struct async_message ;
15
+
16
+ namespace impl {
17
+ template <class Tag >
18
+ struct ready_wrapper : boost::network::detail::wrapper_base_const<Tag, async_message<Tag> > {
19
+ typedef boost::network::detail::wrapper_base_const<Tag, async_message<Tag> >
20
+ wrapper_base;
21
+ explicit ready_wrapper (async_message<Tag> const & message)
22
+ : wrapper_base(message) {}
23
+ operator bool () {
24
+ return
25
+ wrapper_base::_message.version_ .is_ready ()
26
+ && wrapper_base::_message.status_ .is_ready ()
27
+ && wrapper_base::_message.status_message_ .is_ready ()
28
+ && wrapper_base::_message.headers_ .is_ready ()
29
+ && wrapper_base::_message.body_ .is_ready ();
30
+ }
31
+ };
32
+ } // namespace impl
33
+
34
+ template <class Tag >
35
+ inline bool ready (async_message<Tag> const & message) {
36
+ return impl::ready_wrapper<Tag>(message);
37
+ }
38
+
39
+ } /* http */
40
+
41
+ } /* network */
42
+
43
+ } /* boost */
44
+
45
+ #endif /* BOOST_NETWORK_PROTOCOL_HTTP_MESSAGE_WRAPPERS_READY_HPP_20100618 */
Original file line number Diff line number Diff line change 30
30
#include < boost/network/protocol/http/message/wrappers/status_message.hpp>
31
31
#include < boost/network/protocol/http/message/wrappers/destination.hpp>
32
32
#include < boost/network/protocol/http/message/wrappers/source.hpp>
33
+ #include < boost/network/protocol/http/message/wrappers/ready.hpp>
33
34
34
35
#include < boost/network/protocol/http/message.hpp>
35
36
#include < boost/network/protocol/http/message/async_message.hpp>
Original file line number Diff line number Diff line change @@ -29,6 +29,7 @@ if (Boost_FOUND)
29
29
url_test
30
30
http_url_test
31
31
utils_thread_pool
32
+ http_async_message_ready
32
33
)
33
34
foreach (test ${TESTS} )
34
35
set_source_files_properties (${test} .cpp
Original file line number Diff line number Diff line change
1
+
2
+ // Copyright 2010 Dean Michael Berris.
3
+ // Distributed under the Boost Software License, Version 1.0.
4
+ // (See accompanying file LICENSE_1_0.txt or copy at
5
+ // http://www.boost.org/LICENSE_1_0.txt)
6
+
7
+ #define BOOST_TEST_MODULE HTTP Async Response Test
8
+ #include < boost/test/unit_test.hpp>
9
+ #include < boost/network/include/http/client.hpp>
10
+
11
+ namespace http = boost::network::http;
12
+
13
+ BOOST_AUTO_TEST_CASE (unready_state_response) {
14
+ typedef http::basic_response<http::tags::http_async_8bit_udp_resolve> response;
15
+ response r;
16
+ BOOST_CHECK (!ready (r));
17
+ }
18
+
You can’t perform that action at this time.
0 commit comments