// // basic_socket_streambuf.hpp // ~~~~~~~~~~~~~~~~~~~~~~~~~~ // // Copyright (c) 2003-2012 Christopher M. Kohlhoff (chris at kohlhoff 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 BOOST_ASIO_BASIC_SOCKET_STREAMBUF_HPP #define BOOST_ASIO_BASIC_SOCKET_STREAMBUF_HPP #if defined(_MSC_VER) && (_MSC_VER >= 1200) # pragma once #endif // defined(_MSC_VER) && (_MSC_VER >= 1200) #include #if !defined(BOOST_NO_IOSTREAM) #include #include #include #include #include #include #include #include #include #include #include #include #if !defined(BOOST_ASIO_HAS_VARIADIC_TEMPLATES) # include # include # include # include # if !defined(BOOST_ASIO_SOCKET_STREAMBUF_MAX_ARITY) # define BOOST_ASIO_SOCKET_STREAMBUF_MAX_ARITY 5 # endif // !defined(BOOST_ASIO_SOCKET_STREAMBUF_MAX_ARITY) // A macro that should expand to: // template // basic_socket_streambuf* connect( // T1 x1, ..., Tn xn) // { // init_buffers(); // this->basic_socket::close(ec_); // typedef typename Protocol::resolver resolver_type; // typedef typename resolver_type::query resolver_query; // resolver_query query(x1, ..., xn); // resolve_and_connect(query); // return !ec_ ? this : 0; // } // This macro should only persist within this file. # define BOOST_ASIO_PRIVATE_CONNECT_DEF( z, n, data ) \ template \ basic_socket_streambuf* connect( \ BOOST_PP_ENUM_BINARY_PARAMS(n, T, x)) \ { \ init_buffers(); \ this->basic_socket::close(ec_); \ typedef typename Protocol::resolver resolver_type; \ typedef typename resolver_type::query resolver_query; \ resolver_query query(BOOST_PP_ENUM_PARAMS(n, x)); \ resolve_and_connect(query); \ return !ec_ ? this : 0; \ } \ /**/ #endif // !defined(BOOST_ASIO_HAS_VARIADIC_TEMPLATES) #include namespace boost { namespace asio { /// Iostream streambuf for a socket. template , typename Time = boost::posix_time::ptime, typename TimeTraits = boost::asio::time_traits