summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to '3rdParty/Boost/src/boost/asio/posix/basic_stream_descriptor.hpp')
-rw-r--r--3rdParty/Boost/src/boost/asio/posix/basic_stream_descriptor.hpp82
1 files changed, 69 insertions, 13 deletions
diff --git a/3rdParty/Boost/src/boost/asio/posix/basic_stream_descriptor.hpp b/3rdParty/Boost/src/boost/asio/posix/basic_stream_descriptor.hpp
index ee08567..2e8ed4b 100644
--- a/3rdParty/Boost/src/boost/asio/posix/basic_stream_descriptor.hpp
+++ b/3rdParty/Boost/src/boost/asio/posix/basic_stream_descriptor.hpp
@@ -2,7 +2,7 @@
// posix/basic_stream_descriptor.hpp
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
//
-// Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com)
+// 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)
@@ -21,6 +21,7 @@
|| defined(GENERATING_DOCUMENTATION)
#include <cstddef>
+#include <boost/asio/detail/handler_type_requirements.hpp>
#include <boost/asio/detail/throw_error.hpp>
#include <boost/asio/error.hpp>
#include <boost/asio/posix/basic_descriptor.hpp>
@@ -49,8 +50,13 @@ class basic_stream_descriptor
: public basic_descriptor<StreamDescriptorService>
{
public:
+ /// (Deprecated: Use native_handle_type.) The native representation of a
+ /// descriptor.
+ typedef typename StreamDescriptorService::native_handle_type native_type;
+
/// The native representation of a descriptor.
- typedef typename StreamDescriptorService::native_type native_type;
+ typedef typename StreamDescriptorService::native_handle_type
+ native_handle_type;
/// Construct a basic_stream_descriptor without opening it.
/**
@@ -81,11 +87,47 @@ public:
* @throws boost::system::system_error Thrown on failure.
*/
basic_stream_descriptor(boost::asio::io_service& io_service,
- const native_type& native_descriptor)
+ const native_handle_type& native_descriptor)
: basic_descriptor<StreamDescriptorService>(io_service, native_descriptor)
{
}
+#if defined(BOOST_ASIO_HAS_MOVE) || defined(GENERATING_DOCUMENTATION)
+ /// Move-construct a basic_stream_descriptor from another.
+ /**
+ * This constructor moves a stream descriptor from one object to another.
+ *
+ * @param other The other basic_stream_descriptor object from which the move
+ * will occur.
+ *
+ * @note Following the move, the moved-from object is in the same state as if
+ * constructed using the @c basic_stream_descriptor(io_service&) constructor.
+ */
+ basic_stream_descriptor(basic_stream_descriptor&& other)
+ : basic_descriptor<StreamDescriptorService>(
+ BOOST_ASIO_MOVE_CAST(basic_stream_descriptor)(other))
+ {
+ }
+
+ /// Move-assign a basic_stream_descriptor from another.
+ /**
+ * This assignment operator moves a stream descriptor from one object to
+ * another.
+ *
+ * @param other The other basic_stream_descriptor object from which the move
+ * will occur.
+ *
+ * @note Following the move, the moved-from object is in the same state as if
+ * constructed using the @c basic_stream_descriptor(io_service&) constructor.
+ */
+ basic_stream_descriptor& operator=(basic_stream_descriptor&& other)
+ {
+ basic_descriptor<StreamDescriptorService>::operator=(
+ BOOST_ASIO_MOVE_CAST(basic_stream_descriptor)(other));
+ return *this;
+ }
+#endif // defined(BOOST_ASIO_HAS_MOVE) || defined(GENERATING_DOCUMENTATION)
+
/// Write some data to the descriptor.
/**
* This function is used to write data to the stream descriptor. The function
@@ -117,8 +159,9 @@ public:
std::size_t write_some(const ConstBufferSequence& buffers)
{
boost::system::error_code ec;
- std::size_t s = this->service.write_some(this->implementation, buffers, ec);
- boost::asio::detail::throw_error(ec);
+ std::size_t s = this->get_service().write_some(
+ this->get_implementation(), buffers, ec);
+ boost::asio::detail::throw_error(ec, "write_some");
return s;
}
@@ -142,7 +185,8 @@ public:
std::size_t write_some(const ConstBufferSequence& buffers,
boost::system::error_code& ec)
{
- return this->service.write_some(this->implementation, buffers, ec);
+ return this->get_service().write_some(
+ this->get_implementation(), buffers, ec);
}
/// Start an asynchronous write.
@@ -182,9 +226,14 @@ public:
*/
template <typename ConstBufferSequence, typename WriteHandler>
void async_write_some(const ConstBufferSequence& buffers,
- WriteHandler handler)
+ BOOST_ASIO_MOVE_ARG(WriteHandler) handler)
{
- this->service.async_write_some(this->implementation, buffers, handler);
+ // If you get an error on the following line it means that your handler does
+ // not meet the documented type requirements for a WriteHandler.
+ BOOST_ASIO_WRITE_HANDLER_CHECK(WriteHandler, handler) type_check;
+
+ this->get_service().async_write_some(this->get_implementation(),
+ buffers, BOOST_ASIO_MOVE_CAST(WriteHandler)(handler));
}
/// Read some data from the descriptor.
@@ -219,8 +268,9 @@ public:
std::size_t read_some(const MutableBufferSequence& buffers)
{
boost::system::error_code ec;
- std::size_t s = this->service.read_some(this->implementation, buffers, ec);
- boost::asio::detail::throw_error(ec);
+ std::size_t s = this->get_service().read_some(
+ this->get_implementation(), buffers, ec);
+ boost::asio::detail::throw_error(ec, "read_some");
return s;
}
@@ -245,7 +295,8 @@ public:
std::size_t read_some(const MutableBufferSequence& buffers,
boost::system::error_code& ec)
{
- return this->service.read_some(this->implementation, buffers, ec);
+ return this->get_service().read_some(
+ this->get_implementation(), buffers, ec);
}
/// Start an asynchronous read.
@@ -286,9 +337,14 @@ public:
*/
template <typename MutableBufferSequence, typename ReadHandler>
void async_read_some(const MutableBufferSequence& buffers,
- ReadHandler handler)
+ BOOST_ASIO_MOVE_ARG(ReadHandler) handler)
{
- this->service.async_read_some(this->implementation, buffers, handler);
+ // If you get an error on the following line it means that your handler does
+ // not meet the documented type requirements for a ReadHandler.
+ BOOST_ASIO_READ_HANDLER_CHECK(ReadHandler, handler) type_check;
+
+ this->get_service().async_read_some(this->get_implementation(),
+ buffers, BOOST_ASIO_MOVE_CAST(ReadHandler)(handler));
}
};