From 0d1d5016b57c59817fa0619e5cf4c6df046b28c3 Mon Sep 17 00:00:00 2001 From: Mark Benvenuto Date: Fri, 15 Aug 2014 17:06:16 -0400 Subject: SERVER-8994: Boost 1.56.0 Initial import of source Libraries: algorithm array asio bind chrono config container date_time filesystem function integer intrusive noncopyable optional program_options random smart_ptr static_assert thread unordered utility --- .../asio/detail/impl/buffer_sequence_adapter.ipp | 120 +++++++++++++++++++++ 1 file changed, 120 insertions(+) create mode 100644 src/third_party/boost-1.56.0/boost/asio/detail/impl/buffer_sequence_adapter.ipp (limited to 'src/third_party/boost-1.56.0/boost/asio/detail/impl/buffer_sequence_adapter.ipp') diff --git a/src/third_party/boost-1.56.0/boost/asio/detail/impl/buffer_sequence_adapter.ipp b/src/third_party/boost-1.56.0/boost/asio/detail/impl/buffer_sequence_adapter.ipp new file mode 100644 index 00000000000..a538134b9e2 --- /dev/null +++ b/src/third_party/boost-1.56.0/boost/asio/detail/impl/buffer_sequence_adapter.ipp @@ -0,0 +1,120 @@ +// +// detail/impl/buffer_sequence_adapter.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_DETAIL_IMPL_BUFFER_SEQUENCE_ADAPTER_IPP +#define BOOST_ASIO_DETAIL_IMPL_BUFFER_SEQUENCE_ADAPTER_IPP + +#if defined(_MSC_VER) && (_MSC_VER >= 1200) +# pragma once +#endif // defined(_MSC_VER) && (_MSC_VER >= 1200) + +#include + +#if defined(BOOST_ASIO_WINDOWS_RUNTIME) + +#include +#include +#include +#include + +#include + +namespace boost { +namespace asio { +namespace detail { + +class winrt_buffer_impl : + public Microsoft::WRL::RuntimeClass< + Microsoft::WRL::RuntimeClassFlags< + Microsoft::WRL::RuntimeClassType::WinRtClassicComMix>, + ABI::Windows::Storage::Streams::IBuffer, + Windows::Storage::Streams::IBufferByteAccess> +{ +public: + explicit winrt_buffer_impl(const boost::asio::const_buffer& b) + { + bytes_ = const_cast(boost::asio::buffer_cast(b)); + length_ = boost::asio::buffer_size(b); + capacity_ = boost::asio::buffer_size(b); + } + + explicit winrt_buffer_impl(const boost::asio::mutable_buffer& b) + { + bytes_ = const_cast(boost::asio::buffer_cast(b)); + length_ = 0; + capacity_ = boost::asio::buffer_size(b); + } + + ~winrt_buffer_impl() + { + } + + STDMETHODIMP Buffer(byte** value) + { + *value = bytes_; + return S_OK; + } + + STDMETHODIMP get_Capacity(UINT32* value) + { + *value = capacity_; + return S_OK; + } + + STDMETHODIMP get_Length(UINT32 *value) + { + *value = length_; + return S_OK; + } + + STDMETHODIMP put_Length(UINT32 value) + { + if (value > capacity_) + return E_INVALIDARG; + length_ = value; + return S_OK; + } + +private: + byte* bytes_; + UINT32 length_; + UINT32 capacity_; +}; + +void buffer_sequence_adapter_base::init_native_buffer( + buffer_sequence_adapter_base::native_buffer_type& buf, + const boost::asio::mutable_buffer& buffer) +{ + std::memset(&buf, 0, sizeof(native_buffer_type)); + Microsoft::WRL::ComPtr insp + = Microsoft::WRL::Make(buffer); + buf = reinterpret_cast(insp.Get()); +} + +void buffer_sequence_adapter_base::init_native_buffer( + buffer_sequence_adapter_base::native_buffer_type& buf, + const boost::asio::const_buffer& buffer) +{ + std::memset(&buf, 0, sizeof(native_buffer_type)); + Microsoft::WRL::ComPtr insp + = Microsoft::WRL::Make(buffer); + Platform::Object^ buf_obj = reinterpret_cast(insp.Get()); + buf = reinterpret_cast(insp.Get()); +} + +} // namespace detail +} // namespace asio +} // namespace boost + +#include + +#endif // defined(BOOST_ASIO_WINDOWS_RUNTIME) + +#endif // BOOST_ASIO_DETAIL_IMPL_BUFFER_SEQUENCE_ADAPTER_IPP -- cgit v1.2.1