File indexing completed on 2025-01-18 09:28:37
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011 #ifndef BOOST_ASIO_DETAIL_BASE_FROM_COMPLETION_COND_HPP
0012 #define BOOST_ASIO_DETAIL_BASE_FROM_COMPLETION_COND_HPP
0013
0014 #if defined(_MSC_VER) && (_MSC_VER >= 1200)
0015 # pragma once
0016 #endif
0017
0018 #include <boost/asio/detail/config.hpp>
0019 #include <boost/asio/completion_condition.hpp>
0020
0021 #include <boost/asio/detail/push_options.hpp>
0022
0023 namespace boost {
0024 namespace asio {
0025 namespace detail {
0026
0027 template <typename CompletionCondition>
0028 class base_from_completion_cond
0029 {
0030 protected:
0031 explicit base_from_completion_cond(CompletionCondition& completion_condition)
0032 : completion_condition_(
0033 static_cast<CompletionCondition&&>(completion_condition))
0034 {
0035 }
0036
0037 std::size_t check_for_completion(
0038 const boost::system::error_code& ec,
0039 std::size_t total_transferred)
0040 {
0041 return detail::adapt_completion_condition_result(
0042 completion_condition_(ec, total_transferred));
0043 }
0044
0045 private:
0046 CompletionCondition completion_condition_;
0047 };
0048
0049 template <>
0050 class base_from_completion_cond<transfer_all_t>
0051 {
0052 protected:
0053 explicit base_from_completion_cond(transfer_all_t)
0054 {
0055 }
0056
0057 static std::size_t check_for_completion(
0058 const boost::system::error_code& ec,
0059 std::size_t total_transferred)
0060 {
0061 return transfer_all_t()(ec, total_transferred);
0062 }
0063 };
0064
0065 }
0066 }
0067 }
0068
0069 #include <boost/asio/detail/pop_options.hpp>
0070
0071 #endif