From 7f97b7bc050cc443a1616121ac6abd0b167d82d5 Mon Sep 17 00:00:00 2001 From: Vinnie Falco Date: Sun, 1 May 2016 10:55:28 -0400 Subject: [PATCH] Remove unused directory --- include/beast/impl/buffers_adapter.ipp | 520 ----------------------- include/beast/impl/consuming_buffers.ipp | 211 --------- include/beast/impl/prepare_buffers.ipp | 215 ---------- include/beast/impl/static_streambuf.ipp | 304 ------------- 4 files changed, 1250 deletions(-) delete mode 100644 include/beast/impl/buffers_adapter.ipp delete mode 100644 include/beast/impl/consuming_buffers.ipp delete mode 100644 include/beast/impl/prepare_buffers.ipp delete mode 100644 include/beast/impl/static_streambuf.ipp diff --git a/include/beast/impl/buffers_adapter.ipp b/include/beast/impl/buffers_adapter.ipp deleted file mode 100644 index 0040fd5a4..000000000 --- a/include/beast/impl/buffers_adapter.ipp +++ /dev/null @@ -1,520 +0,0 @@ -// -// Copyright (c) 2013-2016 Vinnie Falco (vinnie dot falco at gmail 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 BEAST_IMPL_BUFFERS_ADAPTER_IPP -#define BEAST_IMPL_BUFFERS_ADAPTER_IPP - -#include -#include -#include -#include -#include -#include - -namespace beast { - -template -class buffers_adapter::const_buffers_type -{ - buffers_adapter const* ba_; - -public: - using value_type = boost::asio::const_buffer; - - class const_iterator; - - const_buffers_type() = default; - const_buffers_type( - const_buffers_type const&) = default; - const_buffers_type& operator=( - const_buffers_type const&) = default; - - const_iterator - begin() const; - - const_iterator - end() const; - -private: - friend class buffers_adapter; - - const_buffers_type(buffers_adapter const& ba) - : ba_(&ba) - { - } -}; - -template -class buffers_adapter::const_buffers_type::const_iterator -{ - iter_type it_; - buffers_adapter const* ba_; - -public: - using value_type = boost::asio::const_buffer; - using pointer = value_type const*; - using reference = value_type; - using difference_type = std::ptrdiff_t; - using iterator_category = - std::bidirectional_iterator_tag; - - const_iterator() = default; - const_iterator(const_iterator&& other) = default; - const_iterator(const_iterator const& other) = default; - const_iterator& operator=(const_iterator&& other) = default; - const_iterator& operator=(const_iterator const& other) = default; - - bool - operator==(const_iterator const& other) const - { - return ba_ == other.ba_ && - it_ == other.it_; - } - - bool - operator!=(const_iterator const& other) const - { - return !(*this == other); - } - - reference - operator*() const - { - using boost::asio::buffer_cast; - using boost::asio::buffer_size; - return value_type{buffer_cast(*it_), - (ba_->out_ == ba_->bs_.end() || - it_ != ba_->out_) ? buffer_size(*it_) : ba_->out_pos_} + - (it_ == ba_->begin_ ? ba_->in_pos_ : 0); - } - - pointer - operator->() const = delete; - - const_iterator& - operator++() - { - ++it_; - return *this; - } - - const_iterator - operator++(int) - { - auto temp = *this; - ++(*this); - return temp; - } - - const_iterator& - operator--() - { - --it_; - return *this; - } - - const_iterator - operator--(int) - { - auto temp = *this; - --(*this); - return temp; - } - -private: - friend class const_buffers_type; - - const_iterator(buffers_adapter const& ba, - iter_type iter) - : it_(iter) - , ba_(&ba) - { - } -}; - -template -inline -auto -buffers_adapter::const_buffers_type::begin() const -> - const_iterator -{ - return const_iterator{*ba_, ba_->begin_}; -} - -template -inline -auto -buffers_adapter::const_buffers_type::end() const -> - const_iterator -{ - return const_iterator{*ba_, ba_->out_ == - ba_->end_ ? ba_->end_ : std::next(ba_->out_)}; -} - -//------------------------------------------------------------------------------ - -template -class buffers_adapter::mutable_buffers_type -{ - buffers_adapter const* ba_; - -public: - using value_type = boost::asio::mutable_buffer; - - class const_iterator; - - mutable_buffers_type() = default; - mutable_buffers_type( - mutable_buffers_type const&) = default; - mutable_buffers_type& operator=( - mutable_buffers_type const&) = default; - - const_iterator - begin() const; - - const_iterator - end() const; - -private: - friend class buffers_adapter; - - mutable_buffers_type( - buffers_adapter const& ba) - : ba_(&ba) - { - } -}; - -template -class buffers_adapter::mutable_buffers_type::const_iterator -{ - iter_type it_; - buffers_adapter const* ba_; - -public: - using value_type = boost::asio::mutable_buffer; - using pointer = value_type const*; - using reference = value_type; - using difference_type = std::ptrdiff_t; - using iterator_category = - std::bidirectional_iterator_tag; - - const_iterator() = default; - const_iterator(const_iterator&& other) = default; - const_iterator(const_iterator const& other) = default; - const_iterator& operator=(const_iterator&& other) = default; - const_iterator& operator=(const_iterator const& other) = default; - - bool - operator==(const_iterator const& other) const - { - return ba_ == other.ba_ && - it_ == other.it_; - } - - bool - operator!=(const_iterator const& other) const - { - return !(*this == other); - } - - reference - operator*() const - { - using boost::asio::buffer_cast; - using boost::asio::buffer_size; - return value_type{buffer_cast(*it_), - it_ == std::prev(ba_->end_) ? - ba_->out_end_ : buffer_size(*it_)} + - (it_ == ba_->out_ ? ba_->out_pos_ : 0); - } - - pointer - operator->() const = delete; - - const_iterator& - operator++() - { - ++it_; - return *this; - } - - const_iterator - operator++(int) - { - auto temp = *this; - ++(*this); - return temp; - } - - const_iterator& - operator--() - { - --it_; - return *this; - } - - const_iterator - operator--(int) - { - auto temp = *this; - --(*this); - return temp; - } - -private: - friend class mutable_buffers_type; - - const_iterator(buffers_adapter const& ba, - iter_type iter) - : it_(iter) - , ba_(&ba) - { - } -}; - -template -inline -auto -buffers_adapter::mutable_buffers_type::begin() const -> - const_iterator -{ - return const_iterator{*ba_, ba_->out_}; -} - -template -inline -auto -buffers_adapter::mutable_buffers_type::end() const -> - const_iterator -{ - return const_iterator{*ba_, ba_->end_}; -} - -//------------------------------------------------------------------------------ - -template -buffers_adapter::buffers_adapter( - buffers_adapter&& other) - : buffers_adapter(std::move(other), - std::distance(other.bs_.begin(), other.begin_), - std::distance(other.bs_.begin(), other.out_), - std::distance(other.bs_.begin(), other.end_)) -{ -} - -template -buffers_adapter::buffers_adapter( - buffers_adapter const& other) - : buffers_adapter(other, - std::distance(other.bs_.begin(), other.begin_), - std::distance(other.bs_.begin(), other.out_), - std::distance(other.bs_.begin(), other.end_)) -{ -} - -template -auto -buffers_adapter::operator=( - buffers_adapter&& other) -> buffers_adapter& -{ - auto const nbegin = std::distance( - other.bs_.begin(), other.begin_); - auto const nout = std::distance( - other.bs_.begin(), other.out_); - auto const nend = std::distance( - other.bs_.begin(), other.end_); - bs_ = std::move(other.bs_); - begin_ = std::next(bs_.begin(), nbegin); - out_ = std::next(bs_.begin(), nout); - end_ = std::next(bs_.begin(), nend); - max_size_ = other.max_size_; - in_pos_ = other.in_pos_; - in_size_ = other.in_size_; - out_pos_ = other.out_pos_; - out_end_ = other.out_end_; - return *this; -} - -template -auto -buffers_adapter::operator=( - buffers_adapter const& other) -> buffers_adapter& -{ - auto const nbegin = std::distance( - other.bs_.begin(), other.begin_); - auto const nout = std::distance( - other.bs_.begin(), other.out_); - auto const nend = std::distance( - other.bs_.begin(), other.end_); - bs_ = other.bs_; - begin_ = std::next(bs_.begin(), nbegin); - out_ = std::next(bs_.begin(), nout); - end_ = std::next(bs_.begin(), nend); - max_size_ = other.max_size_; - in_pos_ = other.in_pos_; - in_size_ = other.in_size_; - out_pos_ = other.out_pos_; - out_end_ = other.out_end_; - return *this; -} - -template -buffers_adapter::buffers_adapter( - Buffers const& bs) - : bs_(bs) - , begin_(bs_.begin()) - , out_(bs_.begin()) - , end_(bs_.begin()) - , max_size_(boost::asio::buffer_size(bs_)) -{ -} - -template -auto -buffers_adapter::prepare(std::size_t n) -> - mutable_buffers_type -{ - using boost::asio::buffer_size; - static_assert(is_mutable, - "Operation not valid for ConstBufferSequence"); - end_ = out_; - if(end_ != bs_.end()) - { - auto size = buffer_size(*end_) - out_pos_; - if(n > size) - { - n -= size; - while(++end_ != bs_.end()) - { - size = buffer_size(*end_); - if(n < size) - { - out_end_ = n; - n = 0; - ++end_; - break; - } - n -= size; - out_end_ = size; - } - } - else - { - ++end_; - out_end_ = out_pos_ + n; - n = 0; - } - } - if(n > 0) - throw std::length_error( - "no space in buffers_adapter"); - return mutable_buffers_type{*this}; -} - -template -void -buffers_adapter::commit(std::size_t n) -{ - using boost::asio::buffer_size; - static_assert(is_mutable, - "Operation not valid for ConstBufferSequence"); - if(out_ == end_) - return; - auto const last = std::prev(end_); - while(out_ != last) - { - auto const avail = - buffer_size(*out_) - out_pos_; - if(n < avail) - { - out_pos_ += n; - in_size_ += n; - max_size_ -= n; - return; - } - ++out_; - n -= avail; - out_pos_ = 0; - in_size_ += avail; - max_size_ -= avail; - } - - n = std::min(n, out_end_ - out_pos_); - out_pos_ += n; - in_size_ += n; - max_size_ -= n; - if(out_pos_ == buffer_size(*out_)) - { - ++out_; - out_pos_ = 0; - out_end_ = 0; - } -} - -template -inline -auto -buffers_adapter::data() const -> - const_buffers_type -{ - return const_buffers_type{*this}; -} - -template -void -buffers_adapter::consume(std::size_t n) -{ - for(;;) - { - if(begin_ != out_) - { - auto const avail = - buffer_size(*begin_) - in_pos_; - if(n < avail) - { - in_size_ -= n; - in_pos_ += n; - break; - } - n -= avail; - in_size_ -= avail; - in_pos_ = 0; - ++begin_; - } - else - { - auto const avail = out_pos_ - in_pos_; - if(n < avail) - { - in_size_ -= n; - in_pos_ += n; - } - else - { - in_size_ -= avail; - if(out_pos_ != out_end_|| - out_ != std::prev(bs_.end())) - { - in_pos_ = out_pos_; - } - else - { - // Use the whole buffer now. - in_pos_ = 0; - out_pos_ = 0; - out_end_ = 0; - } - } - break; - } - } -} - -} // beast - -#endif diff --git a/include/beast/impl/consuming_buffers.ipp b/include/beast/impl/consuming_buffers.ipp deleted file mode 100644 index 4aa203f56..000000000 --- a/include/beast/impl/consuming_buffers.ipp +++ /dev/null @@ -1,211 +0,0 @@ -// -// Copyright (c) 2013-2016 Vinnie Falco (vinnie dot falco at gmail 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 BEAST_IMPL_CONSUMING_BUFFERS_IPP -#define BEAST_IMPL_CONSUMING_BUFFERS_IPP - -#include -#include -#include -#include -#include -#include -#include - -namespace beast { - -template -class consuming_buffers::const_iterator -{ - friend class consuming_buffers; - - using iter_type = - typename Buffers::const_iterator; - - iter_type it_; - consuming_buffers const* b_; - -public: - using value_type = - typename std::iterator_traits::value_type; - using pointer = value_type const*; - using reference = value_type; - using difference_type = std::ptrdiff_t; - using iterator_category = - std::bidirectional_iterator_tag; - - const_iterator() = default; - const_iterator(const_iterator&& other) = default; - const_iterator(const_iterator const& other) = default; - const_iterator& operator=(const_iterator&& other) = default; - const_iterator& operator=(const_iterator const& other) = default; - - bool - operator==(const_iterator const& other) const - { - return b_ == other.b_ && it_ == other.it_; - } - - bool - operator!=(const_iterator const& other) const - { - return !(*this == other); - } - - reference - operator*() const - { - if(it_ == b_->begin_) - return *it_ + b_->skip_; - return *it_; - } - - pointer - operator->() const = delete; - - const_iterator& - operator++() - { - ++it_; - return *this; - } - - const_iterator - operator++(int) - { - auto temp = *this; - ++(*this); - return temp; - } - - const_iterator& - operator--() - { - --it_; - return *this; - } - - const_iterator - operator--(int) - { - auto temp = *this; - --(*this); - return temp; - } - -private: - const_iterator(consuming_buffers const& b, - iter_type it) - : it_(it) - , b_(&b) - { - } -}; - -template -consuming_buffers:: -consuming_buffers(consuming_buffers&& other) - : consuming_buffers(std::move(other), - std::distance( - other.bs_.begin(), other.begin_)) -{ -} - -template -consuming_buffers:: -consuming_buffers(consuming_buffers const& other) - : consuming_buffers(other, - std::distance( - other.bs_.begin(), other.begin_)) -{ -} - -template -auto -consuming_buffers:: -operator=(consuming_buffers&& other) -> - consuming_buffers& -{ - auto const nbegin = std::distance( - other.bs_.begin(), other.begin_); - bs_ = std::move(other.bs_); - begin_ = std::next(bs_.begin(), nbegin); - skip_ = other.skip_; - return *this; -} - -template -auto -consuming_buffers:: -operator=(consuming_buffers const& other) -> - consuming_buffers& -{ - auto const nbegin = std::distance( - other.bs_.begin(), other.begin_); - bs_ = other.bs_; - begin_ = std::next(bs_.begin(), nbegin); - skip_ = other.skip_; - return *this; -} - -template -consuming_buffers:: -consuming_buffers(Buffers const& bs) - : bs_(bs) - , begin_(bs_.begin()) -{ - static_assert(is_BufferSequence::value, - "BufferSequence requirements not met"); -} - -template -auto -consuming_buffers::begin() const -> - const_iterator -{ - return const_iterator{*this, begin_}; -} - -template -auto -consuming_buffers::end() const -> - const_iterator -{ - return const_iterator{*this, bs_.end()}; -} - -template -void -consuming_buffers::consume(std::size_t n) -{ - using boost::asio::buffer_size; - for(;n > 0 && begin_ != bs_.end(); ++begin_) - { - auto const len = - buffer_size(*begin_) - skip_; - if(n < len) - { - skip_ += n; - break; - } - n -= len; - skip_ = 0; - } -} - -template -consuming_buffers -consumed_buffers(Buffers const& bs, std::size_t n) -{ - consuming_buffers cb(bs); - cb.consume(n); - return cb; -} - -} // beast - -#endif diff --git a/include/beast/impl/prepare_buffers.ipp b/include/beast/impl/prepare_buffers.ipp deleted file mode 100644 index 65de4a3b1..000000000 --- a/include/beast/impl/prepare_buffers.ipp +++ /dev/null @@ -1,215 +0,0 @@ -// -// Copyright (c) 2013-2016 Vinnie Falco (vinnie dot falco at gmail 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 BEAST_IMPL_PREPARE_BUFFERS_IPP -#define BEAST_IMPL_PREPARE_BUFFERS_IPP - -#include -#include -#include -#include -#include -#include - -namespace beast { - -template -void -prepared_buffers:: -setup(std::size_t n) -{ - for(end_ = bs_.begin(); end_ != bs_.end(); ++end_) - { - auto const len = - boost::asio::buffer_size(*end_); - if(n <= len) - { - size_ = n; - back_ = end_++; - return; - } - n -= len; - } - size_ = 0; - back_ = end_; -} - -template -class prepared_buffers::const_iterator -{ - friend class prepared_buffers; - - using iter_type = - typename BufferSequence::const_iterator; - - prepared_buffers const* b_; - typename BufferSequence::const_iterator it_; - -public: - using value_type = - typename std::iterator_traits::value_type; - using pointer = value_type const*; - using reference = value_type; - using difference_type = std::ptrdiff_t; - using iterator_category = - std::bidirectional_iterator_tag; - - const_iterator() = default; - const_iterator(const_iterator&& other) = default; - const_iterator(const_iterator const& other) = default; - const_iterator& operator=(const_iterator&& other) = default; - const_iterator& operator=(const_iterator const& other) = default; - - bool - operator==(const_iterator const& other) const - { - return b_ == other.b_ && it_ == other.it_; - } - - bool - operator!=(const_iterator const& other) const - { - return !(*this == other); - } - - reference - operator*() const - { - if(it_ == b_->back_) - return prepare_buffer(b_->size_, *it_); - return *it_; - } - - pointer - operator->() const = delete; - - const_iterator& - operator++() - { - ++it_; - return *this; - } - - const_iterator - operator++(int) - { - auto temp = *this; - ++(*this); - return temp; - } - - const_iterator& - operator--() - { - --it_; - return *this; - } - - const_iterator - operator--(int) - { - auto temp = *this; - --(*this); - return temp; - } - -private: - const_iterator(prepared_buffers const& b, - bool at_end) - : b_(&b) - , it_(at_end ? b.end_ : b.bs_.begin()) - { - } -}; - -template -prepared_buffers:: -prepared_buffers(prepared_buffers&& other) - : prepared_buffers(std::move(other), - std::distance(other.bs_.begin(), other.back_), - std::distance(other.bs_.begin(), other.end_)) -{ -} - -template -prepared_buffers:: -prepared_buffers(prepared_buffers const& other) - : prepared_buffers(other, - std::distance(other.bs_.begin(), other.back_), - std::distance(other.bs_.begin(), other.end_)) -{ -} - -template -auto -prepared_buffers:: -operator=(prepared_buffers&& other) -> - prepared_buffers& -{ - auto const nback = std::distance( - other.bs_.begin(), other.back_); - auto const nend = std::distance( - other.bs_.begin(), other.end_); - bs_ = std::move(other.bs_); - back_ = std::next(bs_.begin(), nback); - end_ = std::next(bs_.begin(), nend); - size_ = other.size_; - return *this; -} - -template -auto -prepared_buffers:: -operator=(prepared_buffers const& other) -> - prepared_buffers& -{ - auto const nback = std::distance( - other.bs_.begin(), other.back_); - auto const nend = std::distance( - other.bs_.begin(), other.end_); - bs_ = other.bs_; - back_ = std::next(bs_.begin(), nback); - end_ = std::next(bs_.begin(), nend); - size_ = other.size_; - return *this; -} - -template -prepared_buffers:: -prepared_buffers(std::size_t n, BufferSequence const& bs) - : bs_(bs) -{ - setup(n); -} - -template -auto -prepared_buffers::begin() const -> - const_iterator -{ - return const_iterator{*this, false}; -} - -template -auto -prepared_buffers::end() const -> - const_iterator -{ - return const_iterator{*this, true}; -} - -template -inline -prepared_buffers -prepare_buffers(std::size_t n, BufferSequence const& buffers) -{ - return prepared_buffers(n, buffers); -} - -} // beast - -#endif diff --git a/include/beast/impl/static_streambuf.ipp b/include/beast/impl/static_streambuf.ipp deleted file mode 100644 index 0d75a8200..000000000 --- a/include/beast/impl/static_streambuf.ipp +++ /dev/null @@ -1,304 +0,0 @@ -// -// Copyright (c) 2013-2016 Vinnie Falco (vinnie dot falco at gmail 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 BEAST_IMPL_STATIC_STREAMBUF_IPP -#define BEAST_IMPL_STATIC_STREAMBUF_IPP - -#include -#include -#include -#include -#include - -namespace beast { - -class static_streambuf::const_buffers_type -{ - std::size_t n_; - std::uint8_t const* p_; - -public: - using value_type = boost::asio::const_buffer; - - class const_iterator; - - const_buffers_type() = default; - const_buffers_type( - const_buffers_type const&) = default; - const_buffers_type& operator=( - const_buffers_type const&) = default; - - const_iterator - begin() const; - - const_iterator - end() const; - -private: - friend class static_streambuf; - - const_buffers_type( - std::uint8_t const* p, std::size_t n) - : n_(n) - , p_(p) - { - } -}; - -class static_streambuf::const_buffers_type::const_iterator -{ - std::size_t n_; - std::uint8_t const* p_; - -public: - using value_type = boost::asio::const_buffer; - using pointer = value_type const*; - using reference = value_type; - using difference_type = std::ptrdiff_t; - using iterator_category = - std::bidirectional_iterator_tag; - - const_iterator() = default; - const_iterator(const_iterator&& other) = default; - const_iterator(const_iterator const& other) = default; - const_iterator& operator=(const_iterator&& other) = default; - const_iterator& operator=(const_iterator const& other) = default; - - bool - operator==(const_iterator const& other) const - { - return p_ == other.p_; - } - - bool - operator!=(const_iterator const& other) const - { - return !(*this == other); - } - - reference - operator*() const - { - return value_type{p_, n_}; - } - - pointer - operator->() const = delete; - - const_iterator& - operator++() - { - p_ += n_; - return *this; - } - - const_iterator - operator++(int) - { - auto temp = *this; - ++(*this); - return temp; - } - - const_iterator& - operator--() - { - p_ -= n_; - return *this; - } - - const_iterator - operator--(int) - { - auto temp = *this; - --(*this); - return temp; - } - -private: - friend class const_buffers_type; - - const_iterator( - std::uint8_t const* p, std::size_t n) - : n_(n) - , p_(p) - { - } -}; - -inline -auto -static_streambuf::const_buffers_type::begin() const -> - const_iterator -{ - return const_iterator{p_, n_}; -} - -inline -auto -static_streambuf::const_buffers_type::end() const -> - const_iterator -{ - return const_iterator{p_ + n_, n_}; -} - -//------------------------------------------------------------------------------ - -class static_streambuf::mutable_buffers_type -{ - std::size_t n_; - std::uint8_t* p_; - -public: - using value_type = boost::asio::mutable_buffer; - - class const_iterator; - - mutable_buffers_type() = default; - mutable_buffers_type( - mutable_buffers_type const&) = default; - mutable_buffers_type& operator=( - mutable_buffers_type const&) = default; - - const_iterator - begin() const; - - const_iterator - end() const; - -private: - friend class static_streambuf; - - mutable_buffers_type( - std::uint8_t* p, std::size_t n) - : n_(n) - , p_(p) - { - } -}; - -class static_streambuf::mutable_buffers_type::const_iterator -{ - std::size_t n_; - std::uint8_t* p_; - -public: - using value_type = boost::asio::mutable_buffer; - using pointer = value_type const*; - using reference = value_type; - using difference_type = std::ptrdiff_t; - using iterator_category = - std::bidirectional_iterator_tag; - - const_iterator() = default; - const_iterator(const_iterator&& other) = default; - const_iterator(const_iterator const& other) = default; - const_iterator& operator=(const_iterator&& other) = default; - const_iterator& operator=(const_iterator const& other) = default; - - bool - operator==(const_iterator const& other) const - { - return p_ == other.p_; - } - - bool - operator!=(const_iterator const& other) const - { - return !(*this == other); - } - - reference - operator*() const - { - return value_type{p_, n_}; - } - - pointer - operator->() const = delete; - - const_iterator& - operator++() - { - p_ += n_; - return *this; - } - - const_iterator - operator++(int) - { - auto temp = *this; - ++(*this); - return temp; - } - - const_iterator& - operator--() - { - p_ -= n_; - return *this; - } - - const_iterator - operator--(int) - { - auto temp = *this; - --(*this); - return temp; - } - -private: - friend class mutable_buffers_type; - - const_iterator(std::uint8_t* p, std::size_t n) - : n_(n) - , p_(p) - { - } -}; - -inline -auto -static_streambuf::mutable_buffers_type::begin() const -> - const_iterator -{ - return const_iterator{p_, n_}; -} - -inline -auto -static_streambuf::mutable_buffers_type::end() const -> - const_iterator -{ - return const_iterator{p_ + n_, n_}; -} - -//------------------------------------------------------------------------------ - -inline -auto -static_streambuf::prepare(std::size_t n) -> - mutable_buffers_type -{ - if(n > static_cast(end_ - out_)) - throw std::length_error("no space in streambuf"); - last_ = out_ + n; - return mutable_buffers_type{out_, n}; -} - -inline -auto -static_streambuf::data() const -> - const_buffers_type -{ - return const_buffers_type{in_, - static_cast(out_ - in_)}; -} - -} // beast - -#endif