PageRenderTime 7ms CodeModel.GetById 1ms app.highlight 4ms RepoModel.GetById 1ms app.codeStats 0ms

/Src/Dependencies/Boost/boost/asio/detail/base_from_completion_cond.hpp

http://hadesmem.googlecode.com/
C++ Header | 70 lines | 48 code | 13 blank | 9 comment | 1 complexity | 077030d9708c60e0153fddc009f42a54 MD5 | raw file
 1//
 2// detail/base_from_completion_cond.hpp
 3// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 4//
 5// Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com)
 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_DETAIL_BASE_FROM_COMPLETION_COND_HPP
12#define BOOST_ASIO_DETAIL_BASE_FROM_COMPLETION_COND_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#include <boost/asio/completion_condition.hpp>
20
21#include <boost/asio/detail/push_options.hpp>
22
23namespace boost {
24namespace asio {
25namespace detail {
26
27template <typename CompletionCondition>
28class base_from_completion_cond
29{
30protected:
31  explicit base_from_completion_cond(CompletionCondition completion_condition)
32    : completion_condition_(completion_condition)
33  {
34  }
35
36  std::size_t check_for_completion(
37      const boost::system::error_code& ec,
38      std::size_t total_transferred)
39  {
40    return detail::adapt_completion_condition_result(
41        completion_condition_(ec, total_transferred));
42  }
43
44private:
45  CompletionCondition completion_condition_;
46};
47
48template <>
49class base_from_completion_cond<transfer_all_t>
50{
51protected:
52  explicit base_from_completion_cond(transfer_all_t)
53  {
54  }
55
56  static std::size_t check_for_completion(
57      const boost::system::error_code& ec,
58      std::size_t total_transferred)
59  {
60    return transfer_all_t()(ec, total_transferred);
61  }
62};
63
64} // namespace detail
65} // namespace asio
66} // namespace boost
67
68#include <boost/asio/detail/pop_options.hpp>
69
70#endif // BOOST_ASIO_DETAIL_BASE_FROM_COMPLETION_COND_HPP