11 #ifndef ASIO_DETAIL_BUFFER_SEQUENCE_ADAPTER_HPP 12 #define ASIO_DETAIL_BUFFER_SEQUENCE_ADAPTER_HPP 14 #if defined(_MSC_VER) && (_MSC_VER >= 1200) 16 #endif // defined(_MSC_VER) && (_MSC_VER >= 1200) 31 #if defined(ASIO_WINDOWS_RUNTIME) 33 enum { max_buffers = 1 };
38 native_buffer_type&
buf,
42 native_buffer_type& buf,
44 #elif defined(ASIO_WINDOWS) || defined(__CYGWIN__) 63 #else // defined(ASIO_WINDOWS) || defined(__CYGWIN__) 77 base =
static_cast<T
>(addr);
83 init_iov_base(iov.iov_base, asio::buffer_cast<void*>(buffer));
91 asio::buffer_cast<const void*>(buffer)));
94 #endif // defined(ASIO_WINDOWS) || defined(__CYGWIN__) 98 template <
typename Buffer,
typename Buffers>
104 : count_(0), total_buffer_size_(0)
106 typename Buffers::const_iterator iter = buffer_sequence.begin();
107 typename Buffers::const_iterator
end = buffer_sequence.end();
108 for (; iter != end && count_ < max_buffers; ++iter, ++count_)
128 return total_buffer_size_ == 0;
133 typename Buffers::const_iterator iter = buffer_sequence.begin();
134 typename Buffers::const_iterator
end = buffer_sequence.end();
136 for (; iter != end && i < max_buffers; ++iter, ++i)
142 static void validate(
const Buffers& buffer_sequence)
144 typename Buffers::const_iterator iter = buffer_sequence.begin();
145 typename Buffers::const_iterator
end = buffer_sequence.end();
146 for (; iter !=
end; ++iter)
153 static Buffer
first(
const Buffers& buffer_sequence)
155 typename Buffers::const_iterator iter = buffer_sequence.begin();
156 typename Buffers::const_iterator
end = buffer_sequence.end();
157 for (; iter !=
end; ++iter)
169 std::size_t total_buffer_size_;
172 template <
typename Buffer>
196 return total_buffer_size_ == 0;
211 return Buffer(buffer_sequence);
216 std::size_t total_buffer_size_;
219 template <
typename Buffer>
243 return total_buffer_size_ == 0;
258 return Buffer(buffer_sequence);
263 std::size_t total_buffer_size_;
266 template <
typename Buffer,
typename Elem>
292 return total_buffer_size_ == 0;
310 ? buffer_sequence[0] : buffer_sequence[1]);
315 std::size_t total_buffer_size_;
318 #if defined(ASIO_HAS_STD_ARRAY) 320 template <
typename Buffer,
typename Elem>
326 const std::array<Elem, 2>& buffer_sequence)
339 std::size_t count()
const 344 bool all_empty()
const 346 return total_buffer_size_ == 0;
349 static bool all_empty(
const std::array<Elem, 2>& buffer_sequence)
355 static void validate(
const std::array<Elem, 2>& buffer_sequence)
361 static Buffer first(
const std::array<Elem, 2>& buffer_sequence)
364 ? buffer_sequence[0] : buffer_sequence[1]);
369 std::size_t total_buffer_size_;
372 #endif // defined(ASIO_HAS_STD_ARRAY) 379 #if defined(ASIO_HEADER_ONLY) 381 #endif // defined(ASIO_HEADER_ONLY) 383 #endif // ASIO_DETAIL_BUFFER_SEQUENCE_ADAPTER_HPP buffer_sequence_adapter(const boost::array< Elem, 2 > &buffer_sequence)
static void validate(const Buffers &buffer_sequence)
static bool all_empty(const boost::array< Elem, 2 > &buffer_sequence)
static bool all_empty(const Buffers &buffer_sequence)
buffer_sequence_adapter(const asio::mutable_buffers_1 &buffer_sequence)
Holds a buffer that cannot be modified.
static void init_iov_base(T &base, void *addr)
buffer_sequence_adapter(const Buffers &buffer_sequence)
static void validate(const boost::array< Elem, 2 > &buffer_sequence)
static void validate(const asio::mutable_buffers_1 &buffer_sequence)
buffer_sequence_adapter(const asio::const_buffers_1 &buffer_sequence)
mutable_buffers_1 buffer(const mutable_buffer &b)
Create a new modifiable buffer from an existing buffer.
static Buffer first(const asio::const_buffers_1 &buffer_sequence)
native_buffer_type * buffers()
std::size_t buffer_size(const mutable_buffer &b)
Get the number of bytes in a modifiable buffer.
PointerToPodType buffer_cast(const mutable_buffer &b)
Cast a non-modifiable buffer to a specified pointer to POD type.
const MutableBufferSequence & buffers
std::size_t count() const
static bool all_empty(const asio::const_buffers_1 &buffer_sequence)
std::size_t count() const
native_buffer_type * buffers()
std::size_t count() const
Holds a buffer that can be modified.
static Buffer first(const boost::array< Elem, 2 > &buffer_sequence)
static Buffer first(const asio::mutable_buffers_1 &buffer_sequence)
static void init_iov_base(void *&base, void *addr)
static void validate(const asio::const_buffers_1 &buffer_sequence)
native_buffer_type * buffers()
native_buffer_type * buffers()
SocketService Iterator Iterator end
static bool all_empty(const asio::mutable_buffers_1 &buffer_sequence)
static void init_native_buffer(iovec &iov, const asio::mutable_buffer &buffer)
std::size_t count() const
static Buffer first(const Buffers &buffer_sequence)
static void init_native_buffer(iovec &iov, const asio::const_buffer &buffer)