summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to '3rdParty/Boost/src/boost/asio/impl')
-rw-r--r--3rdParty/Boost/src/boost/asio/impl/buffered_read_stream.hpp360
-rw-r--r--3rdParty/Boost/src/boost/asio/impl/buffered_write_stream.hpp340
-rw-r--r--3rdParty/Boost/src/boost/asio/impl/connect.hpp107
-rw-r--r--3rdParty/Boost/src/boost/asio/impl/error.ipp13
-rw-r--r--3rdParty/Boost/src/boost/asio/impl/handler_alloc_hook.ipp79
-rw-r--r--3rdParty/Boost/src/boost/asio/impl/io_service.hpp25
-rw-r--r--3rdParty/Boost/src/boost/asio/impl/io_service.ipp4
-rw-r--r--3rdParty/Boost/src/boost/asio/impl/read.hpp159
-rw-r--r--3rdParty/Boost/src/boost/asio/impl/read_at.hpp199
-rw-r--r--3rdParty/Boost/src/boost/asio/impl/read_until.hpp201
-rw-r--r--3rdParty/Boost/src/boost/asio/impl/serial_port_base.hpp2
-rw-r--r--3rdParty/Boost/src/boost/asio/impl/serial_port_base.ipp35
-rw-r--r--3rdParty/Boost/src/boost/asio/impl/write.hpp146
-rw-r--r--3rdParty/Boost/src/boost/asio/impl/write_at.hpp174
14 files changed, 1499 insertions, 345 deletions
diff --git a/3rdParty/Boost/src/boost/asio/impl/buffered_read_stream.hpp b/3rdParty/Boost/src/boost/asio/impl/buffered_read_stream.hpp
new file mode 100644
index 0000000..00bc204
--- /dev/null
+++ b/3rdParty/Boost/src/boost/asio/impl/buffered_read_stream.hpp
@@ -0,0 +1,360 @@
+//
+// impl/buffered_read_stream.hpp
+// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+//
+// Copyright (c) 2003-2014 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_IMPL_BUFFERED_READ_STREAM_HPP
+#define BOOST_ASIO_IMPL_BUFFERED_READ_STREAM_HPP
+
+#if defined(_MSC_VER) && (_MSC_VER >= 1200)
+# pragma once
+#endif // defined(_MSC_VER) && (_MSC_VER >= 1200)
+
+#include <boost/asio/detail/handler_alloc_helpers.hpp>
+#include <boost/asio/detail/handler_cont_helpers.hpp>
+#include <boost/asio/detail/handler_invoke_helpers.hpp>
+#include <boost/asio/detail/handler_type_requirements.hpp>
+
+#include <boost/asio/detail/push_options.hpp>
+
+namespace boost {
+namespace asio {
+
+template <typename Stream>
+std::size_t buffered_read_stream<Stream>::fill()
+{
+ detail::buffer_resize_guard<detail::buffered_stream_storage>
+ resize_guard(storage_);
+ std::size_t previous_size = storage_.size();
+ storage_.resize(storage_.capacity());
+ storage_.resize(previous_size + next_layer_.read_some(buffer(
+ storage_.data() + previous_size,
+ storage_.size() - previous_size)));
+ resize_guard.commit();
+ return storage_.size() - previous_size;
+}
+
+template <typename Stream>
+std::size_t buffered_read_stream<Stream>::fill(boost::system::error_code& ec)
+{
+ detail::buffer_resize_guard<detail::buffered_stream_storage>
+ resize_guard(storage_);
+ std::size_t previous_size = storage_.size();
+ storage_.resize(storage_.capacity());
+ storage_.resize(previous_size + next_layer_.read_some(buffer(
+ storage_.data() + previous_size,
+ storage_.size() - previous_size),
+ ec));
+ resize_guard.commit();
+ return storage_.size() - previous_size;
+}
+
+namespace detail
+{
+ template <typename ReadHandler>
+ class buffered_fill_handler
+ {
+ public:
+ buffered_fill_handler(detail::buffered_stream_storage& storage,
+ std::size_t previous_size, ReadHandler& handler)
+ : storage_(storage),
+ previous_size_(previous_size),
+ handler_(BOOST_ASIO_MOVE_CAST(ReadHandler)(handler))
+ {
+ }
+
+#if defined(BOOST_ASIO_HAS_MOVE)
+ buffered_fill_handler(const buffered_fill_handler& other)
+ : storage_(other.storage_),
+ previous_size_(other.previous_size_),
+ handler_(other.handler_)
+ {
+ }
+
+ buffered_fill_handler(buffered_fill_handler&& other)
+ : storage_(other.storage_),
+ previous_size_(other.previous_size_),
+ handler_(BOOST_ASIO_MOVE_CAST(ReadHandler)(other.handler_))
+ {
+ }
+#endif // defined(BOOST_ASIO_HAS_MOVE)
+
+ void operator()(const boost::system::error_code& ec,
+ const std::size_t bytes_transferred)
+ {
+ storage_.resize(previous_size_ + bytes_transferred);
+ handler_(ec, bytes_transferred);
+ }
+
+ //private:
+ detail::buffered_stream_storage& storage_;
+ std::size_t previous_size_;
+ ReadHandler handler_;
+ };
+
+ template <typename ReadHandler>
+ inline void* asio_handler_allocate(std::size_t size,
+ buffered_fill_handler<ReadHandler>* this_handler)
+ {
+ return boost_asio_handler_alloc_helpers::allocate(
+ size, this_handler->handler_);
+ }
+
+ template <typename ReadHandler>
+ inline void asio_handler_deallocate(void* pointer, std::size_t size,
+ buffered_fill_handler<ReadHandler>* this_handler)
+ {
+ boost_asio_handler_alloc_helpers::deallocate(
+ pointer, size, this_handler->handler_);
+ }
+
+ template <typename ReadHandler>
+ inline bool asio_handler_is_continuation(
+ buffered_fill_handler<ReadHandler>* this_handler)
+ {
+ return boost_asio_handler_cont_helpers::is_continuation(
+ this_handler->handler_);
+ }
+
+ template <typename Function, typename ReadHandler>
+ inline void asio_handler_invoke(Function& function,
+ buffered_fill_handler<ReadHandler>* this_handler)
+ {
+ boost_asio_handler_invoke_helpers::invoke(
+ function, this_handler->handler_);
+ }
+
+ template <typename Function, typename ReadHandler>
+ inline void asio_handler_invoke(const Function& function,
+ buffered_fill_handler<ReadHandler>* this_handler)
+ {
+ boost_asio_handler_invoke_helpers::invoke(
+ function, this_handler->handler_);
+ }
+} // namespace detail
+
+template <typename Stream>
+template <typename ReadHandler>
+BOOST_ASIO_INITFN_RESULT_TYPE(ReadHandler,
+ void (boost::system::error_code, std::size_t))
+buffered_read_stream<Stream>::async_fill(
+ BOOST_ASIO_MOVE_ARG(ReadHandler) 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;
+
+ detail::async_result_init<
+ ReadHandler, void (boost::system::error_code, std::size_t)> init(
+ BOOST_ASIO_MOVE_CAST(ReadHandler)(handler));
+
+ std::size_t previous_size = storage_.size();
+ storage_.resize(storage_.capacity());
+ next_layer_.async_read_some(
+ buffer(
+ storage_.data() + previous_size,
+ storage_.size() - previous_size),
+ detail::buffered_fill_handler<BOOST_ASIO_HANDLER_TYPE(
+ ReadHandler, void (boost::system::error_code, std::size_t))>(
+ storage_, previous_size, init.handler));
+
+ return init.result.get();
+}
+
+template <typename Stream>
+template <typename MutableBufferSequence>
+std::size_t buffered_read_stream<Stream>::read_some(
+ const MutableBufferSequence& buffers)
+{
+ if (boost::asio::buffer_size(buffers) == 0)
+ return 0;
+
+ if (storage_.empty())
+ this->fill();
+
+ return this->copy(buffers);
+}
+
+template <typename Stream>
+template <typename MutableBufferSequence>
+std::size_t buffered_read_stream<Stream>::read_some(
+ const MutableBufferSequence& buffers, boost::system::error_code& ec)
+{
+ ec = boost::system::error_code();
+
+ if (boost::asio::buffer_size(buffers) == 0)
+ return 0;
+
+ if (storage_.empty() && !this->fill(ec))
+ return 0;
+
+ return this->copy(buffers);
+}
+
+namespace detail
+{
+ template <typename MutableBufferSequence, typename ReadHandler>
+ class buffered_read_some_handler
+ {
+ public:
+ buffered_read_some_handler(detail::buffered_stream_storage& storage,
+ const MutableBufferSequence& buffers, ReadHandler& handler)
+ : storage_(storage),
+ buffers_(buffers),
+ handler_(handler)
+ {
+ }
+
+#if defined(BOOST_ASIO_HAS_MOVE)
+ buffered_read_some_handler(const buffered_read_some_handler& other)
+ : storage_(other.storage_),
+ buffers_(other.buffers_),
+ handler_(other.handler_)
+ {
+ }
+
+ buffered_read_some_handler(buffered_read_some_handler&& other)
+ : storage_(other.storage_),
+ buffers_(other.buffers_),
+ handler_(BOOST_ASIO_MOVE_CAST(ReadHandler)(other.handler_))
+ {
+ }
+#endif // defined(BOOST_ASIO_HAS_MOVE)
+
+ void operator()(const boost::system::error_code& ec, std::size_t)
+ {
+ if (ec || storage_.empty())
+ {
+ const std::size_t length = 0;
+ handler_(ec, length);
+ }
+ else
+ {
+ const std::size_t bytes_copied = boost::asio::buffer_copy(
+ buffers_, storage_.data(), storage_.size());
+ storage_.consume(bytes_copied);
+ handler_(ec, bytes_copied);
+ }
+ }
+
+ //private:
+ detail::buffered_stream_storage& storage_;
+ MutableBufferSequence buffers_;
+ ReadHandler handler_;
+ };
+
+ template <typename MutableBufferSequence, typename ReadHandler>
+ inline void* asio_handler_allocate(std::size_t size,
+ buffered_read_some_handler<
+ MutableBufferSequence, ReadHandler>* this_handler)
+ {
+ return boost_asio_handler_alloc_helpers::allocate(
+ size, this_handler->handler_);
+ }
+
+ template <typename MutableBufferSequence, typename ReadHandler>
+ inline void asio_handler_deallocate(void* pointer, std::size_t size,
+ buffered_read_some_handler<
+ MutableBufferSequence, ReadHandler>* this_handler)
+ {
+ boost_asio_handler_alloc_helpers::deallocate(
+ pointer, size, this_handler->handler_);
+ }
+
+ template <typename MutableBufferSequence, typename ReadHandler>
+ inline bool asio_handler_is_continuation(
+ buffered_read_some_handler<
+ MutableBufferSequence, ReadHandler>* this_handler)
+ {
+ return boost_asio_handler_cont_helpers::is_continuation(
+ this_handler->handler_);
+ }
+
+ template <typename Function, typename MutableBufferSequence,
+ typename ReadHandler>
+ inline void asio_handler_invoke(Function& function,
+ buffered_read_some_handler<
+ MutableBufferSequence, ReadHandler>* this_handler)
+ {
+ boost_asio_handler_invoke_helpers::invoke(
+ function, this_handler->handler_);
+ }
+
+ template <typename Function, typename MutableBufferSequence,
+ typename ReadHandler>
+ inline void asio_handler_invoke(const Function& function,
+ buffered_read_some_handler<
+ MutableBufferSequence, ReadHandler>* this_handler)
+ {
+ boost_asio_handler_invoke_helpers::invoke(
+ function, this_handler->handler_);
+ }
+} // namespace detail
+
+template <typename Stream>
+template <typename MutableBufferSequence, typename ReadHandler>
+BOOST_ASIO_INITFN_RESULT_TYPE(ReadHandler,
+ void (boost::system::error_code, std::size_t))
+buffered_read_stream<Stream>::async_read_some(
+ const MutableBufferSequence& buffers,
+ BOOST_ASIO_MOVE_ARG(ReadHandler) 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;
+
+ detail::async_result_init<
+ ReadHandler, void (boost::system::error_code, std::size_t)> init(
+ BOOST_ASIO_MOVE_CAST(ReadHandler)(handler));
+
+ if (boost::asio::buffer_size(buffers) == 0 || !storage_.empty())
+ {
+ next_layer_.async_read_some(boost::asio::mutable_buffers_1(0, 0),
+ detail::buffered_read_some_handler<
+ MutableBufferSequence, BOOST_ASIO_HANDLER_TYPE(
+ ReadHandler, void (boost::system::error_code, std::size_t))>(
+ storage_, buffers, init.handler));
+ }
+ else
+ {
+ this->async_fill(detail::buffered_read_some_handler<
+ MutableBufferSequence, BOOST_ASIO_HANDLER_TYPE(
+ ReadHandler, void (boost::system::error_code, std::size_t))>(
+ storage_, buffers, init.handler));
+ }
+
+ return init.result.get();
+}
+
+template <typename Stream>
+template <typename MutableBufferSequence>
+std::size_t buffered_read_stream<Stream>::peek(
+ const MutableBufferSequence& buffers)
+{
+ if (storage_.empty())
+ this->fill();
+ return this->peek_copy(buffers);
+}
+
+template <typename Stream>
+template <typename MutableBufferSequence>
+std::size_t buffered_read_stream<Stream>::peek(
+ const MutableBufferSequence& buffers, boost::system::error_code& ec)
+{
+ ec = boost::system::error_code();
+ if (storage_.empty() && !this->fill(ec))
+ return 0;
+ return this->peek_copy(buffers);
+}
+
+} // namespace asio
+} // namespace boost
+
+#include <boost/asio/detail/pop_options.hpp>
+
+#endif // BOOST_ASIO_IMPL_BUFFERED_READ_STREAM_HPP
diff --git a/3rdParty/Boost/src/boost/asio/impl/buffered_write_stream.hpp b/3rdParty/Boost/src/boost/asio/impl/buffered_write_stream.hpp
new file mode 100644
index 0000000..6501208
--- /dev/null
+++ b/3rdParty/Boost/src/boost/asio/impl/buffered_write_stream.hpp
@@ -0,0 +1,340 @@
+//
+// impl/buffered_write_stream.hpp
+// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+//
+// Copyright (c) 2003-2014 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_IMPL_BUFFERED_WRITE_STREAM_HPP
+#define BOOST_ASIO_IMPL_BUFFERED_WRITE_STREAM_HPP
+
+#if defined(_MSC_VER) && (_MSC_VER >= 1200)
+# pragma once
+#endif // defined(_MSC_VER) && (_MSC_VER >= 1200)
+
+#include <boost/asio/detail/handler_alloc_helpers.hpp>
+#include <boost/asio/detail/handler_cont_helpers.hpp>
+#include <boost/asio/detail/handler_invoke_helpers.hpp>
+#include <boost/asio/detail/handler_type_requirements.hpp>
+
+#include <boost/asio/detail/push_options.hpp>
+
+namespace boost {
+namespace asio {
+
+template <typename Stream>
+std::size_t buffered_write_stream<Stream>::flush()
+{
+ std::size_t bytes_written = write(next_layer_,
+ buffer(storage_.data(), storage_.size()));
+ storage_.consume(bytes_written);
+ return bytes_written;
+}
+
+template <typename Stream>
+std::size_t buffered_write_stream<Stream>::flush(boost::system::error_code& ec)
+{
+ std::size_t bytes_written = write(next_layer_,
+ buffer(storage_.data(), storage_.size()),
+ transfer_all(), ec);
+ storage_.consume(bytes_written);
+ return bytes_written;
+}
+
+namespace detail
+{
+ template <typename WriteHandler>
+ class buffered_flush_handler
+ {
+ public:
+ buffered_flush_handler(detail::buffered_stream_storage& storage,
+ WriteHandler& handler)
+ : storage_(storage),
+ handler_(handler)
+ {
+ }
+
+#if defined(BOOST_ASIO_HAS_MOVE)
+ buffered_flush_handler(const buffered_flush_handler& other)
+ : storage_(other.storage_),
+ handler_(other.handler_)
+ {
+ }
+
+ buffered_flush_handler(buffered_flush_handler&& other)
+ : storage_(other.storage_),
+ handler_(BOOST_ASIO_MOVE_CAST(WriteHandler)(other.handler_))
+ {
+ }
+#endif // defined(BOOST_ASIO_HAS_MOVE)
+
+ void operator()(const boost::system::error_code& ec,
+ const std::size_t bytes_written)
+ {
+ storage_.consume(bytes_written);
+ handler_(ec, bytes_written);
+ }
+
+ //private:
+ detail::buffered_stream_storage& storage_;
+ WriteHandler handler_;
+ };
+
+ template <typename WriteHandler>
+ inline void* asio_handler_allocate(std::size_t size,
+ buffered_flush_handler<WriteHandler>* this_handler)
+ {
+ return boost_asio_handler_alloc_helpers::allocate(
+ size, this_handler->handler_);
+ }
+
+ template <typename WriteHandler>
+ inline void asio_handler_deallocate(void* pointer, std::size_t size,
+ buffered_flush_handler<WriteHandler>* this_handler)
+ {
+ boost_asio_handler_alloc_helpers::deallocate(
+ pointer, size, this_handler->handler_);
+ }
+
+ template <typename WriteHandler>
+ inline bool asio_handler_is_continuation(
+ buffered_flush_handler<WriteHandler>* this_handler)
+ {
+ return boost_asio_handler_cont_helpers::is_continuation(
+ this_handler->handler_);
+ }
+
+ template <typename Function, typename WriteHandler>
+ inline void asio_handler_invoke(Function& function,
+ buffered_flush_handler<WriteHandler>* this_handler)
+ {
+ boost_asio_handler_invoke_helpers::invoke(
+ function, this_handler->handler_);
+ }
+
+ template <typename Function, typename WriteHandler>
+ inline void asio_handler_invoke(const Function& function,
+ buffered_flush_handler<WriteHandler>* this_handler)
+ {
+ boost_asio_handler_invoke_helpers::invoke(
+ function, this_handler->handler_);
+ }
+}
+
+template <typename Stream>
+template <typename WriteHandler>
+BOOST_ASIO_INITFN_RESULT_TYPE(WriteHandler,
+ void (boost::system::error_code, std::size_t))
+buffered_write_stream<Stream>::async_flush(
+ BOOST_ASIO_MOVE_ARG(WriteHandler) 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;
+
+ detail::async_result_init<
+ WriteHandler, void (boost::system::error_code, std::size_t)> init(
+ BOOST_ASIO_MOVE_CAST(WriteHandler)(handler));
+
+ async_write(next_layer_, buffer(storage_.data(), storage_.size()),
+ detail::buffered_flush_handler<BOOST_ASIO_HANDLER_TYPE(
+ WriteHandler, void (boost::system::error_code, std::size_t))>(
+ storage_, init.handler));
+
+ return init.result.get();
+}
+
+template <typename Stream>
+template <typename ConstBufferSequence>
+std::size_t buffered_write_stream<Stream>::write_some(
+ const ConstBufferSequence& buffers)
+{
+ if (boost::asio::buffer_size(buffers) == 0)
+ return 0;
+
+ if (storage_.size() == storage_.capacity())
+ this->flush();
+
+ return this->copy(buffers);
+}
+
+template <typename Stream>
+template <typename ConstBufferSequence>
+std::size_t buffered_write_stream<Stream>::write_some(
+ const ConstBufferSequence& buffers, boost::system::error_code& ec)
+{
+ ec = boost::system::error_code();
+
+ if (boost::asio::buffer_size(buffers) == 0)
+ return 0;
+
+ if (storage_.size() == storage_.capacity() && !flush(ec))
+ return 0;
+
+ return this->copy(buffers);
+}
+
+namespace detail
+{
+ template <typename ConstBufferSequence, typename WriteHandler>
+ class buffered_write_some_handler
+ {
+ public:
+ buffered_write_some_handler(detail::buffered_stream_storage& storage,
+ const ConstBufferSequence& buffers, WriteHandler& handler)
+ : storage_(storage),
+ buffers_(buffers),
+ handler_(handler)
+ {
+ }
+
+#if defined(BOOST_ASIO_HAS_MOVE)
+ buffered_write_some_handler(const buffered_write_some_handler& other)
+ : storage_(other.storage_),
+ buffers_(other.buffers_),
+ handler_(other.handler_)
+ {
+ }
+
+ buffered_write_some_handler(buffered_write_some_handler&& other)
+ : storage_(other.storage_),
+ buffers_(other.buffers_),
+ handler_(BOOST_ASIO_MOVE_CAST(WriteHandler)(other.handler_))
+ {
+ }
+#endif // defined(BOOST_ASIO_HAS_MOVE)
+
+ void operator()(const boost::system::error_code& ec, std::size_t)
+ {
+ if (ec)
+ {
+ const std::size_t length = 0;
+ handler_(ec, length);
+ }
+ else
+ {
+ std::size_t orig_size = storage_.size();
+ std::size_t space_avail = storage_.capacity() - orig_size;
+ std::size_t bytes_avail = boost::asio::buffer_size(buffers_);
+ std::size_t length = bytes_avail < space_avail
+ ? bytes_avail : space_avail;
+ storage_.resize(orig_size + length);
+ const std::size_t bytes_copied = boost::asio::buffer_copy(
+ storage_.data() + orig_size, buffers_, length);
+ handler_(ec, bytes_copied);
+ }
+ }
+
+ //private:
+ detail::buffered_stream_storage& storage_;
+ ConstBufferSequence buffers_;
+ WriteHandler handler_;
+ };
+
+ template <typename ConstBufferSequence, typename WriteHandler>
+ inline void* asio_handler_allocate(std::size_t size,
+ buffered_write_some_handler<
+ ConstBufferSequence, WriteHandler>* this_handler)
+ {
+ return boost_asio_handler_alloc_helpers::allocate(
+ size, this_handler->handler_);
+ }
+
+ template <typename ConstBufferSequence, typename WriteHandler>
+ inline void asio_handler_deallocate(void* pointer, std::size_t size,
+ buffered_write_some_handler<
+ ConstBufferSequence, WriteHandler>* this_handler)
+ {
+ boost_asio_handler_alloc_helpers::deallocate(
+ pointer, size, this_handler->handler_);
+ }
+
+ template <typename ConstBufferSequence, typename WriteHandler>
+ inline bool asio_handler_is_continuation(
+ buffered_write_some_handler<
+ ConstBufferSequence, WriteHandler>* this_handler)
+ {
+ return boost_asio_handler_cont_helpers::is_continuation(
+ this_handler->handler_);
+ }
+
+ template <typename Function, typename ConstBufferSequence,
+ typename WriteHandler>
+ inline void asio_handler_invoke(Function& function,
+ buffered_write_some_handler<
+ ConstBufferSequence, WriteHandler>* this_handler)
+ {
+ boost_asio_handler_invoke_helpers::invoke(
+ function, this_handler->handler_);
+ }
+
+ template <typename Function, typename ConstBufferSequence,
+ typename WriteHandler>
+ inline void asio_handler_invoke(const Function& function,
+ buffered_write_some_handler<
+ ConstBufferSequence, WriteHandler>* this_handler)
+ {
+ boost_asio_handler_invoke_helpers::invoke(
+ function, this_handler->handler_);
+ }
+} // namespace detail
+
+template <typename Stream>
+template <typename ConstBufferSequence, typename WriteHandler>
+BOOST_ASIO_INITFN_RESULT_TYPE(WriteHandler,
+ void (boost::system::error_code, std::size_t))
+buffered_write_stream<Stream>::async_write_some(
+ const ConstBufferSequence& buffers,
+ BOOST_ASIO_MOVE_ARG(WriteHandler) 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;
+
+ detail::async_result_init<
+ WriteHandler, void (boost::system::error_code, std::size_t)> init(
+ BOOST_ASIO_MOVE_CAST(WriteHandler)(handler));
+
+ if (boost::asio::buffer_size(buffers) == 0
+ || storage_.size() < storage_.capacity())
+ {
+ next_layer_.async_write_some(boost::asio::const_buffers_1(0, 0),
+ detail::buffered_write_some_handler<
+ ConstBufferSequence, BOOST_ASIO_HANDLER_TYPE(
+ WriteHandler, void (boost::system::error_code, std::size_t))>(
+ storage_, buffers, init.handler));
+ }
+ else
+ {
+ this->async_flush(detail::buffered_write_some_handler<
+ ConstBufferSequence, BOOST_ASIO_HANDLER_TYPE(
+ WriteHandler, void (boost::system::error_code, std::size_t))>(
+ storage_, buffers, init.handler));
+ }
+
+ return init.result.get();
+}
+
+template <typename Stream>
+template <typename ConstBufferSequence>
+std::size_t buffered_write_stream<Stream>::copy(
+ const ConstBufferSequence& buffers)
+{
+ std::size_t orig_size = storage_.size();
+ std::size_t space_avail = storage_.capacity() - orig_size;
+ std::size_t bytes_avail = boost::asio::buffer_size(buffers);
+ std::size_t length = bytes_avail < space_avail ? bytes_avail : space_avail;
+ storage_.resize(orig_size + length);
+ return boost::asio::buffer_copy(
+ storage_.data() + orig_size, buffers, length);
+}
+
+} // namespace asio
+} // namespace boost
+
+#include <boost/asio/detail/pop_options.hpp>
+
+#endif // BOOST_ASIO_IMPL_BUFFERED_WRITE_STREAM_HPP
diff --git a/3rdParty/Boost/src/boost/asio/impl/connect.hpp b/3rdParty/Boost/src/boost/asio/impl/connect.hpp
index a21bb2d..68a903e 100644
--- a/3rdParty/Boost/src/boost/asio/impl/connect.hpp
+++ b/3rdParty/Boost/src/boost/asio/impl/connect.hpp
@@ -3,5 +3,5 @@
// ~~~~~~~~~~~~~~~~
//
-// Copyright (c) 2003-2012 Christopher M. Kohlhoff (chris at kohlhoff dot com)
+// Copyright (c) 2003-2014 Christopher M. Kohlhoff (chris at kohlhoff dot com)
//
// Distributed under the Boost Software License, Version 1.0. (See accompanying
@@ -19,4 +19,5 @@
#include <boost/asio/detail/consuming_buffers.hpp>
#include <boost/asio/detail/handler_alloc_helpers.hpp>
+#include <boost/asio/detail/handler_cont_helpers.hpp>
#include <boost/asio/detail/handler_invoke_helpers.hpp>
#include <boost/asio/detail/handler_type_requirements.hpp>
@@ -185,4 +186,5 @@ namespace detail
iter_(begin),
end_(end),
+ start_(0),
handler_(BOOST_ASIO_MOVE_CAST(ComposedConnectHandler)(handler))
{
@@ -195,4 +197,5 @@ namespace detail
iter_(other.iter_),
end_(other.end_),
+ start_(other.start_),
handler_(other.handler_)
{
@@ -204,4 +207,5 @@ namespace detail
iter_(other.iter_),
end_(other.end_),
+ start_(other.start_),
handler_(BOOST_ASIO_MOVE_CAST(ComposedConnectHandler)(other.handler_))
{
@@ -211,5 +215,5 @@ namespace detail
void operator()(boost::system::error_code ec, int start = 0)
{
- switch (start)
+ switch (start_ = start)
{
case 1:
@@ -259,4 +263,5 @@ namespace detail
Iterator iter_;
Iterator end_;
+ int start_;
ComposedConnectHandler handler_;
};
@@ -282,4 +287,14 @@ namespace detail
}
+ template <typename Protocol, typename SocketService, typename Iterator,
+ typename ConnectCondition, typename ComposedConnectHandler>
+ inline bool asio_handler_is_continuation(
+ connect_op<Protocol, SocketService, Iterator,
+ ConnectCondition, ComposedConnectHandler>* this_handler)
+ {
+ return boost_asio_handler_cont_helpers::is_continuation(
+ this_handler->handler_);
+ }
+
template <typename Function, typename Protocol,
typename SocketService, typename Iterator,
@@ -303,23 +318,11 @@ namespace detail
function, this_handler->handler_);
}
-
- template <typename Protocol, typename SocketService, typename Iterator,
- typename ConnectCondition, typename ComposedConnectHandler>
- inline connect_op<Protocol, SocketService, Iterator,
- ConnectCondition, ComposedConnectHandler>
- make_connect_op(basic_socket<Protocol, SocketService>& sock,
- const Iterator& begin, const Iterator& end,
- const ConnectCondition& connect_condition,
- ComposedConnectHandler handler)
- {
- return connect_op<Protocol, SocketService, Iterator,
- ConnectCondition, ComposedConnectHandler>(
- sock, begin, end, connect_condition, handler);
- }
} // namespace detail
template <typename Protocol, typename SocketService,
typename Iterator, typename ComposedConnectHandler>
-inline void async_connect(basic_socket<Protocol, SocketService>& s,
+inline BOOST_ASIO_INITFN_RESULT_TYPE(ComposedConnectHandler,
+ void (boost::system::error_code, Iterator))
+async_connect(basic_socket<Protocol, SocketService>& s,
Iterator begin, BOOST_ASIO_MOVE_ARG(ComposedConnectHandler) handler)
{
@@ -329,13 +332,22 @@ inline void async_connect(basic_socket<Protocol, SocketService>& s,
ComposedConnectHandler, handler, Iterator) type_check;
- detail::make_connect_op(s, begin, Iterator(),
- detail::default_connect_condition(),
- BOOST_ASIO_MOVE_CAST(ComposedConnectHandler)(handler))(
- boost::system::error_code(), 1);
+ detail::async_result_init<ComposedConnectHandler,
+ void (boost::system::error_code, Iterator)> init(
+ BOOST_ASIO_MOVE_CAST(ComposedConnectHandler)(handler));
+
+ detail::connect_op<Protocol, SocketService, Iterator,
+ detail::default_connect_condition, BOOST_ASIO_HANDLER_TYPE(
+ ComposedConnectHandler, void (boost::system::error_code, Iterator))>(s,
+ begin, Iterator(), detail::default_connect_condition(), init.handler)(
+ boost::system::error_code(), 1);
+
+ return init.result.get();
}
template <typename Protocol, typename SocketService,
typename Iterator, typename ComposedConnectHandler>
-inline void async_connect(basic_socket<Protocol, SocketService>& s,
+inline BOOST_ASIO_INITFN_RESULT_TYPE(ComposedConnectHandler,
+ void (boost::system::error_code, Iterator))
+async_connect(basic_socket<Protocol, SocketService>& s,
Iterator begin, Iterator end,
BOOST_ASIO_MOVE_ARG(ComposedConnectHandler) handler)
@@ -346,13 +358,22 @@ inline void async_connect(basic_socket<Protocol, SocketService>& s,
ComposedConnectHandler, handler, Iterator) type_check;
- detail::make_connect_op(s, begin, end,
- detail::default_connect_condition(),
- BOOST_ASIO_MOVE_CAST(ComposedConnectHandler)(handler))(
- boost::system::error_code(), 1);
+ detail::async_result_init<ComposedConnectHandler,
+ void (boost::system::error_code, Iterator)> init(
+ BOOST_ASIO_MOVE_CAST(ComposedConnectHandler)(handler));
+
+ detail::connect_op<Protocol, SocketService, Iterator,
+ detail::default_connect_condition, BOOST_ASIO_HANDLER_TYPE(
+ ComposedConnectHandler, void (boost::system::error_code, Iterator))>(s,
+ begin, end, detail::default_connect_condition(), init.handler)(
+ boost::system::error_code(), 1);
+
+ return init.result.get();
}
template <typename Protocol, typename SocketService, typename Iterator,
typename ConnectCondition, typename ComposedConnectHandler>
-inline void async_connect(basic_socket<Protocol, SocketService>& s,
+inline BOOST_ASIO_INITFN_RESULT_TYPE(ComposedConnectHandler,
+ void (boost::system::error_code, Iterator))
+async_connect(basic_socket<Protocol, SocketService>& s,
Iterator begin, ConnectCondition connect_condition,
BOOST_ASIO_MOVE_ARG(ComposedConnectHandler) handler)
@@ -363,12 +384,22 @@ inline void async_connect(basic_socket<Protocol, SocketService>& s,
ComposedConnectHandler, handler, Iterator) type_check;
- detail::make_connect_op(s, begin, Iterator(), connect_condition,
- BOOST_ASIO_MOVE_CAST(ComposedConnectHandler)(handler))(
- boost::system::error_code(), 1);
+ detail::async_result_init<ComposedConnectHandler,
+ void (boost::system::error_code, Iterator)> init(
+ BOOST_ASIO_MOVE_CAST(ComposedConnectHandler)(handler));
+
+ detail::connect_op<Protocol, SocketService, Iterator,
+ ConnectCondition, BOOST_ASIO_HANDLER_TYPE(
+ ComposedConnectHandler, void (boost::system::error_code, Iterator))>(s,
+ begin, Iterator(), connect_condition, init.handler)(
+ boost::system::error_code(), 1);
+
+ return init.result.get();
}
template <typename Protocol, typename SocketService, typename Iterator,
typename ConnectCondition, typename ComposedConnectHandler>
-void async_connect(basic_socket<Protocol, SocketService>& s,
+inline BOOST_ASIO_INITFN_RESULT_TYPE(ComposedConnectHandler,
+ void (boost::system::error_code, Iterator))
+async_connect(basic_socket<Protocol, SocketService>& s,
Iterator begin, Iterator end, ConnectCondition connect_condition,
BOOST_ASIO_MOVE_ARG(ComposedConnectHandler) handler)
@@ -379,7 +410,15 @@ void async_connect(basic_socket<Protocol, SocketService>& s,
ComposedConnectHandler, handler, Iterator) type_check;
- detail::make_connect_op(s, begin, end, connect_condition,
- BOOST_ASIO_MOVE_CAST(ComposedConnectHandler)(handler))(
- boost::system::error_code(), 1);
+ detail::async_result_init<ComposedConnectHandler,
+ void (boost::system::error_code, Iterator)> init(
+ BOOST_ASIO_MOVE_CAST(ComposedConnectHandler)(handler));
+
+ detail::connect_op<Protocol, SocketService, Iterator,
+ ConnectCondition, BOOST_ASIO_HANDLER_TYPE(
+ ComposedConnectHandler, void (boost::system::error_code, Iterator))>(s,
+ begin, end, connect_condition, init.handler)(
+ boost::system::error_code(), 1);
+
+ return init.result.get();
}
diff --git a/3rdParty/Boost/src/boost/asio/impl/error.ipp b/3rdParty/Boost/src/boost/asio/impl/error.ipp
index cfb7a99..ae43418 100644
--- a/3rdParty/Boost/src/boost/asio/impl/error.ipp
+++ b/3rdParty/Boost/src/boost/asio/impl/error.ipp
@@ -3,5 +3,5 @@
// ~~~~~~~~~~~~~~
//
-// Copyright (c) 2003-2012 Christopher M. Kohlhoff (chris at kohlhoff dot com)
+// Copyright (c) 2003-2014 Christopher M. Kohlhoff (chris at kohlhoff dot com)
//
// Distributed under the Boost Software License, Version 1.0. (See accompanying
@@ -17,4 +17,5 @@
#include <boost/asio/detail/config.hpp>
+#include <string>
#include <boost/asio/error.hpp>
@@ -25,5 +26,5 @@ namespace asio {
namespace error {
-#if !defined(BOOST_WINDOWS) && !defined(__CYGWIN__)
+#if !defined(BOOST_ASIO_WINDOWS) && !defined(__CYGWIN__)
namespace detail {
@@ -32,5 +33,5 @@ class netdb_category : public boost::system::error_category
{
public:
- const char* name() const
+ const char* name() const BOOST_ASIO_ERROR_CATEGORY_NOEXCEPT
{
return "asio.netdb";
@@ -64,5 +65,5 @@ class addrinfo_category : public boost::system::error_category
{
public:
- const char* name() const
+ const char* name() const BOOST_ASIO_ERROR_CATEGORY_NOEXCEPT
{
return "asio.addrinfo";
@@ -87,5 +88,5 @@ const boost::system::error_category& get_addrinfo_category()
}
-#endif // !defined(BOOST_WINDOWS) && !defined(__CYGWIN__)
+#endif // !defined(BOOST_ASIO_WINDOWS) && !defined(__CYGWIN__)
namespace detail {
@@ -94,5 +95,5 @@ class misc_category : public boost::system::error_category
{
public:
- const char* name() const
+ const char* name() const BOOST_ASIO_ERROR_CATEGORY_NOEXCEPT
{
return "asio.misc";
diff --git a/3rdParty/Boost/src/boost/asio/impl/handler_alloc_hook.ipp b/3rdParty/Boost/src/boost/asio/impl/handler_alloc_hook.ipp
new file mode 100644
index 0000000..2561f3b
--- /dev/null
+++ b/3rdParty/Boost/src/boost/asio/impl/handler_alloc_hook.ipp
@@ -0,0 +1,79 @@
+//
+// impl/handler_alloc_hook.ipp
+// ~~~~~~~~~~~~~~~~~~~~~~~~~~~
+//
+// Copyright (c) 2003-2014 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_IMPL_HANDLER_ALLOC_HOOK_IPP
+#define BOOST_ASIO_IMPL_HANDLER_ALLOC_HOOK_IPP
+
+#if defined(_MSC_VER) && (_MSC_VER >= 1200)
+# pragma once
+#endif // defined(_MSC_VER) && (_MSC_VER >= 1200)
+
+#include <boost/asio/detail/config.hpp>
+#include <boost/asio/detail/call_stack.hpp>
+#include <boost/asio/handler_alloc_hook.hpp>
+
+#if !defined(BOOST_ASIO_DISABLE_SMALL_BLOCK_RECYCLING)
+# if defined(BOOST_ASIO_HAS_IOCP)
+# include <boost/asio/detail/win_iocp_thread_info.hpp>
+# else // defined(BOOST_ASIO_HAS_IOCP)
+# include <boost/asio/detail/task_io_service_thread_info.hpp>
+# endif // defined(BOOST_ASIO_HAS_IOCP)
+#endif // !defined(BOOST_ASIO_DISABLE_SMALL_BLOCK_RECYCLING)
+
+#include <boost/asio/detail/push_options.hpp>
+
+namespace boost {
+namespace asio {
+
+#if defined(BOOST_ASIO_HAS_IOCP)
+namespace detail { class win_iocp_io_service; }
+#endif // defined(BOOST_ASIO_HAS_IOCP)
+
+void* asio_handler_allocate(std::size_t size, ...)
+{
+#if !defined(BOOST_ASIO_DISABLE_SMALL_BLOCK_RECYCLING)
+# if defined(BOOST_ASIO_HAS_IOCP)
+ typedef detail::win_iocp_io_service io_service_impl;
+ typedef detail::win_iocp_thread_info thread_info;
+# else // defined(BOOST_ASIO_HAS_IOCP)
+ typedef detail::task_io_service io_service_impl;
+ typedef detail::task_io_service_thread_info thread_info;
+# endif // defined(BOOST_ASIO_HAS_IOCP)
+ typedef detail::call_stack<io_service_impl, thread_info> call_stack;
+ return thread_info::allocate(call_stack::top(), size);
+#else // !defined(BOOST_ASIO_DISABLE_SMALL_BLOCK_RECYCLING)
+ return ::operator new(size);
+#endif // !defined(BOOST_ASIO_DISABLE_SMALL_BLOCK_RECYCLING)
+}
+
+void asio_handler_deallocate(void* pointer, std::size_t size, ...)
+{
+#if !defined(BOOST_ASIO_DISABLE_SMALL_BLOCK_RECYCLING)
+# if defined(BOOST_ASIO_HAS_IOCP)
+ typedef detail::win_iocp_io_service io_service_impl;
+ typedef detail::win_iocp_thread_info thread_info;
+# else // defined(BOOST_ASIO_HAS_IOCP)
+ typedef detail::task_io_service io_service_impl;
+ typedef detail::task_io_service_thread_info thread_info;
+# endif // defined(BOOST_ASIO_HAS_IOCP)
+ typedef detail::call_stack<io_service_impl, thread_info> call_stack;
+ thread_info::deallocate(call_stack::top(), pointer, size);
+#else // !defined(BOOST_ASIO_DISABLE_SMALL_BLOCK_RECYCLING)
+ (void)size;
+ ::operator delete(pointer);
+#endif // !defined(BOOST_ASIO_DISABLE_SMALL_BLOCK_RECYCLING)
+}
+
+} // namespace asio
+} // namespace boost
+
+#include <boost/asio/detail/pop_options.hpp>
+
+#endif // BOOST_ASIO_IMPL_HANDLER_ALLOC_HOOK_IPP
diff --git a/3rdParty/Boost/src/boost/asio/impl/io_service.hpp b/3rdParty/Boost/src/boost/asio/impl/io_service.hpp
index 510de0e..4c6f2e1 100644
--- a/3rdParty/Boost/src/boost/asio/impl/io_service.hpp
+++ b/3rdParty/Boost/src/boost/asio/impl/io_service.hpp
@@ -3,5 +3,5 @@
// ~~~~~~~~~~~~~~~~~~~
//
-// Copyright (c) 2003-2012 Christopher M. Kohlhoff (chris at kohlhoff dot com)
+// Copyright (c) 2003-2014 Christopher M. Kohlhoff (chris at kohlhoff dot com)
//
// Distributed under the Boost Software License, Version 1.0. (See accompanying
@@ -78,6 +78,6 @@ namespace asio {
template <typename CompletionHandler>
-inline void io_service::dispatch(
- BOOST_ASIO_MOVE_ARG(CompletionHandler) handler)
+inline BOOST_ASIO_INITFN_RESULT_TYPE(CompletionHandler, void ())
+io_service::dispatch(BOOST_ASIO_MOVE_ARG(CompletionHandler) handler)
{
// If you get an error on the following line it means that your handler does
@@ -85,9 +85,16 @@ inline void io_service::dispatch(
BOOST_ASIO_COMPLETION_HANDLER_CHECK(CompletionHandler, handler) type_check;
- impl_.dispatch(BOOST_ASIO_MOVE_CAST(CompletionHandler)(handler));
+ detail::async_result_init<
+ CompletionHandler, void ()> init(
+ BOOST_ASIO_MOVE_CAST(CompletionHandler)(handler));
+
+ impl_.dispatch(init.handler);
+
+ return init.result.get();
}
template <typename CompletionHandler>
-inline void io_service::post(BOOST_ASIO_MOVE_ARG(CompletionHandler) handler)
+inline BOOST_ASIO_INITFN_RESULT_TYPE(CompletionHandler, void ())
+io_service::post(BOOST_ASIO_MOVE_ARG(CompletionHandler) handler)
{
// If you get an error on the following line it means that your handler does
@@ -95,5 +102,11 @@ inline void io_service::post(BOOST_ASIO_MOVE_ARG(CompletionHandler) handler)
BOOST_ASIO_COMPLETION_HANDLER_CHECK(CompletionHandler, handler) type_check;
- impl_.post(BOOST_ASIO_MOVE_CAST(CompletionHandler)(handler));
+ detail::async_result_init<
+ CompletionHandler, void ()> init(
+ BOOST_ASIO_MOVE_CAST(CompletionHandler)(handler));
+
+ impl_.post(init.handler);
+
+ return init.result.get();
}
diff --git a/3rdParty/Boost/src/boost/asio/impl/io_service.ipp b/3rdParty/Boost/src/boost/asio/impl/io_service.ipp
index 1e3af48..0bb5bbf 100644
--- a/3rdParty/Boost/src/boost/asio/impl/io_service.ipp
+++ b/3rdParty/Boost/src/boost/asio/impl/io_service.ipp
@@ -3,5 +3,5 @@
// ~~~~~~~~~~~~~~~~~~~
//
-// Copyright (c) 2003-2012 Christopher M. Kohlhoff (chris at kohlhoff dot com)
+// Copyright (c) 2003-2014 Christopher M. Kohlhoff (chris at kohlhoff dot com)
//
// Distributed under the Boost Software License, Version 1.0. (See accompanying
@@ -17,6 +17,6 @@
#include <boost/asio/detail/config.hpp>
-#include <boost/limits.hpp>
#include <boost/asio/io_service.hpp>
+#include <boost/asio/detail/limits.hpp>
#include <boost/asio/detail/scoped_ptr.hpp>
#include <boost/asio/detail/service_registry.hpp>
diff --git a/3rdParty/Boost/src/boost/asio/impl/read.hpp b/3rdParty/Boost/src/boost/asio/impl/read.hpp
index 9290cd4..86f8776 100644
--- a/3rdParty/Boost/src/boost/asio/impl/read.hpp
+++ b/3rdParty/Boost/src/boost/asio/impl/read.hpp
@@ -3,5 +3,5 @@
// ~~~~~~~~~~~~~
//
-// Copyright (c) 2003-2012 Christopher M. Kohlhoff (chris at kohlhoff dot com)
+// Copyright (c) 2003-2014 Christopher M. Kohlhoff (chris at kohlhoff dot com)
//
// Distributed under the Boost Software License, Version 1.0. (See accompanying
@@ -25,4 +25,5 @@
#include <boost/asio/detail/dependent_type.hpp>
#include <boost/asio/detail/handler_alloc_helpers.hpp>
+#include <boost/asio/detail/handler_cont_helpers.hpp>
#include <boost/asio/detail/handler_invoke_helpers.hpp>
#include <boost/asio/detail/handler_type_requirements.hpp>
@@ -84,5 +85,5 @@ inline std::size_t read(SyncReadStream& s, const MutableBufferSequence& buffers,
}
-#if !defined(BOOST_NO_IOSTREAM)
+#if !defined(BOOST_ASIO_NO_IOSTREAM)
template <typename SyncReadStream, typename Allocator,
@@ -139,5 +140,5 @@ inline std::size_t read(SyncReadStream& s,
}
-#endif // !defined(BOOST_NO_IOSTREAM)
+#endif // !defined(BOOST_ASIO_NO_IOSTREAM)
namespace detail
@@ -155,4 +156,5 @@ namespace detail
stream_(stream),
buffers_(buffers),
+ start_(0),
total_transferred_(0),
handler_(BOOST_ASIO_MOVE_CAST(ReadHandler)(handler))
@@ -165,4 +167,5 @@ namespace detail
stream_(other.stream_),
buffers_(other.buffers_),
+ start_(other.start_),
total_transferred_(other.total_transferred_),
handler_(other.handler_)
@@ -174,4 +177,5 @@ namespace detail
stream_(other.stream_),
buffers_(other.buffers_),
+ start_(other.start_),
total_transferred_(other.total_transferred_),
handler_(BOOST_ASIO_MOVE_CAST(ReadHandler)(other.handler_))
@@ -183,5 +187,5 @@ namespace detail
std::size_t bytes_transferred, int start = 0)
{
- switch (start)
+ switch (start_ = start)
{
case 1:
@@ -208,4 +212,5 @@ namespace detail
boost::asio::detail::consuming_buffers<
mutable_buffer, MutableBufferSequence> buffers_;
+ int start_;
std::size_t total_transferred_;
ReadHandler handler_;
@@ -226,4 +231,5 @@ namespace detail
stream_(stream),
buffer_(buffers),
+ start_(0),
total_transferred_(0),
handler_(BOOST_ASIO_MOVE_CAST(ReadHandler)(handler))
@@ -236,4 +242,5 @@ namespace detail
stream_(other.stream_),
buffer_(other.buffer_),
+ start_(other.start_),
total_transferred_(other.total_transferred_),
handler_(other.handler_)
@@ -245,4 +252,5 @@ namespace detail
stream_(other.stream_),
buffer_(other.buffer_),
+ start_(other.start_),
total_transferred_(other.total_transferred_),
handler_(BOOST_ASIO_MOVE_CAST(ReadHandler)(other.handler_))
@@ -255,5 +263,5 @@ namespace detail
{
std::size_t n = 0;
- switch (start)
+ switch (start_ = start)
{
case 1:
@@ -279,4 +287,5 @@ namespace detail
AsyncReadStream& stream_;
boost::asio::mutable_buffer buffer_;
+ int start_;
std::size_t total_transferred_;
ReadHandler handler_;
@@ -296,4 +305,5 @@ namespace detail
stream_(stream),
buffers_(buffers),
+ start_(0),
total_transferred_(0),
handler_(BOOST_ASIO_MOVE_CAST(ReadHandler)(handler))
@@ -306,4 +316,5 @@ namespace detail
stream_(other.stream_),
buffers_(other.buffers_),
+ start_(other.start_),
total_transferred_(other.total_transferred_),
handler_(other.handler_)
@@ -315,4 +326,5 @@ namespace detail
stream_(other.stream_),
buffers_(other.buffers_),
+ start_(other.start_),
total_transferred_(other.total_transferred_),
handler_(BOOST_ASIO_MOVE_CAST(ReadHandler)(other.handler_))
@@ -331,5 +343,5 @@ namespace detail
std::size_t buffer_size1 = boost::asio::buffer_size(bufs[1]);
std::size_t n = 0;
- switch (start)
+ switch (start_ = start)
{
case 1:
@@ -358,4 +370,5 @@ namespace detail
AsyncReadStream& stream_;
boost::array<Elem, 2> buffers_;
+ int start_;
std::size_t total_transferred_;
ReadHandler handler_;
@@ -377,4 +390,5 @@ namespace detail
stream_(stream),
buffers_(buffers),
+ start_(0),
total_transferred_(0),
handler_(BOOST_ASIO_MOVE_CAST(ReadHandler)(handler))
@@ -387,4 +401,5 @@ namespace detail
stream_(other.stream_),
buffers_(other.buffers_),
+ start_(other.start_),
total_transferred_(other.total_transferred_),
handler_(other.handler_)
@@ -396,4 +411,5 @@ namespace detail
stream_(other.stream_),
buffers_(other.buffers_),
+ start_(other.start_),
total_transferred_(other.total_transferred_),
handler_(BOOST_ASIO_MOVE_CAST(ReadHandler)(other.handler_))
@@ -412,5 +428,5 @@ namespace detail
std::size_t buffer_size1 = boost::asio::buffer_size(bufs[1]);
std::size_t n = 0;
- switch (start)
+ switch (start_ = start)
{
case 1:
@@ -439,4 +455,5 @@ namespace detail
AsyncReadStream& stream_;
std::array<Elem, 2> buffers_;
+ int start_;
std::size_t total_transferred_;
ReadHandler handler_;
@@ -465,4 +482,15 @@ namespace detail
}
+ template <typename AsyncReadStream, typename MutableBufferSequence,
+ typename CompletionCondition, typename ReadHandler>
+ inline bool asio_handler_is_continuation(
+ read_op<AsyncReadStream, MutableBufferSequence,
+ CompletionCondition, ReadHandler>* this_handler)
+ {
+ return this_handler->start_ == 0 ? true
+ : boost_asio_handler_cont_helpers::is_continuation(
+ this_handler->handler_);
+ }
+
template <typename Function, typename AsyncReadStream,
typename MutableBufferSequence, typename CompletionCondition,
@@ -486,20 +514,11 @@ namespace detail
function, this_handler->handler_);
}
-
- template <typename AsyncReadStream, typename MutableBufferSequence,
- typename CompletionCondition, typename ReadHandler>
- inline read_op<AsyncReadStream, MutableBufferSequence,
- CompletionCondition, ReadHandler>
- make_read_op(AsyncReadStream& s, const MutableBufferSequence& buffers,
- CompletionCondition completion_condition, ReadHandler handler)
- {
- return read_op<AsyncReadStream, MutableBufferSequence, CompletionCondition,
- ReadHandler>(s, buffers, completion_condition, handler);
- }
} // namespace detail
template <typename AsyncReadStream, typename MutableBufferSequence,
typename CompletionCondition, typename ReadHandler>
-inline void async_read(AsyncReadStream& s, const MutableBufferSequence& buffers,
+inline BOOST_ASIO_INITFN_RESULT_TYPE(ReadHandler,
+ void (boost::system::error_code, std::size_t))
+async_read(AsyncReadStream& s, const MutableBufferSequence& buffers,
CompletionCondition completion_condition,
BOOST_ASIO_MOVE_ARG(ReadHandler) handler)
@@ -509,13 +528,22 @@ inline void async_read(AsyncReadStream& s, const MutableBufferSequence& buffers,
BOOST_ASIO_READ_HANDLER_CHECK(ReadHandler, handler) type_check;
- detail::make_read_op(
- s, buffers, completion_condition,
- BOOST_ASIO_MOVE_CAST(ReadHandler)(handler))(
- boost::system::error_code(), 0, 1);
+ detail::async_result_init<
+ ReadHandler, void (boost::system::error_code, std::size_t)> init(
+ BOOST_ASIO_MOVE_CAST(ReadHandler)(handler));
+
+ detail::read_op<AsyncReadStream, MutableBufferSequence,
+ CompletionCondition, BOOST_ASIO_HANDLER_TYPE(
+ ReadHandler, void (boost::system::error_code, std::size_t))>(
+ s, buffers, completion_condition, init.handler)(
+ boost::system::error_code(), 0, 1);
+
+ return init.result.get();
}
template <typename AsyncReadStream, typename MutableBufferSequence,
typename ReadHandler>
-inline void async_read(AsyncReadStream& s, const MutableBufferSequence& buffers,
+inline BOOST_ASIO_INITFN_RESULT_TYPE(ReadHandler,
+ void (boost::system::error_code, std::size_t))
+async_read(AsyncReadStream& s, const MutableBufferSequence& buffers,
BOOST_ASIO_MOVE_ARG(ReadHandler) handler)
{
@@ -524,10 +552,18 @@ inline void async_read(AsyncReadStream& s, const MutableBufferSequence& buffers,
BOOST_ASIO_READ_HANDLER_CHECK(ReadHandler, handler) type_check;
- detail::make_read_op(
- s, buffers, transfer_all(), BOOST_ASIO_MOVE_CAST(ReadHandler)(handler))(
- boost::system::error_code(), 0, 1);
+ detail::async_result_init<
+ ReadHandler, void (boost::system::error_code, std::size_t)> init(
+ BOOST_ASIO_MOVE_CAST(ReadHandler)(handler));
+
+ detail::read_op<AsyncReadStream, MutableBufferSequence,
+ detail::transfer_all_t, BOOST_ASIO_HANDLER_TYPE(
+ ReadHandler, void (boost::system::error_code, std::size_t))>(
+ s, buffers, transfer_all(), init.handler)(
+ boost::system::error_code(), 0, 1);
+
+ return init.result.get();
}
-#if !defined(BOOST_NO_IOSTREAM)
+#if !defined(BOOST_ASIO_NO_IOSTREAM)
namespace detail
@@ -546,4 +582,5 @@ namespace detail
stream_(stream),
streambuf_(streambuf),
+ start_(0),
total_transferred_(0),
handler_(BOOST_ASIO_MOVE_CAST(ReadHandler)(handler))
@@ -556,4 +593,5 @@ namespace detail
stream_(other.stream_),
streambuf_(other.streambuf_),
+ start_(other.start_),
total_transferred_(other.total_transferred_),
handler_(other.handler_)
@@ -565,4 +603,5 @@ namespace detail
stream_(other.stream_),
streambuf_(other.streambuf_),
+ start_(other.start_),
total_transferred_(other.total_transferred_),
handler_(BOOST_ASIO_MOVE_CAST(ReadHandler)(other.handler_))
@@ -575,5 +614,5 @@ namespace detail
{
std::size_t max_size, bytes_available;
- switch (start)
+ switch (start_ = start)
{
case 1:
@@ -600,4 +639,5 @@ namespace detail
AsyncReadStream& stream_;
boost::asio::basic_streambuf<Allocator>& streambuf_;
+ int start_;
std::size_t total_transferred_;
ReadHandler handler_;
@@ -624,4 +664,15 @@ namespace detail
}
+ template <typename AsyncReadStream, typename Allocator,
+ typename CompletionCondition, typename ReadHandler>
+ inline bool asio_handler_is_continuation(
+ read_streambuf_op<AsyncReadStream, Allocator,
+ CompletionCondition, ReadHandler>* this_handler)
+ {
+ return this_handler->start_ == 0 ? true
+ : boost_asio_handler_cont_helpers::is_continuation(
+ this_handler->handler_);
+ }
+
template <typename Function, typename AsyncReadStream,
typename Allocator, typename CompletionCondition, typename ReadHandler>
@@ -643,21 +694,11 @@ namespace detail
function, this_handler->handler_);
}
-
- template <typename AsyncReadStream, typename Allocator,
- typename CompletionCondition, typename ReadHandler>
- inline read_streambuf_op<AsyncReadStream, Allocator,
- CompletionCondition, ReadHandler>
- make_read_streambuf_op(
- AsyncReadStream& s, boost::asio::basic_streambuf<Allocator>& b,
- CompletionCondition completion_condition, ReadHandler handler)
- {
- return read_streambuf_op<AsyncReadStream, Allocator, CompletionCondition,
- ReadHandler>(s, b, completion_condition, handler);
- }
} // namespace detail
template <typename AsyncReadStream, typename Allocator,
typename CompletionCondition, typename ReadHandler>
-inline void async_read(AsyncReadStream& s,
+inline BOOST_ASIO_INITFN_RESULT_TYPE(ReadHandler,
+ void (boost::system::error_code, std::size_t))
+async_read(AsyncReadStream& s,
boost::asio::basic_streambuf<Allocator>& b,
CompletionCondition completion_condition,
@@ -668,11 +709,21 @@ inline void async_read(AsyncReadStream& s,
BOOST_ASIO_READ_HANDLER_CHECK(ReadHandler, handler) type_check;
- detail::make_read_streambuf_op(
- s, b, completion_condition, BOOST_ASIO_MOVE_CAST(ReadHandler)(handler))(
- boost::system::error_code(), 0, 1);
+ detail::async_result_init<
+ ReadHandler, void (boost::system::error_code, std::size_t)> init(
+ BOOST_ASIO_MOVE_CAST(ReadHandler)(handler));
+
+ detail::read_streambuf_op<AsyncReadStream, Allocator,
+ CompletionCondition, BOOST_ASIO_HANDLER_TYPE(
+ ReadHandler, void (boost::system::error_code, std::size_t))>(
+ s, b, completion_condition, init.handler)(
+ boost::system::error_code(), 0, 1);
+
+ return init.result.get();
}
template <typename AsyncReadStream, typename Allocator, typename ReadHandler>
-inline void async_read(AsyncReadStream& s,
+inline BOOST_ASIO_INITFN_RESULT_TYPE(ReadHandler,
+ void (boost::system::error_code, std::size_t))
+async_read(AsyncReadStream& s,
boost::asio::basic_streambuf<Allocator>& b,
BOOST_ASIO_MOVE_ARG(ReadHandler) handler)
@@ -682,10 +733,18 @@ inline void async_read(AsyncReadStream& s,
BOOST_ASIO_READ_HANDLER_CHECK(ReadHandler, handler) type_check;
- detail::make_read_streambuf_op(
- s, b, transfer_all(), BOOST_ASIO_MOVE_CAST(ReadHandler)(handler))(
- boost::system::error_code(), 0, 1);
+ detail::async_result_init<
+ ReadHandler, void (boost::system::error_code, std::size_t)> init(
+ BOOST_ASIO_MOVE_CAST(ReadHandler)(handler));
+
+ detail::read_streambuf_op<AsyncReadStream, Allocator,
+ detail::transfer_all_t, BOOST_ASIO_HANDLER_TYPE(
+ ReadHandler, void (boost::system::error_code, std::size_t))>(
+ s, b, transfer_all(), init.handler)(
+ boost::system::error_code(), 0, 1);
+
+ return init.result.get();
}
-#endif // !defined(BOOST_NO_IOSTREAM)
+#endif // !defined(BOOST_ASIO_NO_IOSTREAM)
} // namespace asio
diff --git a/3rdParty/Boost/src/boost/asio/impl/read_at.hpp b/3rdParty/Boost/src/boost/asio/impl/read_at.hpp
index 08e37fe..877a7c7 100644
--- a/3rdParty/Boost/src/boost/asio/impl/read_at.hpp
+++ b/3rdParty/Boost/src/boost/asio/impl/read_at.hpp
@@ -3,5 +3,5 @@
// ~~~~~~~~~~~~~~~~
//
-// Copyright (c) 2003-2012 Christopher M. Kohlhoff (chris at kohlhoff dot com)
+// Copyright (c) 2003-2014 Christopher M. Kohlhoff (chris at kohlhoff dot com)
//
// Distributed under the Boost Software License, Version 1.0. (See accompanying
@@ -25,4 +25,5 @@
#include <boost/asio/detail/dependent_type.hpp>
#include <boost/asio/detail/handler_alloc_helpers.hpp>
+#include <boost/asio/detail/handler_cont_helpers.hpp>
#include <boost/asio/detail/handler_invoke_helpers.hpp>
#include <boost/asio/detail/handler_type_requirements.hpp>
@@ -38,5 +39,5 @@ template <typename SyncRandomAccessReadDevice, typename MutableBufferSequence,
typename CompletionCondition>
std::size_t read_at(SyncRandomAccessReadDevice& d,
- boost::uint64_t offset, const MutableBufferSequence& buffers,
+ uint64_t offset, const MutableBufferSequence& buffers,
CompletionCondition completion_condition, boost::system::error_code& ec)
{
@@ -61,5 +62,5 @@ std::size_t read_at(SyncRandomAccessReadDevice& d,
template <typename SyncRandomAccessReadDevice, typename MutableBufferSequence>
inline std::size_t read_at(SyncRandomAccessReadDevice& d,
- boost::uint64_t offset, const MutableBufferSequence& buffers)
+ uint64_t offset, const MutableBufferSequence& buffers)
{
boost::system::error_code ec;
@@ -72,5 +73,5 @@ inline std::size_t read_at(SyncRandomAccessReadDevice& d,
template <typename SyncRandomAccessReadDevice, typename MutableBufferSequence>
inline std::size_t read_at(SyncRandomAccessReadDevice& d,
- boost::uint64_t offset, const MutableBufferSequence& buffers,
+ uint64_t offset, const MutableBufferSequence& buffers,
boost::system::error_code& ec)
{
@@ -81,5 +82,5 @@ template <typename SyncRandomAccessReadDevice, typename MutableBufferSequence,
typename CompletionCondition>
inline std::size_t read_at(SyncRandomAccessReadDevice& d,
- boost::uint64_t offset, const MutableBufferSequence& buffers,
+ uint64_t offset, const MutableBufferSequence& buffers,
CompletionCondition completion_condition)
{
@@ -91,10 +92,10 @@ inline std::size_t read_at(SyncRandomAccessReadDevice& d,
}
-#if !defined(BOOST_NO_IOSTREAM)
+#if !defined(BOOST_ASIO_NO_IOSTREAM)
template <typename SyncRandomAccessReadDevice, typename Allocator,
typename CompletionCondition>
std::size_t read_at(SyncRandomAccessReadDevice& d,
- boost::uint64_t offset, boost::asio::basic_streambuf<Allocator>& b,
+ uint64_t offset, boost::asio::basic_streambuf<Allocator>& b,
CompletionCondition completion_condition, boost::system::error_code& ec)
{
@@ -119,5 +120,5 @@ std::size_t read_at(SyncRandomAccessReadDevice& d,
template <typename SyncRandomAccessReadDevice, typename Allocator>
inline std::size_t read_at(SyncRandomAccessReadDevice& d,
- boost::uint64_t offset, boost::asio::basic_streambuf<Allocator>& b)
+ uint64_t offset, boost::asio::basic_streambuf<Allocator>& b)
{
boost::system::error_code ec;
@@ -130,5 +131,5 @@ inline std::size_t read_at(SyncRandomAccessReadDevice& d,
template <typename SyncRandomAccessReadDevice, typename Allocator>
inline std::size_t read_at(SyncRandomAccessReadDevice& d,
- boost::uint64_t offset, boost::asio::basic_streambuf<Allocator>& b,
+ uint64_t offset, boost::asio::basic_streambuf<Allocator>& b,
boost::system::error_code& ec)
{
@@ -139,5 +140,5 @@ template <typename SyncRandomAccessReadDevice, typename Allocator,
typename CompletionCondition>
inline std::size_t read_at(SyncRandomAccessReadDevice& d,
- boost::uint64_t offset, boost::asio::basic_streambuf<Allocator>& b,
+ uint64_t offset, boost::asio::basic_streambuf<Allocator>& b,
CompletionCondition completion_condition)
{
@@ -149,5 +150,5 @@ inline std::size_t read_at(SyncRandomAccessReadDevice& d,
}
-#endif // !defined(BOOST_NO_IOSTREAM)
+#endif // !defined(BOOST_ASIO_NO_IOSTREAM)
namespace detail
@@ -161,5 +162,5 @@ namespace detail
public:
read_at_op(AsyncRandomAccessReadDevice& device,
- boost::uint64_t offset, const MutableBufferSequence& buffers,
+ uint64_t offset, const MutableBufferSequence& buffers,
CompletionCondition completion_condition, ReadHandler& handler)
: detail::base_from_completion_cond<
@@ -168,4 +169,5 @@ namespace detail
offset_(offset),
buffers_(buffers),
+ start_(0),
total_transferred_(0),
handler_(BOOST_ASIO_MOVE_CAST(ReadHandler)(handler))
@@ -179,4 +181,5 @@ namespace detail
offset_(other.offset_),
buffers_(other.buffers_),
+ start_(other.start_),
total_transferred_(other.total_transferred_),
handler_(other.handler_)
@@ -189,4 +192,5 @@ namespace detail
offset_(other.offset_),
buffers_(other.buffers_),
+ start_(other.start_),
total_transferred_(other.total_transferred_),
handler_(BOOST_ASIO_MOVE_CAST(ReadHandler)(other.handler_))
@@ -198,5 +202,5 @@ namespace detail
std::size_t bytes_transferred, int start = 0)
{
- switch (start)
+ switch (start_ = start)
{
case 1:
@@ -221,7 +225,8 @@ namespace detail
//private:
AsyncRandomAccessReadDevice& device_;
- boost::uint64_t offset_;
+ uint64_t offset_;
boost::asio::detail::consuming_buffers<
mutable_buffer, MutableBufferSequence> buffers_;
+ int start_;
std::size_t total_transferred_;
ReadHandler handler_;
@@ -236,5 +241,5 @@ namespace detail
public:
read_at_op(AsyncRandomAccessReadDevice& device,
- boost::uint64_t offset, const boost::asio::mutable_buffers_1& buffers,
+ uint64_t offset, const boost::asio::mutable_buffers_1& buffers,
CompletionCondition completion_condition, ReadHandler& handler)
: detail::base_from_completion_cond<
@@ -243,4 +248,5 @@ namespace detail
offset_(offset),
buffer_(buffers),
+ start_(0),
total_transferred_(0),
handler_(BOOST_ASIO_MOVE_CAST(ReadHandler)(handler))
@@ -254,4 +260,5 @@ namespace detail
offset_(other.offset_),
buffer_(other.buffer_),
+ start_(other.start_),
total_transferred_(other.total_transferred_),
handler_(other.handler_)
@@ -264,4 +271,5 @@ namespace detail
offset_(other.offset_),
buffer_(other.buffer_),
+ start_(other.start_),
total_transferred_(other.total_transferred_),
handler_(BOOST_ASIO_MOVE_CAST(ReadHandler)(other.handler_))
@@ -274,5 +282,5 @@ namespace detail
{
std::size_t n = 0;
- switch (start)
+ switch (start_ = start)
{
case 1:
@@ -297,6 +305,7 @@ namespace detail
//private:
AsyncRandomAccessReadDevice& device_;
- boost::uint64_t offset_;
+ uint64_t offset_;
boost::asio::mutable_buffer buffer_;
+ int start_;
std::size_t total_transferred_;
ReadHandler handler_;
@@ -311,5 +320,5 @@ namespace detail
public:
read_at_op(AsyncRandomAccessReadDevice& device,
- boost::uint64_t offset, const boost::array<Elem, 2>& buffers,
+ uint64_t offset, const boost::array<Elem, 2>& buffers,
CompletionCondition completion_condition, ReadHandler& handler)
: detail::base_from_completion_cond<
@@ -318,4 +327,5 @@ namespace detail
offset_(offset),
buffers_(buffers),
+ start_(0),
total_transferred_(0),
handler_(BOOST_ASIO_MOVE_CAST(ReadHandler)(handler))
@@ -329,4 +339,5 @@ namespace detail
offset_(other.offset_),
buffers_(other.buffers_),
+ start_(other.start_),
total_transferred_(other.total_transferred_),
handler_(other.handler_)
@@ -339,4 +350,5 @@ namespace detail
offset_(other.offset_),
buffers_(other.buffers_),
+ start_(other.start_),
total_transferred_(other.total_transferred_),
handler_(BOOST_ASIO_MOVE_CAST(ReadHandler)(other.handler_))
@@ -355,5 +367,5 @@ namespace detail
std::size_t buffer_size1 = boost::asio::buffer_size(bufs[1]);
std::size_t n = 0;
- switch (start)
+ switch (start_ = start)
{
case 1:
@@ -382,6 +394,7 @@ namespace detail
//private:
AsyncRandomAccessReadDevice& device_;
- boost::uint64_t offset_;
+ uint64_t offset_;
boost::array<Elem, 2> buffers_;
+ int start_;
std::size_t total_transferred_;
ReadHandler handler_;
@@ -398,5 +411,5 @@ namespace detail
public:
read_at_op(AsyncRandomAccessReadDevice& device,
- boost::uint64_t offset, const std::array<Elem, 2>& buffers,
+ uint64_t offset, const std::array<Elem, 2>& buffers,
CompletionCondition completion_condition, ReadHandler& handler)
: detail::base_from_completion_cond<
@@ -405,4 +418,5 @@ namespace detail
offset_(offset),
buffers_(buffers),
+ start_(0),
total_transferred_(0),
handler_(BOOST_ASIO_MOVE_CAST(ReadHandler)(handler))
@@ -416,4 +430,5 @@ namespace detail
offset_(other.offset_),
buffers_(other.buffers_),
+ start_(other.start_),
total_transferred_(other.total_transferred_),
handler_(other.handler_)
@@ -426,4 +441,5 @@ namespace detail
offset_(other.offset_),
buffers_(other.buffers_),
+ start_(other.start_),
total_transferred_(other.total_transferred_),
handler_(BOOST_ASIO_MOVE_CAST(ReadHandler)(other.handler_))
@@ -442,5 +458,5 @@ namespace detail
std::size_t buffer_size1 = boost::asio::buffer_size(bufs[1]);
std::size_t n = 0;
- switch (start)
+ switch (start_ = start)
{
case 1:
@@ -469,6 +485,7 @@ namespace detail
//private:
AsyncRandomAccessReadDevice& device_;
- boost::uint64_t offset_;
+ uint64_t offset_;
std::array<Elem, 2> buffers_;
+ int start_;
std::size_t total_transferred_;
ReadHandler handler_;
@@ -499,4 +516,16 @@ namespace detail
}
+ template <typename AsyncRandomAccessReadDevice,
+ typename MutableBufferSequence, typename CompletionCondition,
+ typename ReadHandler>
+ inline bool asio_handler_is_continuation(
+ read_at_op<AsyncRandomAccessReadDevice, MutableBufferSequence,
+ CompletionCondition, ReadHandler>* this_handler)
+ {
+ return this_handler->start_ == 0 ? true
+ : boost_asio_handler_cont_helpers::is_continuation(
+ this_handler->handler_);
+ }
+
template <typename Function, typename AsyncRandomAccessReadDevice,
typename MutableBufferSequence, typename CompletionCondition,
@@ -527,5 +556,5 @@ namespace detail
MutableBufferSequence, CompletionCondition, ReadHandler>
make_read_at_op(AsyncRandomAccessReadDevice& d,
- boost::uint64_t offset, const MutableBufferSequence& buffers,
+ uint64_t offset, const MutableBufferSequence& buffers,
CompletionCondition completion_condition, ReadHandler handler)
{
@@ -538,6 +567,8 @@ namespace detail
template <typename AsyncRandomAccessReadDevice, typename MutableBufferSequence,
typename CompletionCondition, typename ReadHandler>
-inline void async_read_at(AsyncRandomAccessReadDevice& d,
- boost::uint64_t offset, const MutableBufferSequence& buffers,
+inline BOOST_ASIO_INITFN_RESULT_TYPE(ReadHandler,
+ void (boost::system::error_code, std::size_t))
+async_read_at(AsyncRandomAccessReadDevice& d,
+ uint64_t offset, const MutableBufferSequence& buffers,
CompletionCondition completion_condition,
BOOST_ASIO_MOVE_ARG(ReadHandler) handler)
@@ -547,14 +578,23 @@ inline void async_read_at(AsyncRandomAccessReadDevice& d,
BOOST_ASIO_READ_HANDLER_CHECK(ReadHandler, handler) type_check;
- detail::make_read_at_op(
- d, offset, buffers, completion_condition,
- BOOST_ASIO_MOVE_CAST(ReadHandler)(handler))(
- boost::system::error_code(), 0, 1);
+ detail::async_result_init<
+ ReadHandler, void (boost::system::error_code, std::size_t)> init(
+ BOOST_ASIO_MOVE_CAST(ReadHandler)(handler));
+
+ detail::read_at_op<AsyncRandomAccessReadDevice, MutableBufferSequence,
+ CompletionCondition, BOOST_ASIO_HANDLER_TYPE(ReadHandler,
+ void (boost::system::error_code, std::size_t))>(
+ d, offset, buffers, completion_condition, init.handler)(
+ boost::system::error_code(), 0, 1);
+
+ return init.result.get();
}
template <typename AsyncRandomAccessReadDevice, typename MutableBufferSequence,
typename ReadHandler>
-inline void async_read_at(AsyncRandomAccessReadDevice& d,
- boost::uint64_t offset, const MutableBufferSequence& buffers,
+inline BOOST_ASIO_INITFN_RESULT_TYPE(ReadHandler,
+ void (boost::system::error_code, std::size_t))
+async_read_at(AsyncRandomAccessReadDevice& d,
+ uint64_t offset, const MutableBufferSequence& buffers,
BOOST_ASIO_MOVE_ARG(ReadHandler) handler)
{
@@ -563,11 +603,18 @@ inline void async_read_at(AsyncRandomAccessReadDevice& d,
BOOST_ASIO_READ_HANDLER_CHECK(ReadHandler, handler) type_check;
- detail::make_read_at_op(
- d, offset, buffers, transfer_all(),
- BOOST_ASIO_MOVE_CAST(ReadHandler)(handler))(
- boost::system::error_code(), 0, 1);
+ detail::async_result_init<
+ ReadHandler, void (boost::system::error_code, std::size_t)> init(
+ BOOST_ASIO_MOVE_CAST(ReadHandler)(handler));
+
+ detail::read_at_op<AsyncRandomAccessReadDevice, MutableBufferSequence,
+ detail::transfer_all_t, BOOST_ASIO_HANDLER_TYPE(ReadHandler,
+ void (boost::system::error_code, std::size_t))>(
+ d, offset, buffers, transfer_all(), init.handler)(
+ boost::system::error_code(), 0, 1);
+
+ return init.result.get();
}
-#if !defined(BOOST_NO_IOSTREAM)
+#if !defined(BOOST_ASIO_NO_IOSTREAM)
namespace detail
@@ -580,5 +627,5 @@ namespace detail
public:
read_at_streambuf_op(AsyncRandomAccessReadDevice& device,
- boost::uint64_t offset, basic_streambuf<Allocator>& streambuf,
+ uint64_t offset, basic_streambuf<Allocator>& streambuf,
CompletionCondition completion_condition, ReadHandler& handler)
: detail::base_from_completion_cond<
@@ -587,4 +634,5 @@ namespace detail
offset_(offset),
streambuf_(streambuf),
+ start_(0),
total_transferred_(0),
handler_(BOOST_ASIO_MOVE_CAST(ReadHandler)(handler))
@@ -598,4 +646,5 @@ namespace detail
offset_(other.offset_),
streambuf_(other.streambuf_),
+ start_(other.start_),
total_transferred_(other.total_transferred_),
handler_(other.handler_)
@@ -608,4 +657,5 @@ namespace detail
offset_(other.offset_),
streambuf_(other.streambuf_),
+ start_(other.start_),
total_transferred_(other.total_transferred_),
handler_(BOOST_ASIO_MOVE_CAST(ReadHandler)(other.handler_))
@@ -618,5 +668,5 @@ namespace detail
{
std::size_t max_size, bytes_available;
- switch (start)
+ switch (start_ = start)
{
case 1:
@@ -643,6 +693,7 @@ namespace detail
//private:
AsyncRandomAccessReadDevice& device_;
- boost::uint64_t offset_;
+ uint64_t offset_;
boost::asio::basic_streambuf<Allocator>& streambuf_;
+ int start_;
std::size_t total_transferred_;
ReadHandler handler_;
@@ -669,4 +720,15 @@ namespace detail
}
+ template <typename AsyncRandomAccessReadDevice, typename Allocator,
+ typename CompletionCondition, typename ReadHandler>
+ inline bool asio_handler_is_continuation(
+ read_at_streambuf_op<AsyncRandomAccessReadDevice, Allocator,
+ CompletionCondition, ReadHandler>* this_handler)
+ {
+ return this_handler->start_ == 0 ? true
+ : boost_asio_handler_cont_helpers::is_continuation(
+ this_handler->handler_);
+ }
+
template <typename Function, typename AsyncRandomAccessReadDevice,
typename Allocator, typename CompletionCondition, typename ReadHandler>
@@ -688,23 +750,12 @@ namespace detail
function, this_handler->handler_);
}
-
- template <typename AsyncRandomAccessReadDevice, typename Allocator,
- typename CompletionCondition, typename ReadHandler>
- inline read_at_streambuf_op<AsyncRandomAccessReadDevice,
- Allocator, CompletionCondition, ReadHandler>
- make_read_at_streambuf_op(AsyncRandomAccessReadDevice& d,
- boost::uint64_t offset, boost::asio::basic_streambuf<Allocator>& b,
- CompletionCondition completion_condition, ReadHandler handler)
- {
- return read_at_streambuf_op<AsyncRandomAccessReadDevice,
- Allocator, CompletionCondition, ReadHandler>(
- d, offset, b, completion_condition, handler);
- }
} // namespace detail
template <typename AsyncRandomAccessReadDevice, typename Allocator,
typename CompletionCondition, typename ReadHandler>
-inline void async_read_at(AsyncRandomAccessReadDevice& d,
- boost::uint64_t offset, boost::asio::basic_streambuf<Allocator>& b,
+inline BOOST_ASIO_INITFN_RESULT_TYPE(ReadHandler,
+ void (boost::system::error_code, std::size_t))
+async_read_at(AsyncRandomAccessReadDevice& d,
+ uint64_t offset, boost::asio::basic_streambuf<Allocator>& b,
CompletionCondition completion_condition,
BOOST_ASIO_MOVE_ARG(ReadHandler) handler)
@@ -714,14 +765,23 @@ inline void async_read_at(AsyncRandomAccessReadDevice& d,
BOOST_ASIO_READ_HANDLER_CHECK(ReadHandler, handler) type_check;
- detail::make_read_at_streambuf_op(
- d, offset, b, completion_condition,
- BOOST_ASIO_MOVE_CAST(ReadHandler)(handler))(
- boost::system::error_code(), 0, 1);
+ detail::async_result_init<
+ ReadHandler, void (boost::system::error_code, std::size_t)> init(
+ BOOST_ASIO_MOVE_CAST(ReadHandler)(handler));
+
+ detail::read_at_streambuf_op<AsyncRandomAccessReadDevice, Allocator,
+ CompletionCondition, BOOST_ASIO_HANDLER_TYPE(ReadHandler,
+ void (boost::system::error_code, std::size_t))>(
+ d, offset, b, completion_condition, init.handler)(
+ boost::system::error_code(), 0, 1);
+
+ return init.result.get();
}
template <typename AsyncRandomAccessReadDevice, typename Allocator,
typename ReadHandler>
-inline void async_read_at(AsyncRandomAccessReadDevice& d,
- boost::uint64_t offset, boost::asio::basic_streambuf<Allocator>& b,
+inline BOOST_ASIO_INITFN_RESULT_TYPE(ReadHandler,
+ void (boost::system::error_code, std::size_t))
+async_read_at(AsyncRandomAccessReadDevice& d,
+ uint64_t offset, boost::asio::basic_streambuf<Allocator>& b,
BOOST_ASIO_MOVE_ARG(ReadHandler) handler)
{
@@ -730,11 +790,18 @@ inline void async_read_at(AsyncRandomAccessReadDevice& d,
BOOST_ASIO_READ_HANDLER_CHECK(ReadHandler, handler) type_check;
- detail::make_read_at_streambuf_op(
- d, offset, b, transfer_all(),
- BOOST_ASIO_MOVE_CAST(ReadHandler)(handler))(
- boost::system::error_code(), 0, 1);
+ detail::async_result_init<
+ ReadHandler, void (boost::system::error_code, std::size_t)> init(
+ BOOST_ASIO_MOVE_CAST(ReadHandler)(handler));
+
+ detail::read_at_streambuf_op<AsyncRandomAccessReadDevice, Allocator,
+ detail::transfer_all_t, BOOST_ASIO_HANDLER_TYPE(ReadHandler,
+ void (boost::system::error_code, std::size_t))>(
+ d, offset, b, transfer_all(), init.handler)(
+ boost::system::error_code(), 0, 1);
+
+ return init.result.get();
}
-#endif // !defined(BOOST_NO_IOSTREAM)
+#endif // !defined(BOOST_ASIO_NO_IOSTREAM)
} // namespace asio
diff --git a/3rdParty/Boost/src/boost/asio/impl/read_until.hpp b/3rdParty/Boost/src/boost/asio/impl/read_until.hpp
index 1b9a8f3..349c447 100644
--- a/3rdParty/Boost/src/boost/asio/impl/read_until.hpp
+++ b/3rdParty/Boost/src/boost/asio/impl/read_until.hpp
@@ -3,5 +3,5 @@
// ~~~~~~~~~~~~~~~~~~~
//
-// Copyright (c) 2003-2012 Christopher M. Kohlhoff (chris at kohlhoff dot com)
+// Copyright (c) 2003-2014 Christopher M. Kohlhoff (chris at kohlhoff dot com)
//
// Distributed under the Boost Software License, Version 1.0. (See accompanying
@@ -20,11 +20,12 @@
#include <vector>
#include <utility>
-#include <boost/limits.hpp>
#include <boost/asio/buffer.hpp>
#include <boost/asio/buffers_iterator.hpp>
#include <boost/asio/detail/bind_handler.hpp>
#include <boost/asio/detail/handler_alloc_helpers.hpp>
+#include <boost/asio/detail/handler_cont_helpers.hpp>
#include <boost/asio/detail/handler_invoke_helpers.hpp>
#include <boost/asio/detail/handler_type_requirements.hpp>
+#include <boost/asio/detail/limits.hpp>
#include <boost/asio/detail/throw_error.hpp>
@@ -190,4 +191,6 @@ std::size_t read_until(SyncReadStream& s,
}
+#if defined(BOOST_ASIO_HAS_BOOST_REGEX)
+
template <typename SyncReadStream, typename Allocator>
inline std::size_t read_until(SyncReadStream& s,
@@ -257,9 +260,11 @@ std::size_t read_until(SyncReadStream& s,
}
+#endif // defined(BOOST_ASIO_HAS_BOOST_REGEX)
+
template <typename SyncReadStream, typename Allocator, typename MatchCondition>
std::size_t read_until(SyncReadStream& s,
boost::asio::basic_streambuf<Allocator>& b,
MatchCondition match_condition, boost::system::error_code& ec,
- typename boost::enable_if<is_match_condition<MatchCondition> >::type*)
+ typename enable_if<is_match_condition<MatchCondition>::value>::type*)
{
std::size_t search_position = 0;
@@ -312,5 +317,5 @@ template <typename SyncReadStream, typename Allocator, typename MatchCondition>
inline std::size_t read_until(SyncReadStream& s,
boost::asio::basic_streambuf<Allocator>& b, MatchCondition match_condition,
- typename boost::enable_if<is_match_condition<MatchCondition> >::type*)
+ typename enable_if<is_match_condition<MatchCondition>::value>::type*)
{
boost::system::error_code ec;
@@ -332,4 +337,5 @@ namespace detail
streambuf_(streambuf),
delim_(delim),
+ start_(0),
search_position_(0),
handler_(BOOST_ASIO_MOVE_CAST(ReadHandler)(handler))
@@ -342,4 +348,5 @@ namespace detail
streambuf_(other.streambuf_),
delim_(other.delim_),
+ start_(other.start_),
search_position_(other.search_position_),
handler_(other.handler_)
@@ -351,4 +358,5 @@ namespace detail
streambuf_(other.streambuf_),
delim_(other.delim_),
+ start_(other.start_),
search_position_(other.search_position_),
handler_(BOOST_ASIO_MOVE_CAST(ReadHandler)(other.handler_))
@@ -362,5 +370,5 @@ namespace detail
const std::size_t not_found = (std::numeric_limits<std::size_t>::max)();
std::size_t bytes_to_read;
- switch (start)
+ switch (start_ = start)
{
case 1:
@@ -431,4 +439,5 @@ namespace detail
boost::asio::basic_streambuf<Allocator>& streambuf_;
char delim_;
+ int start_;
std::size_t search_position_;
ReadHandler handler_;
@@ -453,4 +462,14 @@ namespace detail
}
+ template <typename AsyncReadStream, typename Allocator, typename ReadHandler>
+ inline bool asio_handler_is_continuation(
+ read_until_delim_op<AsyncReadStream,
+ Allocator, ReadHandler>* this_handler)
+ {
+ return this_handler->start_ == 0 ? true
+ : boost_asio_handler_cont_helpers::is_continuation(
+ this_handler->handler_);
+ }
+
template <typename Function, typename AsyncReadStream, typename Allocator,
typename ReadHandler>
@@ -472,18 +491,10 @@ namespace detail
function, this_handler->handler_);
}
-
- template <typename AsyncReadStream, typename Allocator, typename ReadHandler>
- inline read_until_delim_op<AsyncReadStream, Allocator, ReadHandler>
- make_read_until_delim_op(AsyncReadStream& s,
- boost::asio::basic_streambuf<Allocator>& b,
- char delim, ReadHandler handler)
- {
- return read_until_delim_op<AsyncReadStream, Allocator, ReadHandler>(
- s, b, delim, handler);
- }
} // namespace detail
template <typename AsyncReadStream, typename Allocator, typename ReadHandler>
-void async_read_until(AsyncReadStream& s,
+BOOST_ASIO_INITFN_RESULT_TYPE(ReadHandler,
+ void (boost::system::error_code, std::size_t))
+async_read_until(AsyncReadStream& s,
boost::asio::basic_streambuf<Allocator>& b, char delim,
BOOST_ASIO_MOVE_ARG(ReadHandler) handler)
@@ -493,7 +504,15 @@ void async_read_until(AsyncReadStream& s,
BOOST_ASIO_READ_HANDLER_CHECK(ReadHandler, handler) type_check;
- detail::make_read_until_delim_op(
- s, b, delim, BOOST_ASIO_MOVE_CAST(ReadHandler)(handler))(
- boost::system::error_code(), 0, 1);
+ detail::async_result_init<
+ ReadHandler, void (boost::system::error_code, std::size_t)> init(
+ BOOST_ASIO_MOVE_CAST(ReadHandler)(handler));
+
+ detail::read_until_delim_op<AsyncReadStream,
+ Allocator, BOOST_ASIO_HANDLER_TYPE(ReadHandler,
+ void (boost::system::error_code, std::size_t))>(
+ s, b, delim, init.handler)(
+ boost::system::error_code(), 0, 1);
+
+ return init.result.get();
}
@@ -510,4 +529,5 @@ namespace detail
streambuf_(streambuf),
delim_(delim),
+ start_(0),
search_position_(0),
handler_(BOOST_ASIO_MOVE_CAST(ReadHandler)(handler))
@@ -520,4 +540,5 @@ namespace detail
streambuf_(other.streambuf_),
delim_(other.delim_),
+ start_(other.start_),
search_position_(other.search_position_),
handler_(other.handler_)
@@ -529,4 +550,5 @@ namespace detail
streambuf_(other.streambuf_),
delim_(BOOST_ASIO_MOVE_CAST(std::string)(other.delim_)),
+ start_(other.start_),
search_position_(other.search_position_),
handler_(BOOST_ASIO_MOVE_CAST(ReadHandler)(other.handler_))
@@ -540,5 +562,5 @@ namespace detail
const std::size_t not_found = (std::numeric_limits<std::size_t>::max)();
std::size_t bytes_to_read;
- switch (start)
+ switch (start_ = start)
{
case 1:
@@ -620,4 +642,5 @@ namespace detail
boost::asio::basic_streambuf<Allocator>& streambuf_;
std::string delim_;
+ int start_;
std::size_t search_position_;
ReadHandler handler_;
@@ -642,4 +665,14 @@ namespace detail
}
+ template <typename AsyncReadStream, typename Allocator, typename ReadHandler>
+ inline bool asio_handler_is_continuation(
+ read_until_delim_string_op<AsyncReadStream,
+ Allocator, ReadHandler>* this_handler)
+ {
+ return this_handler->start_ == 0 ? true
+ : boost_asio_handler_cont_helpers::is_continuation(
+ this_handler->handler_);
+ }
+
template <typename Function, typename AsyncReadStream,
typename Allocator, typename ReadHandler>
@@ -661,18 +694,10 @@ namespace detail
function, this_handler->handler_);
}
-
- template <typename AsyncReadStream, typename Allocator, typename ReadHandler>
- inline read_until_delim_string_op<AsyncReadStream, Allocator, ReadHandler>
- make_read_until_delim_string_op(AsyncReadStream& s,
- boost::asio::basic_streambuf<Allocator>& b,
- const std::string& delim, ReadHandler handler)
- {
- return read_until_delim_string_op<AsyncReadStream, Allocator, ReadHandler>(
- s, b, delim, handler);
- }
} // namespace detail
template <typename AsyncReadStream, typename Allocator, typename ReadHandler>
-void async_read_until(AsyncReadStream& s,
+BOOST_ASIO_INITFN_RESULT_TYPE(ReadHandler,
+ void (boost::system::error_code, std::size_t))
+async_read_until(AsyncReadStream& s,
boost::asio::basic_streambuf<Allocator>& b, const std::string& delim,
BOOST_ASIO_MOVE_ARG(ReadHandler) handler)
@@ -682,9 +707,19 @@ void async_read_until(AsyncReadStream& s,
BOOST_ASIO_READ_HANDLER_CHECK(ReadHandler, handler) type_check;
- detail::make_read_until_delim_string_op(
- s, b, delim, BOOST_ASIO_MOVE_CAST(ReadHandler)(handler))(
- boost::system::error_code(), 0, 1);
+ detail::async_result_init<
+ ReadHandler, void (boost::system::error_code, std::size_t)> init(
+ BOOST_ASIO_MOVE_CAST(ReadHandler)(handler));
+
+ detail::read_until_delim_string_op<AsyncReadStream,
+ Allocator, BOOST_ASIO_HANDLER_TYPE(ReadHandler,
+ void (boost::system::error_code, std::size_t))>(
+ s, b, delim, init.handler)(
+ boost::system::error_code(), 0, 1);
+
+ return init.result.get();
}
+#if defined(BOOST_ASIO_HAS_BOOST_REGEX)
+
namespace detail
{
@@ -700,4 +735,5 @@ namespace detail
streambuf_(streambuf),
expr_(expr),
+ start_(0),
search_position_(0),
handler_(BOOST_ASIO_MOVE_CAST(ReadHandler)(handler))
@@ -710,4 +746,5 @@ namespace detail
streambuf_(other.streambuf_),
expr_(other.expr_),
+ start_(other.start_),
search_position_(other.search_position_),
handler_(other.handler_)
@@ -719,4 +756,5 @@ namespace detail
streambuf_(other.streambuf_),
expr_(other.expr_),
+ start_(other.start_),
search_position_(other.search_position_),
handler_(BOOST_ASIO_MOVE_CAST(ReadHandler)(other.handler_))
@@ -730,5 +768,5 @@ namespace detail
const std::size_t not_found = (std::numeric_limits<std::size_t>::max)();
std::size_t bytes_to_read;
- switch (start)
+ switch (start_ = start)
{
case 1:
@@ -813,4 +851,5 @@ namespace detail
boost::asio::basic_streambuf<Allocator>& streambuf_;
RegEx expr_;
+ int start_;
std::size_t search_position_;
ReadHandler handler_;
@@ -837,4 +876,15 @@ namespace detail
}
+ template <typename AsyncReadStream, typename Allocator,
+ typename RegEx, typename ReadHandler>
+ inline bool asio_handler_is_continuation(
+ read_until_expr_op<AsyncReadStream,
+ Allocator, RegEx, ReadHandler>* this_handler)
+ {
+ return this_handler->start_ == 0 ? true
+ : boost_asio_handler_cont_helpers::is_continuation(
+ this_handler->handler_);
+ }
+
template <typename Function, typename AsyncReadStream, typename Allocator,
typename RegEx, typename ReadHandler>
@@ -856,19 +906,10 @@ namespace detail
function, this_handler->handler_);
}
-
- template <typename AsyncReadStream, typename Allocator,
- typename RegEx, typename ReadHandler>
- inline read_until_expr_op<AsyncReadStream, Allocator, RegEx, ReadHandler>
- make_read_until_expr_op(AsyncReadStream& s,
- boost::asio::basic_streambuf<Allocator>& b,
- const RegEx& expr, ReadHandler handler)
- {
- return read_until_expr_op<AsyncReadStream, Allocator, RegEx, ReadHandler>(
- s, b, expr, handler);
- }
} // namespace detail
template <typename AsyncReadStream, typename Allocator, typename ReadHandler>
-void async_read_until(AsyncReadStream& s,
+BOOST_ASIO_INITFN_RESULT_TYPE(ReadHandler,
+ void (boost::system::error_code, std::size_t))
+async_read_until(AsyncReadStream& s,
boost::asio::basic_streambuf<Allocator>& b, const boost::regex& expr,
BOOST_ASIO_MOVE_ARG(ReadHandler) handler)
@@ -878,9 +919,19 @@ void async_read_until(AsyncReadStream& s,
BOOST_ASIO_READ_HANDLER_CHECK(ReadHandler, handler) type_check;
- detail::make_read_until_expr_op(
- s, b, expr, BOOST_ASIO_MOVE_CAST(ReadHandler)(handler))(
- boost::system::error_code(), 0, 1);
+ detail::async_result_init<
+ ReadHandler, void (boost::system::error_code, std::size_t)> init(
+ BOOST_ASIO_MOVE_CAST(ReadHandler)(handler));
+
+ detail::read_until_expr_op<AsyncReadStream, Allocator,
+ boost::regex, BOOST_ASIO_HANDLER_TYPE(ReadHandler,
+ void (boost::system::error_code, std::size_t))>(
+ s, b, expr, init.handler)(
+ boost::system::error_code(), 0, 1);
+
+ return init.result.get();
}
+#endif // defined(BOOST_ASIO_HAS_BOOST_REGEX)
+
namespace detail
{
@@ -896,4 +947,5 @@ namespace detail
streambuf_(streambuf),
match_condition_(match_condition),
+ start_(0),
search_position_(0),
handler_(BOOST_ASIO_MOVE_CAST(ReadHandler)(handler))
@@ -906,4 +958,5 @@ namespace detail
streambuf_(other.streambuf_),
match_condition_(other.match_condition_),
+ start_(other.start_),
search_position_(other.search_position_),
handler_(other.handler_)
@@ -915,4 +968,5 @@ namespace detail
streambuf_(other.streambuf_),
match_condition_(other.match_condition_),
+ start_(other.start_),
search_position_(other.search_position_),
handler_(BOOST_ASIO_MOVE_CAST(ReadHandler)(other.handler_))
@@ -926,5 +980,5 @@ namespace detail
const std::size_t not_found = (std::numeric_limits<std::size_t>::max)();
std::size_t bytes_to_read;
- switch (start)
+ switch (start_ = start)
{
case 1:
@@ -1005,4 +1059,5 @@ namespace detail
boost::asio::basic_streambuf<Allocator>& streambuf_;
MatchCondition match_condition_;
+ int start_;
std::size_t search_position_;
ReadHandler handler_;
@@ -1029,4 +1084,15 @@ namespace detail
}
+ template <typename AsyncReadStream, typename Allocator,
+ typename MatchCondition, typename ReadHandler>
+ inline bool asio_handler_is_continuation(
+ read_until_match_op<AsyncReadStream,
+ Allocator, MatchCondition, ReadHandler>* this_handler)
+ {
+ return this_handler->start_ == 0 ? true
+ : boost_asio_handler_cont_helpers::is_continuation(
+ this_handler->handler_);
+ }
+
template <typename Function, typename AsyncReadStream, typename Allocator,
typename MatchCondition, typename ReadHandler>
@@ -1048,25 +1114,14 @@ namespace detail
function, this_handler->handler_);
}
-
- template <typename AsyncReadStream, typename Allocator,
- typename MatchCondition, typename ReadHandler>
- inline read_until_match_op<AsyncReadStream, Allocator,
- MatchCondition, ReadHandler>
- make_read_until_match_op(AsyncReadStream& s,
- boost::asio::basic_streambuf<Allocator>& b,
- MatchCondition match_condition, ReadHandler handler)
- {
- return read_until_match_op<AsyncReadStream,
- Allocator, MatchCondition, ReadHandler>(
- s, b, match_condition, handler);
- }
} // namespace detail
template <typename AsyncReadStream, typename Allocator,
typename MatchCondition, typename ReadHandler>
-void async_read_until(AsyncReadStream& s,
+BOOST_ASIO_INITFN_RESULT_TYPE(ReadHandler,
+ void (boost::system::error_code, std::size_t))
+async_read_until(AsyncReadStream& s,
boost::asio::basic_streambuf<Allocator>& b,
MatchCondition match_condition, BOOST_ASIO_MOVE_ARG(ReadHandler) handler,
- typename boost::enable_if<is_match_condition<MatchCondition> >::type*)
+ typename enable_if<is_match_condition<MatchCondition>::value>::type*)
{
// If you get an error on the following line it means that your handler does
@@ -1074,7 +1129,15 @@ void async_read_until(AsyncReadStream& s,
BOOST_ASIO_READ_HANDLER_CHECK(ReadHandler, handler) type_check;
- detail::make_read_until_match_op(
- s, b, match_condition, BOOST_ASIO_MOVE_CAST(ReadHandler)(handler))(
- boost::system::error_code(), 0, 1);
+ detail::async_result_init<
+ ReadHandler, void (boost::system::error_code, std::size_t)> init(
+ BOOST_ASIO_MOVE_CAST(ReadHandler)(handler));
+
+ detail::read_until_match_op<AsyncReadStream, Allocator,
+ MatchCondition, BOOST_ASIO_HANDLER_TYPE(ReadHandler,
+ void (boost::system::error_code, std::size_t))>(
+ s, b, match_condition, init.handler)(
+ boost::system::error_code(), 0, 1);
+
+ return init.result.get();
}
diff --git a/3rdParty/Boost/src/boost/asio/impl/serial_port_base.hpp b/3rdParty/Boost/src/boost/asio/impl/serial_port_base.hpp
index 3066045..92be00d 100644
--- a/3rdParty/Boost/src/boost/asio/impl/serial_port_base.hpp
+++ b/3rdParty/Boost/src/boost/asio/impl/serial_port_base.hpp
@@ -3,5 +3,5 @@
// ~~~~~~~~~~~~~~~~~~~~~~~~~
//
-// Copyright (c) 2003-2012 Christopher M. Kohlhoff (chris at kohlhoff dot com)
+// Copyright (c) 2003-2014 Christopher M. Kohlhoff (chris at kohlhoff dot com)
// Copyright (c) 2008 Rep Invariant Systems, Inc. (info@repinvariant.com)
//
diff --git a/3rdParty/Boost/src/boost/asio/impl/serial_port_base.ipp b/3rdParty/Boost/src/boost/asio/impl/serial_port_base.ipp
index 0344fa5..51f66c1 100644
--- a/3rdParty/Boost/src/boost/asio/impl/serial_port_base.ipp
+++ b/3rdParty/Boost/src/boost/asio/impl/serial_port_base.ipp
@@ -3,5 +3,5 @@
// ~~~~~~~~~~~~~~~~~~~~~~~~~
//
-// Copyright (c) 2003-2012 Christopher M. Kohlhoff (chris at kohlhoff dot com)
+// Copyright (c) 2003-2014 Christopher M. Kohlhoff (chris at kohlhoff dot com)
// Copyright (c) 2008 Rep Invariant Systems, Inc. (info@repinvariant.com)
//
@@ -22,11 +22,11 @@
#include <stdexcept>
-#include <boost/throw_exception.hpp>
#include <boost/asio/error.hpp>
#include <boost/asio/serial_port_base.hpp>
+#include <boost/asio/detail/throw_exception.hpp>
#if defined(GENERATING_DOCUMENTATION)
# define BOOST_ASIO_OPTION_STORAGE implementation_defined
-#elif defined(BOOST_WINDOWS) || defined(__CYGWIN__)
+#elif defined(BOOST_ASIO_WINDOWS) || defined(__CYGWIN__)
# define BOOST_ASIO_OPTION_STORAGE DCB
#else
@@ -42,5 +42,5 @@ boost::system::error_code serial_port_base::baud_rate::store(
BOOST_ASIO_OPTION_STORAGE& storage, boost::system::error_code& ec) const
{
-#if defined(BOOST_WINDOWS) || defined(__CYGWIN__)
+#if defined(BOOST_ASIO_WINDOWS) || defined(__CYGWIN__)
storage.BaudRate = value_;
#else
@@ -112,5 +112,4 @@ boost::system::error_code serial_port_base::baud_rate::store(
# endif
default:
- baud = B0;
ec = boost::asio::error::invalid_argument;
return ec;
@@ -130,5 +129,5 @@ boost::system::error_code serial_port_base::baud_rate::load(
const BOOST_ASIO_OPTION_STORAGE& storage, boost::system::error_code& ec)
{
-#if defined(BOOST_WINDOWS) || defined(__CYGWIN__)
+#if defined(BOOST_ASIO_WINDOWS) || defined(__CYGWIN__)
value_ = storage.BaudRate;
#else
@@ -216,5 +215,5 @@ serial_port_base::flow_control::flow_control(
{
std::out_of_range ex("invalid flow_control value");
- boost::throw_exception(ex);
+ boost::asio::detail::throw_exception(ex);
}
}
@@ -223,5 +222,5 @@ boost::system::error_code serial_port_base::flow_control::store(
BOOST_ASIO_OPTION_STORAGE& storage, boost::system::error_code& ec) const
{
-#if defined(BOOST_WINDOWS) || defined(__CYGWIN__)
+#if defined(BOOST_ASIO_WINDOWS) || defined(__CYGWIN__)
storage.fOutxCtsFlow = FALSE;
storage.fOutxDsrFlow = FALSE;
@@ -290,5 +289,5 @@ boost::system::error_code serial_port_base::flow_control::load(
const BOOST_ASIO_OPTION_STORAGE& storage, boost::system::error_code& ec)
{
-#if defined(BOOST_WINDOWS) || defined(__CYGWIN__)
+#if defined(BOOST_ASIO_WINDOWS) || defined(__CYGWIN__)
if (storage.fOutX && storage.fInX)
{
@@ -334,5 +333,5 @@ serial_port_base::parity::parity(serial_port_base::parity::type t)
{
std::out_of_range ex("invalid parity value");
- boost::throw_exception(ex);
+ boost::asio::detail::throw_exception(ex);
}
}
@@ -341,5 +340,5 @@ boost::system::error_code serial_port_base::parity::store(
BOOST_ASIO_OPTION_STORAGE& storage, boost::system::error_code& ec) const
{
-#if defined(BOOST_WINDOWS) || defined(__CYGWIN__)
+#if defined(BOOST_ASIO_WINDOWS) || defined(__CYGWIN__)
switch (value_)
{
@@ -388,5 +387,5 @@ boost::system::error_code serial_port_base::parity::load(
const BOOST_ASIO_OPTION_STORAGE& storage, boost::system::error_code& ec)
{
-#if defined(BOOST_WINDOWS) || defined(__CYGWIN__)
+#if defined(BOOST_ASIO_WINDOWS) || defined(__CYGWIN__)
if (storage.Parity == EVENPARITY)
{
@@ -429,5 +428,5 @@ serial_port_base::stop_bits::stop_bits(
{
std::out_of_range ex("invalid stop_bits value");
- boost::throw_exception(ex);
+ boost::asio::detail::throw_exception(ex);
}
}
@@ -436,5 +435,5 @@ boost::system::error_code serial_port_base::stop_bits::store(
BOOST_ASIO_OPTION_STORAGE& storage, boost::system::error_code& ec) const
{
-#if defined(BOOST_WINDOWS) || defined(__CYGWIN__)
+#if defined(BOOST_ASIO_WINDOWS) || defined(__CYGWIN__)
switch (value_)
{
@@ -472,5 +471,5 @@ boost::system::error_code serial_port_base::stop_bits::load(
const BOOST_ASIO_OPTION_STORAGE& storage, boost::system::error_code& ec)
{
-#if defined(BOOST_WINDOWS) || defined(__CYGWIN__)
+#if defined(BOOST_ASIO_WINDOWS) || defined(__CYGWIN__)
if (storage.StopBits == ONESTOPBIT)
{
@@ -502,5 +501,5 @@ serial_port_base::character_size::character_size(unsigned int t)
{
std::out_of_range ex("invalid character_size value");
- boost::throw_exception(ex);
+ boost::asio::detail::throw_exception(ex);
}
}
@@ -509,5 +508,5 @@ boost::system::error_code serial_port_base::character_size::store(
BOOST_ASIO_OPTION_STORAGE& storage, boost::system::error_code& ec) const
{
-#if defined(BOOST_WINDOWS) || defined(__CYGWIN__)
+#if defined(BOOST_ASIO_WINDOWS) || defined(__CYGWIN__)
storage.ByteSize = value_;
#else
@@ -529,5 +528,5 @@ boost::system::error_code serial_port_base::character_size::load(
const BOOST_ASIO_OPTION_STORAGE& storage, boost::system::error_code& ec)
{
-#if defined(BOOST_WINDOWS) || defined(__CYGWIN__)
+#if defined(BOOST_ASIO_WINDOWS) || defined(__CYGWIN__)
value_ = storage.ByteSize;
#else
diff --git a/3rdParty/Boost/src/boost/asio/impl/write.hpp b/3rdParty/Boost/src/boost/asio/impl/write.hpp
index 61422e4..ef0c092 100644
--- a/3rdParty/Boost/src/boost/asio/impl/write.hpp
+++ b/3rdParty/Boost/src/boost/asio/impl/write.hpp
@@ -3,5 +3,5 @@
// ~~~~~~~~~~~~~~
//
-// Copyright (c) 2003-2012 Christopher M. Kohlhoff (chris at kohlhoff dot com)
+// Copyright (c) 2003-2014 Christopher M. Kohlhoff (chris at kohlhoff dot com)
//
// Distributed under the Boost Software License, Version 1.0. (See accompanying
@@ -24,4 +24,5 @@
#include <boost/asio/detail/dependent_type.hpp>
#include <boost/asio/detail/handler_alloc_helpers.hpp>
+#include <boost/asio/detail/handler_cont_helpers.hpp>
#include <boost/asio/detail/handler_invoke_helpers.hpp>
#include <boost/asio/detail/handler_type_requirements.hpp>
@@ -82,5 +83,5 @@ inline std::size_t write(SyncWriteStream& s, const ConstBufferSequence& buffers,
}
-#if !defined(BOOST_NO_IOSTREAM)
+#if !defined(BOOST_ASIO_NO_IOSTREAM)
template <typename SyncWriteStream, typename Allocator,
@@ -125,5 +126,5 @@ inline std::size_t write(SyncWriteStream& s,
}
-#endif // !defined(BOOST_NO_IOSTREAM)
+#endif // !defined(BOOST_ASIO_NO_IOSTREAM)
namespace detail
@@ -141,4 +142,5 @@ namespace detail
stream_(stream),
buffers_(buffers),
+ start_(0),
total_transferred_(0),
handler_(BOOST_ASIO_MOVE_CAST(WriteHandler)(handler))
@@ -151,4 +153,5 @@ namespace detail
stream_(other.stream_),
buffers_(other.buffers_),
+ start_(other.start_),
total_transferred_(other.total_transferred_),
handler_(other.handler_)
@@ -160,4 +163,5 @@ namespace detail
stream_(other.stream_),
buffers_(other.buffers_),
+ start_(other.start_),
total_transferred_(other.total_transferred_),
handler_(BOOST_ASIO_MOVE_CAST(WriteHandler)(other.handler_))
@@ -169,5 +173,5 @@ namespace detail
std::size_t bytes_transferred, int start = 0)
{
- switch (start)
+ switch (start_ = start)
{
case 1:
@@ -194,4 +198,5 @@ namespace detail
boost::asio::detail::consuming_buffers<
const_buffer, ConstBufferSequence> buffers_;
+ int start_;
std::size_t total_transferred_;
WriteHandler handler_;
@@ -213,4 +218,5 @@ namespace detail
stream_(stream),
buffer_(buffers),
+ start_(0),
total_transferred_(0),
handler_(BOOST_ASIO_MOVE_CAST(WriteHandler)(handler))
@@ -223,4 +229,5 @@ namespace detail
stream_(other.stream_),
buffer_(other.buffer_),
+ start_(other.start_),
total_transferred_(other.total_transferred_),
handler_(other.handler_)
@@ -232,4 +239,5 @@ namespace detail
stream_(other.stream_),
buffer_(other.buffer_),
+ start_(other.start_),
total_transferred_(other.total_transferred_),
handler_(BOOST_ASIO_MOVE_CAST(WriteHandler)(other.handler_))
@@ -242,5 +250,5 @@ namespace detail
{
std::size_t n = 0;
- switch (start)
+ switch (start_ = start)
{
case 1:
@@ -266,4 +274,5 @@ namespace detail
AsyncWriteStream& stream_;
boost::asio::mutable_buffer buffer_;
+ int start_;
std::size_t total_transferred_;
WriteHandler handler_;
@@ -285,4 +294,5 @@ namespace detail
stream_(stream),
buffer_(buffers),
+ start_(0),
total_transferred_(0),
handler_(BOOST_ASIO_MOVE_CAST(WriteHandler)(handler))
@@ -295,4 +305,5 @@ namespace detail
stream_(other.stream_),
buffer_(other.buffer_),
+ start_(other.start_),
total_transferred_(other.total_transferred_),
handler_(other.handler_)
@@ -304,4 +315,5 @@ namespace detail
stream_(other.stream_),
buffer_(other.buffer_),
+ start_(other.start_),
total_transferred_(other.total_transferred_),
handler_(BOOST_ASIO_MOVE_CAST(WriteHandler)(other.handler_))
@@ -314,5 +326,5 @@ namespace detail
{
std::size_t n = 0;
- switch (start)
+ switch (start_ = start)
{
case 1:
@@ -338,4 +350,5 @@ namespace detail
AsyncWriteStream& stream_;
boost::asio::const_buffer buffer_;
+ int start_;
std::size_t total_transferred_;
WriteHandler handler_;
@@ -355,4 +368,5 @@ namespace detail
stream_(stream),
buffers_(buffers),
+ start_(0),
total_transferred_(0),
handler_(BOOST_ASIO_MOVE_CAST(WriteHandler)(handler))
@@ -365,4 +379,5 @@ namespace detail
stream_(other.stream_),
buffers_(other.buffers_),
+ start_(other.start_),
total_transferred_(other.total_transferred_),
handler_(other.handler_)
@@ -374,4 +389,5 @@ namespace detail
stream_(other.stream_),
buffers_(other.buffers_),
+ start_(other.start_),
total_transferred_(other.total_transferred_),
handler_(BOOST_ASIO_MOVE_CAST(WriteHandler)(other.handler_))
@@ -390,5 +406,5 @@ namespace detail
std::size_t buffer_size1 = boost::asio::buffer_size(bufs[1]);
std::size_t n = 0;
- switch (start)
+ switch (start_ = start)
{
case 1:
@@ -417,4 +433,5 @@ namespace detail
AsyncWriteStream& stream_;
boost::array<Elem, 2> buffers_;
+ int start_;
std::size_t total_transferred_;
WriteHandler handler_;
@@ -436,4 +453,5 @@ namespace detail
stream_(stream),
buffers_(buffers),
+ start_(0),
total_transferred_(0),
handler_(BOOST_ASIO_MOVE_CAST(WriteHandler)(handler))
@@ -446,4 +464,5 @@ namespace detail
stream_(other.stream_),
buffers_(other.buffers_),
+ start_(other.start_),
total_transferred_(other.total_transferred_),
handler_(other.handler_)
@@ -455,4 +474,5 @@ namespace detail
stream_(other.stream_),
buffers_(other.buffers_),
+ start_(other.start_),
total_transferred_(other.total_transferred_),
handler_(BOOST_ASIO_MOVE_CAST(WriteHandler)(other.handler_))
@@ -471,5 +491,5 @@ namespace detail
std::size_t buffer_size1 = boost::asio::buffer_size(bufs[1]);
std::size_t n = 0;
- switch (start)
+ switch (start_ = start)
{
case 1:
@@ -498,4 +518,5 @@ namespace detail
AsyncWriteStream& stream_;
std::array<Elem, 2> buffers_;
+ int start_;
std::size_t total_transferred_;
WriteHandler handler_;
@@ -524,4 +545,15 @@ namespace detail
}
+ template <typename AsyncWriteStream, typename ConstBufferSequence,
+ typename CompletionCondition, typename WriteHandler>
+ inline bool asio_handler_is_continuation(
+ write_op<AsyncWriteStream, ConstBufferSequence,
+ CompletionCondition, WriteHandler>* this_handler)
+ {
+ return this_handler->start_ == 0 ? true
+ : boost_asio_handler_cont_helpers::is_continuation(
+ this_handler->handler_);
+ }
+
template <typename Function, typename AsyncWriteStream,
typename ConstBufferSequence, typename CompletionCondition,
@@ -545,20 +577,11 @@ namespace detail
function, this_handler->handler_);
}
-
- template <typename AsyncWriteStream, typename ConstBufferSequence,
- typename CompletionCondition, typename WriteHandler>
- inline write_op<AsyncWriteStream, ConstBufferSequence,
- CompletionCondition, WriteHandler>
- make_write_op(AsyncWriteStream& s, const ConstBufferSequence& buffers,
- CompletionCondition completion_condition, WriteHandler handler)
- {
- return write_op<AsyncWriteStream, ConstBufferSequence, CompletionCondition,
- WriteHandler>(s, buffers, completion_condition, handler);
- }
} // namespace detail
template <typename AsyncWriteStream, typename ConstBufferSequence,
typename CompletionCondition, typename WriteHandler>
-inline void async_write(AsyncWriteStream& s, const ConstBufferSequence& buffers,
+inline BOOST_ASIO_INITFN_RESULT_TYPE(WriteHandler,
+ void (boost::system::error_code, std::size_t))
+async_write(AsyncWriteStream& s, const ConstBufferSequence& buffers,
CompletionCondition completion_condition,
BOOST_ASIO_MOVE_ARG(WriteHandler) handler)
@@ -568,13 +591,22 @@ inline void async_write(AsyncWriteStream& s, const ConstBufferSequence& buffers,
BOOST_ASIO_WRITE_HANDLER_CHECK(WriteHandler, handler) type_check;
- detail::make_write_op(
- s, buffers, completion_condition,
- BOOST_ASIO_MOVE_CAST(WriteHandler)(handler))(
- boost::system::error_code(), 0, 1);
+ detail::async_result_init<
+ WriteHandler, void (boost::system::error_code, std::size_t)> init(
+ BOOST_ASIO_MOVE_CAST(WriteHandler)(handler));
+
+ detail::write_op<AsyncWriteStream, ConstBufferSequence,
+ CompletionCondition, BOOST_ASIO_HANDLER_TYPE(
+ WriteHandler, void (boost::system::error_code, std::size_t))>(
+ s, buffers, completion_condition, init.handler)(
+ boost::system::error_code(), 0, 1);
+
+ return init.result.get();
}
template <typename AsyncWriteStream, typename ConstBufferSequence,
typename WriteHandler>
-inline void async_write(AsyncWriteStream& s, const ConstBufferSequence& buffers,
+inline BOOST_ASIO_INITFN_RESULT_TYPE(WriteHandler,
+ void (boost::system::error_code, std::size_t))
+async_write(AsyncWriteStream& s, const ConstBufferSequence& buffers,
BOOST_ASIO_MOVE_ARG(WriteHandler) handler)
{
@@ -583,10 +615,18 @@ inline void async_write(AsyncWriteStream& s, const ConstBufferSequence& buffers,
BOOST_ASIO_WRITE_HANDLER_CHECK(WriteHandler, handler) type_check;
- detail::make_write_op(
- s, buffers, transfer_all(), BOOST_ASIO_MOVE_CAST(WriteHandler)(handler))(
- boost::system::error_code(), 0, 1);
+ detail::async_result_init<
+ WriteHandler, void (boost::system::error_code, std::size_t)> init(
+ BOOST_ASIO_MOVE_CAST(WriteHandler)(handler));
+
+ detail::write_op<AsyncWriteStream, ConstBufferSequence,
+ detail::transfer_all_t, BOOST_ASIO_HANDLER_TYPE(
+ WriteHandler, void (boost::system::error_code, std::size_t))>(
+ s, buffers, transfer_all(), init.handler)(
+ boost::system::error_code(), 0, 1);
+
+ return init.result.get();
}
-#if !defined(BOOST_NO_IOSTREAM)
+#if !defined(BOOST_ASIO_NO_IOSTREAM)
namespace detail
@@ -645,4 +685,12 @@ namespace detail
}
+ template <typename Allocator, typename WriteHandler>
+ inline bool asio_handler_is_continuation(
+ write_streambuf_handler<Allocator, WriteHandler>* this_handler)
+ {
+ return boost_asio_handler_cont_helpers::is_continuation(
+ this_handler->handler_);
+ }
+
template <typename Function, typename Allocator, typename WriteHandler>
inline void asio_handler_invoke(Function& function,
@@ -660,17 +708,11 @@ namespace detail
function, this_handler->handler_);
}
-
- template <typename Allocator, typename WriteHandler>
- inline write_streambuf_handler<Allocator, WriteHandler>
- make_write_streambuf_handler(
- boost::asio::basic_streambuf<Allocator>& b, WriteHandler handler)
- {
- return write_streambuf_handler<Allocator, WriteHandler>(b, handler);
- }
} // namespace detail
template <typename AsyncWriteStream, typename Allocator,
typename CompletionCondition, typename WriteHandler>
-inline void async_write(AsyncWriteStream& s,
+inline BOOST_ASIO_INITFN_RESULT_TYPE(WriteHandler,
+ void (boost::system::error_code, std::size_t))
+async_write(AsyncWriteStream& s,
boost::asio::basic_streambuf<Allocator>& b,
CompletionCondition completion_condition,
@@ -681,11 +723,20 @@ inline void async_write(AsyncWriteStream& s,
BOOST_ASIO_WRITE_HANDLER_CHECK(WriteHandler, handler) type_check;
+ detail::async_result_init<
+ WriteHandler, void (boost::system::error_code, std::size_t)> init(
+ BOOST_ASIO_MOVE_CAST(WriteHandler)(handler));
+
async_write(s, b.data(), completion_condition,
- detail::make_write_streambuf_handler(
- b, BOOST_ASIO_MOVE_CAST(WriteHandler)(handler)));
+ detail::write_streambuf_handler<Allocator, BOOST_ASIO_HANDLER_TYPE(
+ WriteHandler, void (boost::system::error_code, std::size_t))>(
+ b, init.handler));
+
+ return init.result.get();
}
template <typename AsyncWriteStream, typename Allocator, typename WriteHandler>
-inline void async_write(AsyncWriteStream& s,
+inline BOOST_ASIO_INITFN_RESULT_TYPE(WriteHandler,
+ void (boost::system::error_code, std::size_t))
+async_write(AsyncWriteStream& s,
boost::asio::basic_streambuf<Allocator>& b,
BOOST_ASIO_MOVE_ARG(WriteHandler) handler)
@@ -695,10 +746,17 @@ inline void async_write(AsyncWriteStream& s,
BOOST_ASIO_WRITE_HANDLER_CHECK(WriteHandler, handler) type_check;
+ detail::async_result_init<
+ WriteHandler, void (boost::system::error_code, std::size_t)> init(
+ BOOST_ASIO_MOVE_CAST(WriteHandler)(handler));
+
async_write(s, b.data(), transfer_all(),
- detail::make_write_streambuf_handler(
- b, BOOST_ASIO_MOVE_CAST(WriteHandler)(handler)));
+ detail::write_streambuf_handler<Allocator, BOOST_ASIO_HANDLER_TYPE(
+ WriteHandler, void (boost::system::error_code, std::size_t))>(
+ b, init.handler));
+
+ return init.result.get();
}
-#endif // !defined(BOOST_NO_IOSTREAM)
+#endif // !defined(BOOST_ASIO_NO_IOSTREAM)
} // namespace asio
diff --git a/3rdParty/Boost/src/boost/asio/impl/write_at.hpp b/3rdParty/Boost/src/boost/asio/impl/write_at.hpp
index acba02f..0d0dc4b 100644
--- a/3rdParty/Boost/src/boost/asio/impl/write_at.hpp
+++ b/3rdParty/Boost/src/boost/asio/impl/write_at.hpp
@@ -3,5 +3,5 @@
// ~~~~~~~~~~~~~~~~~
//
-// Copyright (c) 2003-2012 Christopher M. Kohlhoff (chris at kohlhoff dot com)
+// Copyright (c) 2003-2014 Christopher M. Kohlhoff (chris at kohlhoff dot com)
//
// Distributed under the Boost Software License, Version 1.0. (See accompanying
@@ -24,4 +24,5 @@
#include <boost/asio/detail/dependent_type.hpp>
#include <boost/asio/detail/handler_alloc_helpers.hpp>
+#include <boost/asio/detail/handler_cont_helpers.hpp>
#include <boost/asio/detail/handler_invoke_helpers.hpp>
#include <boost/asio/detail/handler_type_requirements.hpp>
@@ -36,5 +37,5 @@ template <typename SyncRandomAccessWriteDevice, typename ConstBufferSequence,
typename CompletionCondition>
std::size_t write_at(SyncRandomAccessWriteDevice& d,
- boost::uint64_t offset, const ConstBufferSequence& buffers,
+ uint64_t offset, const ConstBufferSequence& buffers,
CompletionCondition completion_condition, boost::system::error_code& ec)
{
@@ -59,5 +60,5 @@ std::size_t write_at(SyncRandomAccessWriteDevice& d,
template <typename SyncRandomAccessWriteDevice, typename ConstBufferSequence>
inline std::size_t write_at(SyncRandomAccessWriteDevice& d,
- boost::uint64_t offset, const ConstBufferSequence& buffers)
+ uint64_t offset, const ConstBufferSequence& buffers)
{
boost::system::error_code ec;
@@ -70,5 +71,5 @@ inline std::size_t write_at(SyncRandomAccessWriteDevice& d,
template <typename SyncRandomAccessWriteDevice, typename ConstBufferSequence>
inline std::size_t write_at(SyncRandomAccessWriteDevice& d,
- boost::uint64_t offset, const ConstBufferSequence& buffers,
+ uint64_t offset, const ConstBufferSequence& buffers,
boost::system::error_code& ec)
{
@@ -79,5 +80,5 @@ template <typename SyncRandomAccessWriteDevice, typename ConstBufferSequence,
typename CompletionCondition>
inline std::size_t write_at(SyncRandomAccessWriteDevice& d,
- boost::uint64_t offset, const ConstBufferSequence& buffers,
+ uint64_t offset, const ConstBufferSequence& buffers,
CompletionCondition completion_condition)
{
@@ -89,10 +90,10 @@ inline std::size_t write_at(SyncRandomAccessWriteDevice& d,
}
-#if !defined(BOOST_NO_IOSTREAM)
+#if !defined(BOOST_ASIO_NO_IOSTREAM)
template <typename SyncRandomAccessWriteDevice, typename Allocator,
typename CompletionCondition>
std::size_t write_at(SyncRandomAccessWriteDevice& d,
- boost::uint64_t offset, boost::asio::basic_streambuf<Allocator>& b,
+ uint64_t offset, boost::asio::basic_streambuf<Allocator>& b,
CompletionCondition completion_condition, boost::system::error_code& ec)
{
@@ -105,5 +106,5 @@ std::size_t write_at(SyncRandomAccessWriteDevice& d,
template <typename SyncRandomAccessWriteDevice, typename Allocator>
inline std::size_t write_at(SyncRandomAccessWriteDevice& d,
- boost::uint64_t offset, boost::asio::basic_streambuf<Allocator>& b)
+ uint64_t offset, boost::asio::basic_streambuf<Allocator>& b)
{
boost::system::error_code ec;
@@ -115,5 +116,5 @@ inline std::size_t write_at(SyncRandomAccessWriteDevice& d,
template <typename SyncRandomAccessWriteDevice, typename Allocator>
inline std::size_t write_at(SyncRandomAccessWriteDevice& d,
- boost::uint64_t offset, boost::asio::basic_streambuf<Allocator>& b,
+ uint64_t offset, boost::asio::basic_streambuf<Allocator>& b,
boost::system::error_code& ec)
{
@@ -124,5 +125,5 @@ template <typename SyncRandomAccessWriteDevice, typename Allocator,
typename CompletionCondition>
inline std::size_t write_at(SyncRandomAccessWriteDevice& d,
- boost::uint64_t offset, boost::asio::basic_streambuf<Allocator>& b,
+ uint64_t offset, boost::asio::basic_streambuf<Allocator>& b,
CompletionCondition completion_condition)
{
@@ -134,5 +135,5 @@ inline std::size_t write_at(SyncRandomAccessWriteDevice& d,
}
-#endif // !defined(BOOST_NO_IOSTREAM)
+#endif // !defined(BOOST_ASIO_NO_IOSTREAM)
namespace detail
@@ -145,5 +146,5 @@ namespace detail
public:
write_at_op(AsyncRandomAccessWriteDevice& device,
- boost::uint64_t offset, const ConstBufferSequence& buffers,
+ uint64_t offset, const ConstBufferSequence& buffers,
CompletionCondition completion_condition, WriteHandler& handler)
: detail::base_from_completion_cond<
@@ -152,4 +153,5 @@ namespace detail
offset_(offset),
buffers_(buffers),
+ start_(0),
total_transferred_(0),
handler_(BOOST_ASIO_MOVE_CAST(WriteHandler)(handler))
@@ -163,4 +165,5 @@ namespace detail
offset_(other.offset_),
buffers_(other.buffers_),
+ start_(other.start_),
total_transferred_(other.total_transferred_),
handler_(other.handler_)
@@ -173,4 +176,5 @@ namespace detail
offset_(other.offset_),
buffers_(other.buffers_),
+ start_(other.start_),
total_transferred_(other.total_transferred_),
handler_(BOOST_ASIO_MOVE_CAST(WriteHandler)(other.handler_))
@@ -182,5 +186,5 @@ namespace detail
std::size_t bytes_transferred, int start = 0)
{
- switch (start)
+ switch (start_ = start)
{
case 1:
@@ -206,7 +210,8 @@ namespace detail
//private:
AsyncRandomAccessWriteDevice& device_;
- boost::uint64_t offset_;
+ uint64_t offset_;
boost::asio::detail::consuming_buffers<
const_buffer, ConstBufferSequence> buffers_;
+ int start_;
std::size_t total_transferred_;
WriteHandler handler_;
@@ -221,5 +226,5 @@ namespace detail
public:
write_at_op(AsyncRandomAccessWriteDevice& device,
- boost::uint64_t offset, const boost::asio::mutable_buffers_1& buffers,
+ uint64_t offset, const boost::asio::mutable_buffers_1& buffers,
CompletionCondition completion_condition,
WriteHandler& handler)
@@ -229,4 +234,5 @@ namespace detail
offset_(offset),
buffer_(buffers),
+ start_(0),
total_transferred_(0),
handler_(BOOST_ASIO_MOVE_CAST(WriteHandler)(handler))
@@ -240,4 +246,5 @@ namespace detail
offset_(other.offset_),
buffer_(other.buffer_),
+ start_(other.start_),
total_transferred_(other.total_transferred_),
handler_(other.handler_)
@@ -250,4 +257,5 @@ namespace detail
offset_(other.offset_),
buffer_(other.buffer_),
+ start_(other.start_),
total_transferred_(other.total_transferred_),
handler_(BOOST_ASIO_MOVE_CAST(WriteHandler)(other.handler_))
@@ -260,5 +268,5 @@ namespace detail
{
std::size_t n = 0;
- switch (start)
+ switch (start_ = start)
{
case 1:
@@ -283,6 +291,7 @@ namespace detail
//private:
AsyncRandomAccessWriteDevice& device_;
- boost::uint64_t offset_;
+ uint64_t offset_;
boost::asio::mutable_buffer buffer_;
+ int start_;
std::size_t total_transferred_;
WriteHandler handler_;
@@ -297,5 +306,5 @@ namespace detail
public:
write_at_op(AsyncRandomAccessWriteDevice& device,
- boost::uint64_t offset, const boost::asio::const_buffers_1& buffers,
+ uint64_t offset, const boost::asio::const_buffers_1& buffers,
CompletionCondition completion_condition,
WriteHandler& handler)
@@ -305,4 +314,5 @@ namespace detail
offset_(offset),
buffer_(buffers),
+ start_(0),
total_transferred_(0),
handler_(BOOST_ASIO_MOVE_CAST(WriteHandler)(handler))
@@ -316,4 +326,5 @@ namespace detail
offset_(other.offset_),
buffer_(other.buffer_),
+ start_(other.start_),
total_transferred_(other.total_transferred_),
handler_(other.handler_)
@@ -326,4 +337,5 @@ namespace detail
offset_(other.offset_),
buffer_(other.buffer_),
+ start_(other.start_),
total_transferred_(other.total_transferred_),
handler_(BOOST_ASIO_MOVE_CAST(WriteHandler)(other.handler_))
@@ -336,5 +348,5 @@ namespace detail
{
std::size_t n = 0;
- switch (start)
+ switch (start_ = start)
{
case 1:
@@ -359,6 +371,7 @@ namespace detail
//private:
AsyncRandomAccessWriteDevice& device_;
- boost::uint64_t offset_;
+ uint64_t offset_;
boost::asio::const_buffer buffer_;
+ int start_;
std::size_t total_transferred_;
WriteHandler handler_;
@@ -373,5 +386,5 @@ namespace detail
public:
write_at_op(AsyncRandomAccessWriteDevice& device,
- boost::uint64_t offset, const boost::array<Elem, 2>& buffers,
+ uint64_t offset, const boost::array<Elem, 2>& buffers,
CompletionCondition completion_condition, WriteHandler& handler)
: detail::base_from_completion_cond<
@@ -380,4 +393,5 @@ namespace detail
offset_(offset),
buffers_(buffers),
+ start_(0),
total_transferred_(0),
handler_(BOOST_ASIO_MOVE_CAST(WriteHandler)(handler))
@@ -391,4 +405,5 @@ namespace detail
offset_(other.offset_),
buffers_(other.buffers_),
+ start_(other.start_),
total_transferred_(other.total_transferred_),
handler_(other.handler_)
@@ -401,4 +416,5 @@ namespace detail
offset_(other.offset_),
buffers_(other.buffers_),
+ start_(other.start_),
total_transferred_(other.total_transferred_),
handler_(BOOST_ASIO_MOVE_CAST(WriteHandler)(other.handler_))
@@ -417,5 +433,5 @@ namespace detail
std::size_t buffer_size1 = boost::asio::buffer_size(bufs[1]);
std::size_t n = 0;
- switch (start)
+ switch (start_ = start)
{
case 1:
@@ -444,6 +460,7 @@ namespace detail
//private:
AsyncRandomAccessWriteDevice& device_;
- boost::uint64_t offset_;
+ uint64_t offset_;
boost::array<Elem, 2> buffers_;
+ int start_;
std::size_t total_transferred_;
WriteHandler handler_;
@@ -460,5 +477,5 @@ namespace detail
public:
write_at_op(AsyncRandomAccessWriteDevice& device,
- boost::uint64_t offset, const std::array<Elem, 2>& buffers,
+ uint64_t offset, const std::array<Elem, 2>& buffers,
CompletionCondition completion_condition, WriteHandler& handler)
: detail::base_from_completion_cond<
@@ -467,4 +484,5 @@ namespace detail
offset_(offset),
buffers_(buffers),
+ start_(0),
total_transferred_(0),
handler_(BOOST_ASIO_MOVE_CAST(WriteHandler)(handler))
@@ -478,4 +496,5 @@ namespace detail
offset_(other.offset_),
buffers_(other.buffers_),
+ start_(other.start_),
total_transferred_(other.total_transferred_),
handler_(other.handler_)
@@ -488,4 +507,5 @@ namespace detail
offset_(other.offset_),
buffers_(other.buffers_),
+ start_(other.start_),
total_transferred_(other.total_transferred_),
handler_(BOOST_ASIO_MOVE_CAST(WriteHandler)(other.handler_))
@@ -504,5 +524,5 @@ namespace detail
std::size_t buffer_size1 = boost::asio::buffer_size(bufs[1]);
std::size_t n = 0;
- switch (start)
+ switch (start_ = start)
{
case 1:
@@ -531,6 +551,7 @@ namespace detail
//private:
AsyncRandomAccessWriteDevice& device_;
- boost::uint64_t offset_;
+ uint64_t offset_;
std::array<Elem, 2> buffers_;
+ int start_;
std::size_t total_transferred_;
WriteHandler handler_;
@@ -559,4 +580,15 @@ namespace detail
}
+ template <typename AsyncRandomAccessWriteDevice, typename ConstBufferSequence,
+ typename CompletionCondition, typename WriteHandler>
+ inline bool asio_handler_is_continuation(
+ write_at_op<AsyncRandomAccessWriteDevice, ConstBufferSequence,
+ CompletionCondition, WriteHandler>* this_handler)
+ {
+ return this_handler->start_ == 0 ? true
+ : boost_asio_handler_cont_helpers::is_continuation(
+ this_handler->handler_);
+ }
+
template <typename Function, typename AsyncRandomAccessWriteDevice,
typename ConstBufferSequence, typename CompletionCondition,
@@ -586,5 +618,5 @@ namespace detail
ConstBufferSequence, CompletionCondition, WriteHandler>
make_write_at_op(AsyncRandomAccessWriteDevice& d,
- boost::uint64_t offset, const ConstBufferSequence& buffers,
+ uint64_t offset, const ConstBufferSequence& buffers,
CompletionCondition completion_condition, WriteHandler handler)
{
@@ -597,6 +629,8 @@ namespace detail
template <typename AsyncRandomAccessWriteDevice, typename ConstBufferSequence,
typename CompletionCondition, typename WriteHandler>
-inline void async_write_at(AsyncRandomAccessWriteDevice& d,
- boost::uint64_t offset, const ConstBufferSequence& buffers,
+inline BOOST_ASIO_INITFN_RESULT_TYPE(WriteHandler,
+ void (boost::system::error_code, std::size_t))
+async_write_at(AsyncRandomAccessWriteDevice& d,
+ uint64_t offset, const ConstBufferSequence& buffers,
CompletionCondition completion_condition,
BOOST_ASIO_MOVE_ARG(WriteHandler) handler)
@@ -606,14 +640,23 @@ inline void async_write_at(AsyncRandomAccessWriteDevice& d,
BOOST_ASIO_WRITE_HANDLER_CHECK(WriteHandler, handler) type_check;
- detail::make_write_at_op(
- d, offset, buffers, completion_condition,
- BOOST_ASIO_MOVE_CAST(WriteHandler)(handler))(
- boost::system::error_code(), 0, 1);
+ detail::async_result_init<
+ WriteHandler, void (boost::system::error_code, std::size_t)> init(
+ BOOST_ASIO_MOVE_CAST(WriteHandler)(handler));
+
+ detail::write_at_op<AsyncRandomAccessWriteDevice, ConstBufferSequence,
+ CompletionCondition, BOOST_ASIO_HANDLER_TYPE(
+ WriteHandler, void (boost::system::error_code, std::size_t))>(
+ d, offset, buffers, completion_condition, init.handler)(
+ boost::system::error_code(), 0, 1);
+
+ return init.result.get();
}
template <typename AsyncRandomAccessWriteDevice, typename ConstBufferSequence,
typename WriteHandler>
-inline void async_write_at(AsyncRandomAccessWriteDevice& d,
- boost::uint64_t offset, const ConstBufferSequence& buffers,
+inline BOOST_ASIO_INITFN_RESULT_TYPE(WriteHandler,
+ void (boost::system::error_code, std::size_t))
+async_write_at(AsyncRandomAccessWriteDevice& d,
+ uint64_t offset, const ConstBufferSequence& buffers,
BOOST_ASIO_MOVE_ARG(WriteHandler) handler)
{
@@ -622,11 +665,18 @@ inline void async_write_at(AsyncRandomAccessWriteDevice& d,
BOOST_ASIO_WRITE_HANDLER_CHECK(WriteHandler, handler) type_check;
- detail::make_write_at_op(
- d, offset, buffers, transfer_all(),
- BOOST_ASIO_MOVE_CAST(WriteHandler)(handler))(
- boost::system::error_code(), 0, 1);
+ detail::async_result_init<
+ WriteHandler, void (boost::system::error_code, std::size_t)> init(
+ BOOST_ASIO_MOVE_CAST(WriteHandler)(handler));
+
+ detail::write_at_op<AsyncRandomAccessWriteDevice, ConstBufferSequence,
+ detail::transfer_all_t, BOOST_ASIO_HANDLER_TYPE(
+ WriteHandler, void (boost::system::error_code, std::size_t))>(
+ d, offset, buffers, transfer_all(), init.handler)(
+ boost::system::error_code(), 0, 1);
+
+ return init.result.get();
}
-#if !defined(BOOST_NO_IOSTREAM)
+#if !defined(BOOST_ASIO_NO_IOSTREAM)
namespace detail
@@ -686,4 +736,12 @@ namespace detail
}
+ template <typename Allocator, typename WriteHandler>
+ inline bool asio_handler_is_continuation(
+ write_at_streambuf_op<Allocator, WriteHandler>* this_handler)
+ {
+ return boost_asio_handler_cont_helpers::is_continuation(
+ this_handler->handler_);
+ }
+
template <typename Function, typename Allocator, typename WriteHandler>
inline void asio_handler_invoke(Function& function,
@@ -713,6 +771,8 @@ namespace detail
template <typename AsyncRandomAccessWriteDevice, typename Allocator,
typename CompletionCondition, typename WriteHandler>
-inline void async_write_at(AsyncRandomAccessWriteDevice& d,
- boost::uint64_t offset, boost::asio::basic_streambuf<Allocator>& b,
+inline BOOST_ASIO_INITFN_RESULT_TYPE(WriteHandler,
+ void (boost::system::error_code, std::size_t))
+async_write_at(AsyncRandomAccessWriteDevice& d,
+ uint64_t offset, boost::asio::basic_streambuf<Allocator>& b,
CompletionCondition completion_condition,
BOOST_ASIO_MOVE_ARG(WriteHandler) handler)
@@ -722,13 +782,22 @@ inline void async_write_at(AsyncRandomAccessWriteDevice& d,
BOOST_ASIO_WRITE_HANDLER_CHECK(WriteHandler, handler) type_check;
+ detail::async_result_init<
+ WriteHandler, void (boost::system::error_code, std::size_t)> init(
+ BOOST_ASIO_MOVE_CAST(WriteHandler)(handler));
+
async_write_at(d, offset, b.data(), completion_condition,
- detail::make_write_at_streambuf_op(
- b, BOOST_ASIO_MOVE_CAST(WriteHandler)(handler)));
+ detail::write_at_streambuf_op<Allocator, BOOST_ASIO_HANDLER_TYPE(
+ WriteHandler, void (boost::system::error_code, std::size_t))>(
+ b, init.handler));
+
+ return init.result.get();
}
template <typename AsyncRandomAccessWriteDevice, typename Allocator,
typename WriteHandler>
-inline void async_write_at(AsyncRandomAccessWriteDevice& d,
- boost::uint64_t offset, boost::asio::basic_streambuf<Allocator>& b,
+inline BOOST_ASIO_INITFN_RESULT_TYPE(WriteHandler,
+ void (boost::system::error_code, std::size_t))
+async_write_at(AsyncRandomAccessWriteDevice& d,
+ uint64_t offset, boost::asio::basic_streambuf<Allocator>& b,
BOOST_ASIO_MOVE_ARG(WriteHandler) handler)
{
@@ -737,10 +806,17 @@ inline void async_write_at(AsyncRandomAccessWriteDevice& d,
BOOST_ASIO_WRITE_HANDLER_CHECK(WriteHandler, handler) type_check;
+ detail::async_result_init<
+ WriteHandler, void (boost::system::error_code, std::size_t)> init(
+ BOOST_ASIO_MOVE_CAST(WriteHandler)(handler));
+
async_write_at(d, offset, b.data(), transfer_all(),
- detail::make_write_at_streambuf_op(
- b, BOOST_ASIO_MOVE_CAST(WriteHandler)(handler)));
+ detail::write_at_streambuf_op<Allocator, BOOST_ASIO_HANDLER_TYPE(
+ WriteHandler, void (boost::system::error_code, std::size_t))>(
+ b, init.handler));
+
+ return init.result.get();
}
-#endif // !defined(BOOST_NO_IOSTREAM)
+#endif // !defined(BOOST_ASIO_NO_IOSTREAM)
} // namespace asio