]>
Commit | Line | Data |
---|---|---|
7c673cae FG |
1 | // |
2 | // placeholders.hpp | |
3 | // ~~~~~~~~~~~~~~~~ | |
4 | // | |
11fdf7f2 | 5 | // Copyright (c) 2003-2018 Christopher M. Kohlhoff (chris at kohlhoff dot com) |
7c673cae FG |
6 | // |
7 | // Distributed under the Boost Software License, Version 1.0. (See accompanying | |
8 | // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) | |
9 | // | |
10 | ||
11 | #ifndef BOOST_ASIO_PLACEHOLDERS_HPP | |
12 | #define BOOST_ASIO_PLACEHOLDERS_HPP | |
13 | ||
14 | #if defined(_MSC_VER) && (_MSC_VER >= 1200) | |
15 | # pragma once | |
16 | #endif // defined(_MSC_VER) && (_MSC_VER >= 1200) | |
17 | ||
18 | #include <boost/asio/detail/config.hpp> | |
19 | ||
20 | #if defined(BOOST_ASIO_HAS_BOOST_BIND) | |
21 | # include <boost/bind/arg.hpp> | |
22 | #endif // defined(BOOST_ASIO_HAS_BOOST_BIND) | |
23 | ||
24 | #include <boost/asio/detail/push_options.hpp> | |
25 | ||
26 | namespace boost { | |
27 | namespace asio { | |
28 | namespace placeholders { | |
29 | ||
30 | #if defined(GENERATING_DOCUMENTATION) | |
31 | ||
32 | /// An argument placeholder, for use with boost::bind(), that corresponds to | |
33 | /// the error argument of a handler for any of the asynchronous functions. | |
34 | unspecified error; | |
35 | ||
36 | /// An argument placeholder, for use with boost::bind(), that corresponds to | |
37 | /// the bytes_transferred argument of a handler for asynchronous functions such | |
38 | /// as boost::asio::basic_stream_socket::async_write_some or | |
39 | /// boost::asio::async_write. | |
40 | unspecified bytes_transferred; | |
41 | ||
42 | /// An argument placeholder, for use with boost::bind(), that corresponds to | |
43 | /// the iterator argument of a handler for asynchronous functions such as | |
b32b8144 | 44 | /// boost::asio::async_connect. |
7c673cae FG |
45 | unspecified iterator; |
46 | ||
b32b8144 FG |
47 | /// An argument placeholder, for use with boost::bind(), that corresponds to |
48 | /// the results argument of a handler for asynchronous functions such as | |
49 | /// boost::asio::basic_resolver::async_resolve. | |
50 | unspecified results; | |
51 | ||
52 | /// An argument placeholder, for use with boost::bind(), that corresponds to | |
53 | /// the results argument of a handler for asynchronous functions such as | |
54 | /// boost::asio::async_connect. | |
55 | unspecified endpoint; | |
56 | ||
7c673cae FG |
57 | /// An argument placeholder, for use with boost::bind(), that corresponds to |
58 | /// the signal_number argument of a handler for asynchronous functions such as | |
59 | /// boost::asio::signal_set::async_wait. | |
60 | unspecified signal_number; | |
61 | ||
62 | #elif defined(BOOST_ASIO_HAS_BOOST_BIND) | |
63 | # if defined(__BORLANDC__) || defined(__GNUC__) | |
64 | ||
65 | inline boost::arg<1> error() | |
66 | { | |
67 | return boost::arg<1>(); | |
68 | } | |
69 | ||
70 | inline boost::arg<2> bytes_transferred() | |
71 | { | |
72 | return boost::arg<2>(); | |
73 | } | |
74 | ||
75 | inline boost::arg<2> iterator() | |
76 | { | |
77 | return boost::arg<2>(); | |
78 | } | |
79 | ||
b32b8144 FG |
80 | inline boost::arg<2> results() |
81 | { | |
82 | return boost::arg<2>(); | |
83 | } | |
84 | ||
85 | inline boost::arg<2> endpoint() | |
86 | { | |
87 | return boost::arg<2>(); | |
88 | } | |
89 | ||
7c673cae FG |
90 | inline boost::arg<2> signal_number() |
91 | { | |
92 | return boost::arg<2>(); | |
93 | } | |
94 | ||
95 | # else | |
96 | ||
97 | namespace detail | |
98 | { | |
99 | template <int Number> | |
100 | struct placeholder | |
101 | { | |
102 | static boost::arg<Number>& get() | |
103 | { | |
104 | static boost::arg<Number> result; | |
105 | return result; | |
106 | } | |
107 | }; | |
108 | } | |
109 | ||
110 | # if defined(BOOST_ASIO_MSVC) && (BOOST_ASIO_MSVC < 1400) | |
111 | ||
112 | static boost::arg<1>& error | |
113 | = boost::asio::placeholders::detail::placeholder<1>::get(); | |
114 | static boost::arg<2>& bytes_transferred | |
115 | = boost::asio::placeholders::detail::placeholder<2>::get(); | |
116 | static boost::arg<2>& iterator | |
117 | = boost::asio::placeholders::detail::placeholder<2>::get(); | |
b32b8144 FG |
118 | static boost::arg<2>& results |
119 | = boost::asio::placeholders::detail::placeholder<2>::get(); | |
120 | static boost::arg<2>& endpoint | |
121 | = boost::asio::placeholders::detail::placeholder<2>::get(); | |
7c673cae FG |
122 | static boost::arg<2>& signal_number |
123 | = boost::asio::placeholders::detail::placeholder<2>::get(); | |
124 | ||
125 | # else | |
126 | ||
127 | namespace | |
128 | { | |
129 | boost::arg<1>& error | |
130 | = boost::asio::placeholders::detail::placeholder<1>::get(); | |
131 | boost::arg<2>& bytes_transferred | |
132 | = boost::asio::placeholders::detail::placeholder<2>::get(); | |
133 | boost::arg<2>& iterator | |
134 | = boost::asio::placeholders::detail::placeholder<2>::get(); | |
b32b8144 FG |
135 | boost::arg<2>& results |
136 | = boost::asio::placeholders::detail::placeholder<2>::get(); | |
137 | boost::arg<2>& endpoint | |
138 | = boost::asio::placeholders::detail::placeholder<2>::get(); | |
7c673cae FG |
139 | boost::arg<2>& signal_number |
140 | = boost::asio::placeholders::detail::placeholder<2>::get(); | |
141 | } // namespace | |
142 | ||
143 | # endif | |
144 | # endif | |
145 | #endif | |
146 | ||
147 | } // namespace placeholders | |
148 | } // namespace asio | |
149 | } // namespace boost | |
150 | ||
151 | #include <boost/asio/detail/pop_options.hpp> | |
152 | ||
153 | #endif // BOOST_ASIO_PLACEHOLDERS_HPP |