completion_condition.hpp
Go to the documentation of this file.
00001 //
00002 // completion_condition.hpp
00003 // ~~~~~~~~~~~~~~~~~~~~~~~~
00004 //
00005 // Copyright (c) 2003-2008 Christopher M. Kohlhoff (chris at kohlhoff dot com)
00006 //
00007 // Distributed under the Boost Software License, Version 1.0. (See accompanying
00008 // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
00009 //
00010 
00011 #ifndef ASIO_COMPLETION_CONDITION_HPP
00012 #define ASIO_COMPLETION_CONDITION_HPP
00013 
00014 #if defined(_MSC_VER) && (_MSC_VER >= 1200)
00015 # pragma once
00016 #endif // defined(_MSC_VER) && (_MSC_VER >= 1200)
00017 
00018 #include "asio/detail/push_options.hpp"
00019 
00020 #include "asio/detail/push_options.hpp"
00021 #include <cstddef>
00022 #include <boost/config.hpp>
00023 #include "asio/detail/pop_options.hpp"
00024 
00025 namespace asio {
00026 
00027 namespace detail {
00028 
00029 class transfer_all_t
00030 {
00031 public:
00032   typedef bool result_type;
00033 
00034   template <typename Error>
00035   bool operator()(const Error& err, std::size_t)
00036   {
00037     return !!err;
00038   }
00039 };
00040 
00041 class transfer_at_least_t
00042 {
00043 public:
00044   typedef bool result_type;
00045 
00046   explicit transfer_at_least_t(std::size_t minimum)
00047     : minimum_(minimum)
00048   {
00049   }
00050 
00051   template <typename Error>
00052   bool operator()(const Error& err, std::size_t bytes_transferred)
00053   {
00054     return !!err || bytes_transferred >= minimum_;
00055   }
00056 
00057 private:
00058   std::size_t minimum_;
00059 };
00060 
00061 } // namespace detail
00062 
00070 
00074 
00096 #if defined(GENERATING_DOCUMENTATION)
00097 unspecified transfer_all();
00098 #else
00099 inline detail::transfer_all_t transfer_all()
00100 {
00101   return detail::transfer_all_t();
00102 }
00103 #endif
00104 
00108 
00130 #if defined(GENERATING_DOCUMENTATION)
00131 unspecified transfer_at_least(std::size_t minimum);
00132 #else
00133 inline detail::transfer_at_least_t transfer_at_least(std::size_t minimum)
00134 {
00135   return detail::transfer_at_least_t(minimum);
00136 }
00137 #endif
00138 
00141 } // namespace asio
00142 
00143 #include "asio/detail/pop_options.hpp"
00144 
00145 #endif // ASIO_COMPLETION_CONDITION_HPP
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines


Castor
Author(s): Carpe Noctem
autogenerated on Fri Nov 8 2013 11:05:39