]> git.proxmox.com Git - ceph.git/blob - ceph/src/boost/boost/process/detail/handler.hpp
update sources to v12.2.3
[ceph.git] / ceph / src / boost / boost / process / detail / handler.hpp
1 // Copyright (c) 2016 Klemens D. Morgenstern
2 //
3 // Distributed under the Boost Software License, Version 1.0. (See accompanying
4 // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
5
6
7 #ifndef BOOST_PROCESS_DETAIL_HANDLER_HPP_
8 #define BOOST_PROCESS_DETAIL_HANDLER_HPP_
9
10 #include <boost/process/detail/config.hpp>
11
12 #if defined(BOOST_POSIX_API)
13 #include <boost/process/detail/posix/handler.hpp>
14 #elif defined(BOOST_WINDOWS_API)
15 #include <boost/process/detail/windows/handler.hpp>
16 #endif
17
18
19 namespace boost { namespace process { namespace detail {
20
21 //extended handler base.
22 typedef api::handler_base_ext handler;
23
24
25 template <class Handler>
26 struct on_setup_ : handler
27 {
28 explicit on_setup_(Handler handler) : handler_(handler) {}
29
30 template <class Executor>
31 void on_setup(Executor &e)
32 {
33 handler_(e);
34 }
35 private:
36 Handler handler_;
37 };
38
39 template <class Handler>
40 struct on_error_ : handler
41 {
42 explicit on_error_(Handler handler) : handler_(handler) {}
43
44 template <class Executor>
45 void on_error(Executor &e, const std::error_code &ec)
46 {
47 handler_(e, ec);
48 }
49 private:
50 Handler handler_;
51 };
52
53 template <class Handler>
54 struct on_success_ : handler
55 {
56 explicit on_success_(Handler handler) : handler_(handler) {}
57
58 template <class Executor>
59 void on_success(Executor &e)
60 {
61 handler_(e);
62 }
63 private:
64 Handler handler_;
65 };
66
67 }
68
69
70
71 }}
72
73
74
75 #endif /* BOOST_PROCESS_DETAIL_HANDLER_HPP_ */