15
15
16
16
namespace boost { namespace network { namespace tags {
17
17
18
- struct async { int unused; };
19
- struct http { int unused; };
20
- struct tcp { int unused; };
21
- struct udp { int unused; };
22
- struct sync { int unused; };
23
- struct keepalive { int unused; };
24
- struct simple { int unused; };
25
- struct default_string { int unused; };
26
- struct default_wstring { int unused; };
18
+ struct async {};
19
+ struct http {};
20
+ struct tcp {};
21
+ struct udp {};
22
+ struct sync {};
23
+ struct keepalive {};
24
+ struct simple {};
25
+ struct default_string {};
26
+ struct default_wstring {};
27
27
28
28
// FIXME move out these HTTP-only tags into different files
29
29
@@ -38,79 +38,26 @@ namespace boost { namespace network { namespace tags {
38
38
template <class Tag >
39
39
struct components ;
40
40
41
- // FIXME make this a preprocessor macro!
42
- typedef mpl::inherit_linearly<
43
- http_default_8bit_tcp_resolve_tags,
44
- mpl::inherit<mpl::placeholders::_1, mpl::placeholders::_2>
45
- >::type http_default_8bit_tcp_resolve;
46
-
47
- template <>
48
- struct components <http_default_8bit_tcp_resolve> {
49
- typedef http_default_8bit_tcp_resolve_tags type;
50
- };
51
-
52
- typedef mpl::inherit_linearly<
53
- http_default_8bit_udp_resolve_tags,
54
- mpl::inherit<mpl::placeholders::_1, mpl::placeholders::_2>
55
- >::type http_default_8bit_udp_resolve;
56
-
57
- template <>
58
- struct components <http_default_8bit_udp_resolve> {
59
- typedef http_default_8bit_udp_resolve_tags type;
60
- };
61
-
62
- typedef mpl::inherit_linearly<
63
- http_keepalive_8bit_tcp_resolve_tags,
64
- mpl::inherit<mpl::placeholders::_1, mpl::placeholders::_2>
65
- >::type http_keepalive_8bit_tcp_resolve;
66
-
67
- template <>
68
- struct components <http_keepalive_8bit_tcp_resolve> {
69
- typedef http_keepalive_8bit_tcp_resolve_tags type;
70
- };
71
-
72
- typedef mpl::inherit_linearly<
73
- http_keepalive_8bit_udp_resolve_tags,
74
- mpl::inherit<mpl::placeholders::_1, mpl::placeholders::_2>
75
- >::type http_keepalive_8bit_udp_resolve;
76
-
77
- template <>
78
- struct components <http_keepalive_8bit_udp_resolve> {
79
- typedef http_keepalive_8bit_udp_resolve_tags type;
80
- };
81
-
82
- typedef mpl::inherit_linearly<
83
- http_server_tags,
84
- mpl::inherit<mpl::placeholders::_1, mpl::placeholders::_2>
85
- >::type http_server;
86
-
87
- template <>
88
- struct components <http_server> {
89
- typedef http_server_tags type;
90
- };
91
-
92
- typedef mpl::inherit_linearly<
93
- http_async_8bit_udp_resolve_tags,
94
- mpl::inherit<mpl::placeholders::_1, mpl::placeholders::_2>
95
- >::type http_async_8bit_udp_resolve;
96
-
97
- template <>
98
- struct components <http_async_8bit_udp_resolve> {
99
- typedef http_async_8bit_udp_resolve_tags type;
100
- };
101
-
102
- typedef mpl::inherit_linearly<
103
- http_async_8bit_tcp_resolve_tags,
104
- mpl::inherit<mpl::placeholders::_1, mpl::placeholders::_2>
105
- >::type http_async_8bit_tcp_resolve;
106
-
107
- template <>
108
- struct components <http_async_8bit_tcp_resolve> {
109
- typedef http_async_8bit_tcp_resolve_tags type;
110
- };
41
+ // Tag Definition Macro Helper
42
+ #define BOOST_NETWORK_DEFINE_TAG (name ) \
43
+ typedef mpl::inherit_linearly< \
44
+ name##_tags, \
45
+ mpl::inherit<mpl::placeholders::_1, mpl::placeholders::_2> \
46
+ >::type name; \
47
+ template <> struct components <name> { typedef name##_tags type; }; \
48
+
49
+ BOOST_NETWORK_DEFINE_TAG (http_default_8bit_tcp_resolve);
50
+ BOOST_NETWORK_DEFINE_TAG (http_default_8bit_udp_resolve);
51
+ BOOST_NETWORK_DEFINE_TAG (http_keepalive_8bit_tcp_resolve);
52
+ BOOST_NETWORK_DEFINE_TAG (http_keepalive_8bit_udp_resolve);
53
+ BOOST_NETWORK_DEFINE_TAG (http_async_8bit_udp_resolve);
54
+ BOOST_NETWORK_DEFINE_TAG (http_async_8bit_tcp_resolve);
55
+ BOOST_NETWORK_DEFINE_TAG (http_server);
111
56
112
57
typedef default_string default_;
113
58
59
+ #undef BOOST_NETWORK_DEFINE_TAG
60
+
114
61
} // namespace tags
115
62
116
63
} // namespace network
0 commit comments