diff options
Diffstat (limited to '3rdparty/asio/include/asio/basic_socket_iostream.hpp')
-rw-r--r-- | 3rdparty/asio/include/asio/basic_socket_iostream.hpp | 87 |
1 files changed, 37 insertions, 50 deletions
diff --git a/3rdparty/asio/include/asio/basic_socket_iostream.hpp b/3rdparty/asio/include/asio/basic_socket_iostream.hpp index ad4759bec29..b6fd88880de 100644 --- a/3rdparty/asio/include/asio/basic_socket_iostream.hpp +++ b/3rdparty/asio/include/asio/basic_socket_iostream.hpp @@ -2,7 +2,7 @@ // basic_socket_iostream.hpp // ~~~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2016 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2021 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) @@ -23,10 +23,6 @@ #include <ostream> #include "asio/basic_socket_streambuf.hpp" -#if defined(ASIO_ENABLE_OLD_SERVICES) -# include "asio/stream_socket_service.hpp" -#endif // defined(ASIO_ENABLE_OLD_SERVICES) - #if !defined(ASIO_HAS_VARIADIC_TEMPLATES) # include "asio/detail/variadic_templates.hpp" @@ -36,8 +32,7 @@ // explicit basic_socket_iostream(T1 x1, ..., Tn xn) // : std::basic_iostream<char>( // &this->detail::socket_iostream_base< -// Protocol ASIO_SVC_TARG, Clock, -// WaitTraits ASIO_SVC_TARG1>::streambuf_) +// Protocol, Clock, WaitTraits>::streambuf_) // { // if (rdbuf()->connect(x1, ..., xn) == 0) // this->setstate(std::ios_base::failbit); @@ -49,8 +44,7 @@ explicit basic_socket_iostream(ASIO_VARIADIC_BYVAL_PARAMS(n)) \ : std::basic_iostream<char>( \ &this->detail::socket_iostream_base< \ - Protocol ASIO_SVC_TARG, Clock, \ - WaitTraits ASIO_SVC_TARG1>::streambuf_) \ + Protocol, Clock, WaitTraits>::streambuf_) \ { \ this->setf(std::ios_base::unitbuf); \ if (rdbuf()->connect(ASIO_VARIADIC_BYVAL_ARGS(n)) == 0) \ @@ -85,8 +79,7 @@ namespace detail { // A separate base class is used to ensure that the streambuf is initialised // prior to the basic_socket_iostream's basic_iostream base class. -template <typename Protocol ASIO_SVC_TPARAM, - typename Clock, typename WaitTraits ASIO_SVC_TPARAM1> +template <typename Protocol, typename Clock, typename WaitTraits> class socket_iostream_base { protected: @@ -112,8 +105,7 @@ protected: } #endif // defined(ASIO_HAS_MOVE) - basic_socket_streambuf<Protocol ASIO_SVC_TARG, - Clock, WaitTraits ASIO_SVC_TARG1> streambuf_; + basic_socket_streambuf<Protocol, Clock, WaitTraits> streambuf_; }; } // namespace detail @@ -122,17 +114,17 @@ protected: #define ASIO_BASIC_SOCKET_IOSTREAM_FWD_DECL // Forward declaration with defaulted arguments. -template <typename Protocol - ASIO_SVC_TPARAM_DEF1(= stream_socket_service<Protocol>), -#if defined(ASIO_HAS_BOOST_DATE_TIME) +template <typename Protocol, +#if defined(ASIO_HAS_BOOST_DATE_TIME) \ + && defined(ASIO_USE_BOOST_DATE_TIME_FOR_SOCKET_IOSTREAM) typename Clock = boost::posix_time::ptime, - typename WaitTraits = time_traits<Clock> - ASIO_SVC_TPARAM1_DEF2(= deadline_timer_service<Clock, WaitTraits>)> -#else + typename WaitTraits = time_traits<Clock> > +#else // defined(ASIO_HAS_BOOST_DATE_TIME) + // && defined(ASIO_USE_BOOST_DATE_TIME_FOR_SOCKET_IOSTREAM) typename Clock = chrono::steady_clock, - typename WaitTraits = wait_traits<Clock> - ASIO_SVC_TPARAM1_DEF1(= steady_timer::service_type)> -#endif + typename WaitTraits = wait_traits<Clock> > +#endif // defined(ASIO_HAS_BOOST_DATE_TIME) + // && defined(ASIO_USE_BOOST_DATE_TIME_FOR_SOCKET_IOSTREAM) class basic_socket_iostream; #endif // !defined(ASIO_BASIC_SOCKET_IOSTREAM_FWD_DECL) @@ -143,22 +135,23 @@ template <typename Protocol, typename Clock = chrono::steady_clock, typename WaitTraits = wait_traits<Clock> > #else // defined(GENERATING_DOCUMENTATION) -template <typename Protocol ASIO_SVC_TPARAM, - typename Clock, typename WaitTraits ASIO_SVC_TPARAM1> +template <typename Protocol, typename Clock, typename WaitTraits> #endif // defined(GENERATING_DOCUMENTATION) class basic_socket_iostream - : private detail::socket_iostream_base<Protocol - ASIO_SVC_TARG, Clock, WaitTraits ASIO_SVC_TARG1>, + : private detail::socket_iostream_base<Protocol, Clock, WaitTraits>, public std::basic_iostream<char> { private: // These typedefs are intended keep this class's implementation independent // of whether it's using Boost.DateClock, Boost.Chrono or std::chrono. -#if defined(ASIO_HAS_BOOST_DATE_TIME) +#if defined(ASIO_HAS_BOOST_DATE_TIME) \ + && defined(ASIO_USE_BOOST_DATE_TIME_FOR_SOCKET_IOSTREAM) typedef WaitTraits traits_helper; -#else +#else // defined(ASIO_HAS_BOOST_DATE_TIME) + // && defined(ASIO_USE_BOOST_DATE_TIME_FOR_SOCKET_IOSTREAM) typedef detail::chrono_time_traits<Clock, WaitTraits> traits_helper; -#endif +#endif // defined(ASIO_HAS_BOOST_DATE_TIME) + // && defined(ASIO_USE_BOOST_DATE_TIME_FOR_SOCKET_IOSTREAM) public: /// The protocol type. @@ -195,8 +188,7 @@ public: basic_socket_iostream() : std::basic_iostream<char>( &this->detail::socket_iostream_base< - Protocol ASIO_SVC_TARG, Clock, - WaitTraits ASIO_SVC_TARG1>::streambuf_) + Protocol, Clock, WaitTraits>::streambuf_) { this->setf(std::ios_base::unitbuf); } @@ -205,26 +197,24 @@ public: /// Construct a basic_socket_iostream from the supplied socket. explicit basic_socket_iostream(basic_stream_socket<protocol_type> s) : detail::socket_iostream_base< - Protocol ASIO_SVC_TARG, Clock, - WaitTraits ASIO_SVC_TARG1>(std::move(s)), + Protocol, Clock, WaitTraits>(std::move(s)), std::basic_iostream<char>( &this->detail::socket_iostream_base< - Protocol ASIO_SVC_TARG, Clock, - WaitTraits ASIO_SVC_TARG1>::streambuf_) + Protocol, Clock, WaitTraits>::streambuf_) { this->setf(std::ios_base::unitbuf); } +#if defined(ASIO_HAS_STD_IOSTREAM_MOVE) \ + || defined(GENERATING_DOCUMENTATION) /// Move-construct a basic_socket_iostream from another. basic_socket_iostream(basic_socket_iostream&& other) : detail::socket_iostream_base< - Protocol ASIO_SVC_TARG, Clock, - WaitTraits ASIO_SVC_TARG1>(std::move(other)), + Protocol, Clock, WaitTraits>(std::move(other)), std::basic_iostream<char>(std::move(other)) { this->set_rdbuf(&this->detail::socket_iostream_base< - Protocol ASIO_SVC_TARG, Clock, - WaitTraits ASIO_SVC_TARG1>::streambuf_); + Protocol, Clock, WaitTraits>::streambuf_); } /// Move-assign a basic_socket_iostream from another. @@ -232,10 +222,11 @@ public: { std::basic_iostream<char>::operator=(std::move(other)); detail::socket_iostream_base< - Protocol ASIO_SVC_TARG, Clock, - WaitTraits ASIO_SVC_TARG1>::operator=(std::move(other)); + Protocol, Clock, WaitTraits>::operator=(std::move(other)); return *this; } +#endif // defined(ASIO_HAS_STD_IOSTREAM_MOVE) + // || defined(GENERATING_DOCUMENTATION) #endif // defined(ASIO_HAS_MOVE) || defined(GENERATING_DOCUMENTATION) #if defined(GENERATING_DOCUMENTATION) @@ -252,8 +243,7 @@ public: explicit basic_socket_iostream(T... x) : std::basic_iostream<char>( &this->detail::socket_iostream_base< - Protocol ASIO_SVC_TARG, Clock, - WaitTraits ASIO_SVC_TARG1>::streambuf_) + Protocol, Clock, WaitTraits>::streambuf_) { this->setf(std::ios_base::unitbuf); if (rdbuf()->connect(x...) == 0) @@ -291,18 +281,15 @@ public: } /// Return a pointer to the underlying streambuf. - basic_socket_streambuf<Protocol ASIO_SVC_TARG, - Clock, WaitTraits ASIO_SVC_TARG1>* rdbuf() const + basic_socket_streambuf<Protocol, Clock, WaitTraits>* rdbuf() const { - return const_cast<basic_socket_streambuf<Protocol ASIO_SVC_TARG, - Clock, WaitTraits ASIO_SVC_TARG1>*>( + return const_cast<basic_socket_streambuf<Protocol, Clock, WaitTraits>*>( &this->detail::socket_iostream_base< - Protocol ASIO_SVC_TARG, Clock, - WaitTraits ASIO_SVC_TARG1>::streambuf_); + Protocol, Clock, WaitTraits>::streambuf_); } /// Get a reference to the underlying socket. - basic_socket<Protocol ASIO_SVC_TARG>& socket() + basic_socket<Protocol>& socket() { return rdbuf()->socket(); } |