32#ifndef MYSQL_BUFFER_RW_BUFFER_H_
33#define MYSQL_BUFFER_RW_BUFFER_H_
59template <
class Char_tp =
unsigned char>
125 new_position = std::min(new_position,
capacity);
146 assert(increment <= this->
capacity() - read_size);
147 auto new_position = read_size + increment;
165 assert(new_position >= 0);
Class that groups a pointer+size as one object, without managing the memory for it.
Size_t size() const
Return the number of bytes.
Definition: buffer_view.h:112
Non-owning read/write memory buffer manager with a fixed size.
Definition: rw_buffer.h:60
Rw_buffer(Buffer_view_t buffer)
Create a new Rw_buffer from the specified size and buffer.
Definition: rw_buffer.h:75
void move_position(Difference_t delta)
Move the position left or right, relative to the current position.
Definition: rw_buffer.h:163
Rw_buffer(Rw_buffer &&) noexcept=default
Default move constructor.
const Char_t * Const_iterator_t
Definition: rw_buffer.h:66
Buffer_view_t & read_part()
Return the read part.
Definition: rw_buffer.h:98
Char_t * Iterator_t
Definition: rw_buffer.h:65
Rw_buffer(Rw_buffer &)=delete
Deleted copy constructor.
mysqlns::buffer::Buffer_view< Char_t > Buffer_view_t
Definition: rw_buffer.h:67
Buffer_view_t m_write_part
Definition: rw_buffer.h:172
void set_position(Size_t new_position)
Set the position to a fixed number.
Definition: rw_buffer.h:122
const Buffer_view_t & read_part() const
Return the read part.
Definition: rw_buffer.h:95
void increase_position(Size_t increment)
Increase the position right, relative to the currrent position.
Definition: rw_buffer.h:144
Buffer_view_t & write_part()
Return the write part.
Definition: rw_buffer.h:104
std::ptrdiff_t Difference_t
Definition: rw_buffer.h:64
Size_t capacity() const
Return the total size of the read part and the write part.
Definition: rw_buffer.h:107
Buffer_view_t m_read_part
Definition: rw_buffer.h:171
const Buffer_view_t & write_part() const
Return the write part.
Definition: rw_buffer.h:101
std::size_t Size_t
Definition: rw_buffer.h:63
Char_tp Char_t
Definition: rw_buffer.h:62
Definition: buffer_sequence_view.h:51
mutable_buffer buffer(void *p, size_t n) noexcept
Definition: buffer.h:420