29#ifndef MYSQL_CONTAINERS_BUFFERS_RW_BUFFER_H
30#define MYSQL_CONTAINERS_BUFFERS_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
mysql::containers::buffers::Buffer_view< Char_t > Buffer_view_t
Definition: rw_buffer.h:67
Buffer_view_t m_read_part
Definition: rw_buffer.h:171
Buffer_view_t & write_part()
Return the write part.
Definition: rw_buffer.h:104
Rw_buffer(Rw_buffer &)=delete
Deleted copy constructor.
Char_tp Char_t
Definition: rw_buffer.h:62
void increase_position(Size_t increment)
Increase the position right, relative to the currrent position.
Definition: rw_buffer.h:144
Rw_buffer(Rw_buffer &&) noexcept=default
Default move constructor.
Buffer_view_t m_write_part
Definition: rw_buffer.h:172
Size_t capacity() const
Return the total size of the read part and the write part.
Definition: rw_buffer.h:107
const Buffer_view_t & read_part() const
Return the read part.
Definition: rw_buffer.h:95
Char_t * Iterator_t
Definition: rw_buffer.h:65
const Buffer_view_t & write_part() const
Return the write part.
Definition: rw_buffer.h:101
void move_position(Difference_t delta)
Move the position left or right, relative to the current position.
Definition: rw_buffer.h:163
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
std::size_t Size_t
Definition: rw_buffer.h:63
std::ptrdiff_t Difference_t
Definition: rw_buffer.h:64
Rw_buffer(Buffer_view_t buffer)
Create a new Rw_buffer from the specified size and buffer.
Definition: rw_buffer.h:75
void set_position(Size_t new_position)
Set the position to a fixed number.
Definition: rw_buffer.h:122
Definition: buffer_sequence_view.h:51
const char * begin(const char *const c)
Definition: base64.h:44
size_t size(const char *const c)
Definition: base64.h:46
mutable_buffer buffer(void *p, size_t n) noexcept
Definition: buffer.h:418