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

Commit00b27b7

Browse files
committed
Client or Server Tag Selector
This change introduces a selector metafunction that takes a tag, andchecks whether it is meant to be a client or server tag. The selectormetafunction then yields the actual tag found (whether it is a client orserver tag) so that it can be used for function tag dispatch purposes.
1 parent5e47bea commit00b27b7

File tree

3 files changed

+71
-6
lines changed

3 files changed

+71
-6
lines changed
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
#ifndef BOOST_NETWORK_PROTOCOL_HTTP_SUPPORT_CLIENT_OR_SERVER_HPP_20101127
2+
#defineBOOST_NETWORK_PROTOCOL_HTTP_SUPPORT_CLIENT_OR_SERVER_HPP_20101127
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/protocol/http/support/is_server.hpp>
10+
#include<boost/network/protocol/http/support/is_client.hpp>
11+
#include<boost/mpl/if.hpp>
12+
13+
namespaceboost {namespacenetwork {namespacehttp {
14+
15+
template<classTag>
16+
structclient_or_server :
17+
mpl::if_<
18+
is_server<Tag>,
19+
tags::server,
20+
typename mpl::if_<
21+
is_client<Tag>,
22+
tags::client,
23+
unsupported_tag<Tag>
24+
>::type
25+
>
26+
{};
27+
28+
29+
}/* http*/
30+
31+
}/* network*/
32+
33+
}/* boost*/
34+
35+
#endif/* BOOST_NETWORK_PROTOCOL_HTTP_SUPPORT_CLIENT_OR_SERVER_HPP_20101127*/
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
#ifndef BOOST_NETWORK_PROTOCOL_SUPPORT_IS_CLIENT_HPP_20101118
2+
#defineBOOST_NETWORK_PROTOCOL_SUPPORT_IS_CLIENT_HPP_20101118
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/protocol/http/tags.hpp>
10+
#include<boost/type_traits/is_base_of.hpp>
11+
12+
namespaceboost {namespacenetwork {namespacehttp {
13+
14+
template<classTag>
15+
structis_client :
16+
is_base_of<
17+
tags::client,
18+
Tag
19+
>
20+
{};
21+
22+
}/* http*/
23+
24+
}/* network*/
25+
26+
}/* boost*/
27+
28+
#endif/* BOOST_NETWORK_PROTOCOL_SUPPORT_IS_CLIENT_HPP_20101118*/
29+

‎boost/network/protocol/http/tags.hpp‎

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,18 +14,19 @@ namespace boost { namespace network { namespace http { namespace tags {
1414
structkeepalive {};
1515
structsimple {};
1616
structserver {};
17+
structclient {};
1718

1819
usingnamespaceboost::network::tags;
1920

2021
template<classTag>
2122
structcomponents;
2223

23-
typedef mpl::vector<http, simple, sync, tcp, default_string> http_default_8bit_tcp_resolve_tags;
24-
typedef mpl::vector<http, simple, sync, udp, default_string> http_default_8bit_udp_resolve_tags;
25-
typedef mpl::vector<http, keepalive, sync, tcp, default_string> http_keepalive_8bit_tcp_resolve_tags;
26-
typedef mpl::vector<http, keepalive, sync, udp, default_string> http_keepalive_8bit_udp_resolve_tags;
27-
typedef mpl::vector<http, simple, async, udp, default_string> http_async_8bit_udp_resolve_tags;
28-
typedef mpl::vector<http, simple, async, tcp, default_string> http_async_8bit_tcp_resolve_tags;
24+
typedef mpl::vector<http,client,simple, sync, tcp, default_string> http_default_8bit_tcp_resolve_tags;
25+
typedef mpl::vector<http,client,simple, sync, udp, default_string> http_default_8bit_udp_resolve_tags;
26+
typedef mpl::vector<http,client,keepalive, sync, tcp, default_string> http_keepalive_8bit_tcp_resolve_tags;
27+
typedef mpl::vector<http,client,keepalive, sync, udp, default_string> http_keepalive_8bit_udp_resolve_tags;
28+
typedef mpl::vector<http,client,simple, async, udp, default_string> http_async_8bit_udp_resolve_tags;
29+
typedef mpl::vector<http,client,simple, async, tcp, default_string> http_async_8bit_tcp_resolve_tags;
2930
typedef mpl::vector<http, simple, sync, pod, default_string, server> http_server_tags;
3031
typedef mpl::vector<http, simple, async, pod, default_string, server> http_async_server_tags;
3132

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp