// // Copyright (c) 2013-2016 Vinnie Falco (vinnie dot falco at gmail dot com) // // Distributed under the Boost Software License, Version 1.0. (See accompanying // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) // #ifndef BEAST_DETAIL_STREAM_CONCEPTS_HPP #define BEAST_DETAIL_STREAM_CONCEPTS_HPP #include #include #include #include #include namespace beast { namespace detail { // Types that meet the requirements, // for use with std::declval only. struct StreamHandler { StreamHandler(StreamHandler const&) = default; void operator()(boost::system::error_code ec, std::size_t); }; using ReadHandler = StreamHandler; using WriteHandler = StreamHandler; template class has_get_io_service { template().get_io_service()), boost::asio::io_service&>> static R check(int); template static std::false_type check(...); public: using type = decltype(check(0)); }; template class is_AsyncReadStream { template().async_read_some( std::declval(), std::declval()), std::true_type{})> static R check(int); template static std::false_type check(...); using type1 = decltype(check(0)); public: using type = std::integral_constant::type::value>; }; template class is_AsyncWriteStream { template().async_write_some( std::declval(), std::declval()), std::true_type{})> static R check(int); template static std::false_type check(...); using type1 = decltype(check(0)); public: using type = std::integral_constant::type::value>; }; template class is_SyncReadStream { using error_code = boost::system::error_code; template().read_some( std::declval())), std::size_t>> static R check1(int); template static std::false_type check1(...); using type1 = decltype(check1(0)); template().read_some( std::declval(), std::declval())), std::size_t>> static R check2(int); template static std::false_type check2(...); using type2 = decltype(check2(0)); public: using type = std::integral_constant; }; template class is_SyncWriteStream { using error_code = boost::system::error_code; template().write_some( std::declval())), std::size_t>> static R check1(int); template static std::false_type check1(...); using type1 = decltype(check1(0)); template().write_some( std::declval(), std::declval())), std::size_t>> static R check2(int); template static std::false_type check2(...); using type2 = decltype(check2(0)); public: using type = std::integral_constant; }; } // detail } // beast #endif