2 // detail/base_from_completion_cond.hpp
3 // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
5 // Copyright (c) 2003-2018 Christopher M. Kohlhoff (chris at kohlhoff dot com)
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)
11 #ifndef BOOST_ASIO_DETAIL_BASE_FROM_COMPLETION_COND_HPP
12 #define BOOST_ASIO_DETAIL_BASE_FROM_COMPLETION_COND_HPP
14 #if defined(_MSC_VER) && (_MSC_VER >= 1200)
16 #endif // defined(_MSC_VER) && (_MSC_VER >= 1200)
18 #include <boost/asio/detail/config.hpp>
19 #include <boost/asio/completion_condition.hpp>
21 #include <boost/asio/detail/push_options.hpp>
27 template <typename CompletionCondition>
28 class base_from_completion_cond
31 explicit base_from_completion_cond(CompletionCondition completion_condition)
32 : completion_condition_(completion_condition)
36 std::size_t check_for_completion(
37 const boost::system::error_code& ec,
38 std::size_t total_transferred)
40 return detail::adapt_completion_condition_result(
41 completion_condition_(ec, total_transferred));
45 CompletionCondition completion_condition_;
49 class base_from_completion_cond<transfer_all_t>
52 explicit base_from_completion_cond(transfer_all_t)
56 static std::size_t check_for_completion(
57 const boost::system::error_code& ec,
58 std::size_t total_transferred)
60 return transfer_all_t()(ec, total_transferred);
68 #include <boost/asio/detail/pop_options.hpp>
70 #endif // BOOST_ASIO_DETAIL_BASE_FROM_COMPLETION_COND_HPP