MySQL 8.0.40
Source Code Documentation
mysqlns::buffer::Buffer_sequence_view< Char_tp, Container_tp, const_tp > Class Template Reference

Sequence of memory buffers. More...

#include <buffer_sequence_view.h>

Public Types

using Char_t = Char_tp
 
using Size_t = std::size_t
 
using Buffer_view_t = Buffer_view< Char_t >
 
using Buffer_allocator_t = mysqlns::resource::Allocator< Buffer_view_t >
 
using Container_t = Container_tp< Buffer_view_t, Buffer_allocator_t >
 
using Const_iterator_t = typename Container_t::const_iterator
 
using Iterator_t = typename std::conditional< const_tp, Const_iterator_t, typename Container_t::iterator >::type
 

Public Member Functions

 Buffer_sequence_view (Iterator_t begin_arg, Iterator_t end_arg, Size_t size_arg=uninitialized_size)
 Construct a Buffer_sequence_view with buffers in the range given by the iterators. More...
 
 Buffer_sequence_view (Buffer_sequence_view &)=delete
 
 Buffer_sequence_view (Buffer_sequence_view &&other) noexcept=default
 
Buffer_sequence_viewoperator= (Buffer_sequence_view &)=delete
 
Buffer_sequence_viewoperator= (Buffer_sequence_view &&) noexcept=default
 
virtual ~Buffer_sequence_view ()=default
 
Iterator_t begin ()
 Iterator to the first buffer. More...
 
Iterator_t end ()
 Iterator to the last buffer. More...
 
Const_iterator_t begin () const
 Iterator to the first buffer. More...
 
Const_iterator_t end () const
 Iterator to the last buffer. More...
 
Const_iterator_t cbegin () const
 Const iterator pointing to the first buffer. More...
 
Const_iterator_t cend () const
 Const iterator pointing to the last buffer. More...
 
template<class Destination_char_t >
void copy (Destination_char_t *destination) const
 Copy all data to the given, contiguous output buffer. More...
 
template<class Str_char_t = char, class Str_traits_t = std::char_traits<Str_char_t>, class Str_allocator_t = std::allocator<Str_char_t>>
std::basic_string< Str_char_t, Str_traits_t, Str_allocator_t > str (const Str_allocator_t &allocator=Str_allocator_t())
 Return a copy of all the data in this object, as a std::string object. More...
 
Size_t size () const
 Return the total size of all buffers. More...
 
std::string debug_string (bool show_contents=false, int indent=0) const
 In debug mode, return a string that describes the internal structure of this object, to use for debugging. More...
 

Private Attributes

Iterator_t m_begin
 Iterator to beginning of buffer. More...
 
Iterator_t m_end
 Iterator to end of buffer. More...
 
Size_t m_size
 Total size of all buffers, cached. More...
 

Static Private Attributes

static constexpr Size_t uninitialized_size
 Indicates that m_size has not yet been computed. More...
 

Detailed Description

template<class Char_tp = unsigned char, template< class Element_tp, class Allocator_tp > class Container_tp = std::vector, bool const_tp = false>
class mysqlns::buffer::Buffer_sequence_view< Char_tp, Container_tp, const_tp >

Sequence of memory buffers.

This is a minimal class with just a sequence of buffers. It does not have a read/write position (

See also
Rw_buffer_sequence). It does not have methods to grow the buffer sequence (
Managed_buffer_sequence).
Template Parameters
Char_tpThe type of elements stored in the buffer: typically unsigned char.
Container_tpThe type of container to hold the buffers. This defaults to std::vector, but std::list is also possible.
const_tpIf true, use const iterators instead of non-const iterators to represent the beginning and end of the container.

Member Typedef Documentation

◆ Buffer_allocator_t

template<class Char_tp = unsigned char, template< class Element_tp, class Allocator_tp > class Container_tp = std::vector, bool const_tp = false>
using mysqlns::buffer::Buffer_sequence_view< Char_tp, Container_tp, const_tp >::Buffer_allocator_t = mysqlns::resource::Allocator<Buffer_view_t>

◆ Buffer_view_t

template<class Char_tp = unsigned char, template< class Element_tp, class Allocator_tp > class Container_tp = std::vector, bool const_tp = false>
using mysqlns::buffer::Buffer_sequence_view< Char_tp, Container_tp, const_tp >::Buffer_view_t = Buffer_view<Char_t>

◆ Char_t

template<class Char_tp = unsigned char, template< class Element_tp, class Allocator_tp > class Container_tp = std::vector, bool const_tp = false>
using mysqlns::buffer::Buffer_sequence_view< Char_tp, Container_tp, const_tp >::Char_t = Char_tp

◆ Const_iterator_t

template<class Char_tp = unsigned char, template< class Element_tp, class Allocator_tp > class Container_tp = std::vector, bool const_tp = false>
using mysqlns::buffer::Buffer_sequence_view< Char_tp, Container_tp, const_tp >::Const_iterator_t = typename Container_t::const_iterator

◆ Container_t

template<class Char_tp = unsigned char, template< class Element_tp, class Allocator_tp > class Container_tp = std::vector, bool const_tp = false>
using mysqlns::buffer::Buffer_sequence_view< Char_tp, Container_tp, const_tp >::Container_t = Container_tp<Buffer_view_t, Buffer_allocator_t>

◆ Iterator_t

template<class Char_tp = unsigned char, template< class Element_tp, class Allocator_tp > class Container_tp = std::vector, bool const_tp = false>
using mysqlns::buffer::Buffer_sequence_view< Char_tp, Container_tp, const_tp >::Iterator_t = typename std::conditional<const_tp, Const_iterator_t, typename Container_t::iterator>::type

◆ Size_t

template<class Char_tp = unsigned char, template< class Element_tp, class Allocator_tp > class Container_tp = std::vector, bool const_tp = false>
using mysqlns::buffer::Buffer_sequence_view< Char_tp, Container_tp, const_tp >::Size_t = std::size_t

Constructor & Destructor Documentation

◆ Buffer_sequence_view() [1/3]

template<class Char_tp = unsigned char, template< class Element_tp, class Allocator_tp > class Container_tp = std::vector, bool const_tp = false>
mysqlns::buffer::Buffer_sequence_view< Char_tp, Container_tp, const_tp >::Buffer_sequence_view ( Iterator_t  begin_arg,
Iterator_t  end_arg,
Size_t  size_arg = uninitialized_size 
)
inline

Construct a Buffer_sequence_view with buffers in the range given by the iterators.

This copies only the iterators; the underlying container and the buffers contained in the container are not copied.

Parameters
begin_argIterator to the first buffer.
end_argIterator to one-past-the-last buffer.
size_argThe total size of all buffers from begin_arg to end_arg. This is an optimization only: if the parameter is omitted, it will be computed the next time it is needed.

◆ Buffer_sequence_view() [2/3]

template<class Char_tp = unsigned char, template< class Element_tp, class Allocator_tp > class Container_tp = std::vector, bool const_tp = false>
mysqlns::buffer::Buffer_sequence_view< Char_tp, Container_tp, const_tp >::Buffer_sequence_view ( Buffer_sequence_view< Char_tp, Container_tp, const_tp > &  )
delete

◆ Buffer_sequence_view() [3/3]

template<class Char_tp = unsigned char, template< class Element_tp, class Allocator_tp > class Container_tp = std::vector, bool const_tp = false>
mysqlns::buffer::Buffer_sequence_view< Char_tp, Container_tp, const_tp >::Buffer_sequence_view ( Buffer_sequence_view< Char_tp, Container_tp, const_tp > &&  other)
defaultnoexcept

◆ ~Buffer_sequence_view()

template<class Char_tp = unsigned char, template< class Element_tp, class Allocator_tp > class Container_tp = std::vector, bool const_tp = false>
virtual mysqlns::buffer::Buffer_sequence_view< Char_tp, Container_tp, const_tp >::~Buffer_sequence_view ( )
virtualdefault

Member Function Documentation

◆ begin() [1/2]

template<class Char_tp = unsigned char, template< class Element_tp, class Allocator_tp > class Container_tp = std::vector, bool const_tp = false>
Iterator_t mysqlns::buffer::Buffer_sequence_view< Char_tp, Container_tp, const_tp >::begin ( )
inline

Iterator to the first buffer.

◆ begin() [2/2]

template<class Char_tp = unsigned char, template< class Element_tp, class Allocator_tp > class Container_tp = std::vector, bool const_tp = false>
Const_iterator_t mysqlns::buffer::Buffer_sequence_view< Char_tp, Container_tp, const_tp >::begin ( ) const
inline

Iterator to the first buffer.

◆ cbegin()

template<class Char_tp = unsigned char, template< class Element_tp, class Allocator_tp > class Container_tp = std::vector, bool const_tp = false>
Const_iterator_t mysqlns::buffer::Buffer_sequence_view< Char_tp, Container_tp, const_tp >::cbegin ( ) const
inline

Const iterator pointing to the first buffer.

◆ cend()

template<class Char_tp = unsigned char, template< class Element_tp, class Allocator_tp > class Container_tp = std::vector, bool const_tp = false>
Const_iterator_t mysqlns::buffer::Buffer_sequence_view< Char_tp, Container_tp, const_tp >::cend ( ) const
inline

Const iterator pointing to the last buffer.

◆ copy()

template<class Char_tp = unsigned char, template< class Element_tp, class Allocator_tp > class Container_tp = std::vector, bool const_tp = false>
template<class Destination_char_t >
void mysqlns::buffer::Buffer_sequence_view< Char_tp, Container_tp, const_tp >::copy ( Destination_char_t *  destination) const
inline

Copy all data to the given, contiguous output buffer.

The caller is responsible for providing a buffer of at least size() bytes.

Parameters
destinationThe target buffer.

◆ debug_string()

template<class Char_tp = unsigned char, template< class Element_tp, class Allocator_tp > class Container_tp = std::vector, bool const_tp = false>
std::string mysqlns::buffer::Buffer_sequence_view< Char_tp, Container_tp, const_tp >::debug_string ( bool  show_contents = false,
int  indent = 0 
) const
inline

In debug mode, return a string that describes the internal structure of this object, to use for debugging.

Parameters
show_contentsIf true, includes the buffer contents. Otherwise, just pointers and sizes.
indentIf 0, put all info on one line. Otherwise, put each field on its own line and indent the given number of two-space levels.
Returns
String that describes the internal structure of this Buffer_sequence_view.

◆ end() [1/2]

template<class Char_tp = unsigned char, template< class Element_tp, class Allocator_tp > class Container_tp = std::vector, bool const_tp = false>
Iterator_t mysqlns::buffer::Buffer_sequence_view< Char_tp, Container_tp, const_tp >::end ( )
inline

Iterator to the last buffer.

◆ end() [2/2]

template<class Char_tp = unsigned char, template< class Element_tp, class Allocator_tp > class Container_tp = std::vector, bool const_tp = false>
Const_iterator_t mysqlns::buffer::Buffer_sequence_view< Char_tp, Container_tp, const_tp >::end ( ) const
inline

Iterator to the last buffer.

◆ operator=() [1/2]

template<class Char_tp = unsigned char, template< class Element_tp, class Allocator_tp > class Container_tp = std::vector, bool const_tp = false>
Buffer_sequence_view & mysqlns::buffer::Buffer_sequence_view< Char_tp, Container_tp, const_tp >::operator= ( Buffer_sequence_view< Char_tp, Container_tp, const_tp > &&  )
defaultnoexcept

◆ operator=() [2/2]

template<class Char_tp = unsigned char, template< class Element_tp, class Allocator_tp > class Container_tp = std::vector, bool const_tp = false>
Buffer_sequence_view & mysqlns::buffer::Buffer_sequence_view< Char_tp, Container_tp, const_tp >::operator= ( Buffer_sequence_view< Char_tp, Container_tp, const_tp > &  )
delete

◆ size()

template<class Char_tp = unsigned char, template< class Element_tp, class Allocator_tp > class Container_tp = std::vector, bool const_tp = false>
Size_t mysqlns::buffer::Buffer_sequence_view< Char_tp, Container_tp, const_tp >::size ( ) const
inline

Return the total size of all buffers.

◆ str()

template<class Char_tp = unsigned char, template< class Element_tp, class Allocator_tp > class Container_tp = std::vector, bool const_tp = false>
template<class Str_char_t = char, class Str_traits_t = std::char_traits<Str_char_t>, class Str_allocator_t = std::allocator<Str_char_t>>
std::basic_string< Str_char_t, Str_traits_t, Str_allocator_t > mysqlns::buffer::Buffer_sequence_view< Char_tp, Container_tp, const_tp >::str ( const Str_allocator_t &  allocator = Str_allocator_t())
inline

Return a copy of all the data in this object, as a std::string object.

Member Data Documentation

◆ m_begin

template<class Char_tp = unsigned char, template< class Element_tp, class Allocator_tp > class Container_tp = std::vector, bool const_tp = false>
Iterator_t mysqlns::buffer::Buffer_sequence_view< Char_tp, Container_tp, const_tp >::m_begin
private

Iterator to beginning of buffer.

◆ m_end

template<class Char_tp = unsigned char, template< class Element_tp, class Allocator_tp > class Container_tp = std::vector, bool const_tp = false>
Iterator_t mysqlns::buffer::Buffer_sequence_view< Char_tp, Container_tp, const_tp >::m_end
private

Iterator to end of buffer.

◆ m_size

template<class Char_tp = unsigned char, template< class Element_tp, class Allocator_tp > class Container_tp = std::vector, bool const_tp = false>
Size_t mysqlns::buffer::Buffer_sequence_view< Char_tp, Container_tp, const_tp >::m_size
mutableprivate

Total size of all buffers, cached.

◆ uninitialized_size

template<class Char_tp = unsigned char, template< class Element_tp, class Allocator_tp > class Container_tp = std::vector, bool const_tp = false>
constexpr Size_t mysqlns::buffer::Buffer_sequence_view< Char_tp, Container_tp, const_tp >::uninitialized_size
staticconstexprprivate
Initial value:
=
std::numeric_limits<Size_t>::max()

Indicates that m_size has not yet been computed.


The documentation for this class was generated from the following file: