Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit5b47593

Browse files
committed
Fixing issues with message tests.
1 parentc36f908 commit5b47593

File tree

5 files changed

+46
-32
lines changed

5 files changed

+46
-32
lines changed

‎boost/network/message.hpp‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -68,10 +68,10 @@ namespace boost { namespace network {
6868
}
6969

7070
voidswap(basic_message<Tag> & other) {
71-
other._headers.swap(_headers);
72-
other._body.swap(_body);
73-
other._source.swap(_source);
74-
other._destination.swap(_destination);
71+
std::swap(other._headers,_headers);
72+
std::swap(other._body,_body);
73+
std::swap(other._source,_source);
74+
std::swap(other._destination,_destination);
7575
}
7676

7777
headers_container_type &headers() {

‎boost/network/message/directives/destination.hpp‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ namespace boost { namespace network {
8787
Messageconst & message_;
8888
destination_visitor(Messageconst & message)
8989
: message_(message) {}
90-
voidoperator()(typename value<typename Message::tag>::type & destination)const {
90+
voidoperator()(typename value<typename Message::tag>::typeconst& destination)const {
9191
message_.destination(destination);
9292
}
9393
template<classT>voidoperator() (Tconst &)const {

‎boost/network/message/directives/source.hpp‎

Lines changed: 25 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -57,42 +57,54 @@ namespace boost { namespace network {
5757

5858
structsource_directive {
5959

60+
boost::variant<
61+
typename string<tags::default_string>::type,
62+
typename string<tags::default_wstring>::type,
63+
boost::shared_future<string<tags::default_string>::type>,
64+
boost::shared_future<string<tags::default_wstring>::type>
65+
> source_;
66+
6067
explicitsource_directive (string<tags::default_string>::typeconst & source)
6168
: source_(source)
6269
{ };
63-
6470
explicitsource_directive (string<tags::default_wstring>::typeconst & source)
6571
: source_(source)
6672
{ };
67-
6873
explicitsource_directive (boost::shared_future<typename string<tags::default_string>::type>const & source)
6974
: source_(source)
7075
{ };
71-
7276
explicitsource_directive (boost::shared_future<typename string<tags::default_wstring>::type>const & source)
7377
: source_(source)
7478
{ };
7579

80+
source_directive(source_directiveconst & other)
81+
: source_(other.source_) {}
82+
7683
template<classTag>
7784
structvalue :
7885
mpl::if_<
79-
is_async<Tag>,
80-
boost::shared_future<typename string<Tag>::type>,
81-
typename mpl::if_<
82-
is_sync<Tag>,
83-
typename string<Tag>::type,
84-
unsupported_tag<Tag>
85-
>::type
86+
is_async<Tag>,
87+
boost::shared_future<typename string<Tag>::type>,
88+
typename mpl::if_<
89+
mpl::or_<
90+
is_sync<Tag>,
91+
is_same<Tag, tags::default_string>,
92+
is_same<Tag, tags::default_wstring>
93+
>,
94+
typename string<Tag>::type,
95+
unsupported_tag<Tag>
96+
>::type
8697
>
8798
{};
8899

89100
template<classMessage>
90101
structsource_visitor : boost::static_visitor<> {
91102
Messageconst & message_;
92-
typedeftypename Message::tag Tag;
93103
source_visitor(Messageconst & message)
94104
: message_(message) {}
95-
voidoperator()(typename value<Tag>::type & source)const {
105+
source_visitor(source_visitorconst & other)
106+
: message_(other.message_) {}
107+
voidoperator()(typename value<typename Message::tag>::typeconst & source)const {
96108
message_.source(source);
97109
}
98110
template<classT>voidoperator()(Tconst &)const {
@@ -104,15 +116,7 @@ namespace boost { namespace network {
104116
voidoperator() (Message<Tag>const & msg)const {
105117
apply_visitor(source_visitor<Message<Tag> >(msg), source_);
106118
}
107-
108-
private:
109-
110-
boost::variant<
111-
typename string<tags::default_string>::type,
112-
typename string<tags::default_wstring>::type,
113-
boost::shared_future<string<tags::default_string>::type>,
114-
boost::shared_future<string<tags::default_wstring>::type>
115-
> source_;
119+
116120
};
117121

118122
}// namespace impl

‎boost/network/tags.hpp‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ struct http_default_8bit_tcp_resolve : http,sync,tcp,default_string {};
2222
structhttp_default_8bit_udp_resolve : http,sync,udp,default_string {};
2323
structhttp_keepalive_8bit_tcp_resolve : http,sync,tcp,default_string {};
2424
structhttp_keepalive_8bit_udp_resolve : http,sync,udp,default_string {};
25-
structhttp_server : http,default_string {};
25+
structhttp_server : http,default_string,sync {};
2626
structhttp_async_8bit_udp_resolve : http,async,udp,default_string {};
2727

2828
typedef default_string default_;

‎libs/network/test/message_test.cpp‎

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,15 @@
1313

1414
usingnamespaceboost::network;
1515

16-
typedef boost::mpl::list<tags::http_default_8bit_tcp_resolve, tags::http_default_8bit_udp_resolve, tags::http_keepalive_8bit_tcp_resolve, tags::http_keepalive_8bit_udp_resolve, tags::http_server, tags::default_string, tags::default_wstring> tag_types;
16+
typedef boost::mpl::list<
17+
tags::http_default_8bit_tcp_resolve,
18+
tags::http_default_8bit_udp_resolve,
19+
tags::http_keepalive_8bit_tcp_resolve,
20+
tags::http_keepalive_8bit_udp_resolve,
21+
tags::http_server,
22+
tags::default_string,
23+
tags::default_wstring
24+
> tag_types;
1725

1826
structstring_header_name {
1927
static std::string string;
@@ -139,14 +147,16 @@ BOOST_AUTO_TEST_CASE_TEMPLATE(headers_directive_test, T, tag_types) {
139147

140148
BOOST_AUTO_TEST_CASE_TEMPLATE(body_directive_test, T, tag_types) {
141149
basic_message<T> instance;
142-
instance <<body(body_data<T>::string);
143-
BOOST_CHECK (body(instance) == body_data<T>::string );
150+
instance << ::boost::network::body(body_data<T>::string);
151+
typename string<T>::type body_string =body(instance);
152+
BOOST_CHECK ( body_string == body_data<T>::string );
144153
}
145154

146155
BOOST_AUTO_TEST_CASE_TEMPLATE(source_directive_test, T, tag_types) {
147156
basic_message<T> instance;
148-
instance <<source(source_data<T>::string);
149-
BOOST_CHECK (source(instance) == source_data<T>::string );
157+
instance << ::boost::network::source(source_data<T>::string);
158+
typename string<T>::type source_string =source(instance);
159+
BOOST_CHECK ( source_string == source_data<T>::string );
150160
}
151161

152162
BOOST_AUTO_TEST_CASE_TEMPLATE(destination_directive_test, T, tag_types) {

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp