29#ifndef MYSQL_BINLOG_EVENT_COMPRESSION_BUFFER_BUFFER_VIEW_H 
   30#define MYSQL_BINLOG_EVENT_COMPRESSION_BUFFER_BUFFER_VIEW_H 
   49template <
class Char_tp = 
unsigned char>
 
   61    if (
data == 
nullptr) assert(
size == 0);
 
  115  template <
class Str_char_t = char,
 
  116            class Str_traits_t = std::char_traits<Str_char_t>,
 
  117            class Str_allocator_t = std::allocator<Str_char_t>>
 
  118  std::basic_string<Str_char_t, Str_traits_t, Str_allocator_t> 
str(
 
  119      const Str_allocator_t &allocator = Str_allocator_t())
 const {
 
  120    return std::basic_string<Str_char_t, Str_traits_t, Str_allocator_t>(
 
  121        reinterpret_cast<const Str_char_t *
>(
m_data), 
m_size, allocator);
 
  128  std::string 
debug_string([[maybe_unused]] 
bool show_contents = 
false)
 const {
 
  134    ss << 
"Buffer_view(ptr=" << (
const void *)
this 
  135       << 
", data=" << (
const void *)
data()
 
  136       << 
", size=" << 
size();
 
  138    if (show_contents && 
begin() != 
nullptr)
 
  139      ss << 
", contents=\"" 
  140         << std::string(
reinterpret_cast<const char *
>(
begin()), 
size())
 
Non-owning view of a memory buffer with a fixed size.
Definition: buffer_view.h:50
 
Buffer_view(Char_t *data, Size_t size)
Create a new Buffer_view with the specified size and data.
Definition: buffer_view.h:60
 
Char_tp Char_t
Definition: buffer_view.h:52
 
Char_t * m_data
Pointer to the data.
Definition: buffer_view.h:149
 
const Char_t * Const_iterator_t
Definition: buffer_view.h:57
 
Const_iterator_t cend() const
Return const pointer to one-past-the-last character of the data.
Definition: buffer_view.h:109
 
Const_iterator_t end() const
Return pointer to one-past-the-last character of the data.
Definition: buffer_view.h:103
 
Iterator_t end()
Return pointer to one-past-the-last character of the data.
Definition: buffer_view.h:97
 
const Char_t * data() const
Return const pointer to the data.
Definition: buffer_view.h:88
 
std::size_t Size_t
The 'size' type.
Definition: buffer_view.h:55
 
Iterator_t begin()
Return pointer to the first character of the data.
Definition: buffer_view.h:94
 
Buffer_view()=default
Create a new "null Buffer_view": pointer is nullptr and size is 0.
 
Char_t * Iterator_t
Definition: buffer_view.h:56
 
Char_t * data()
Return non-const pointer to the data.
Definition: buffer_view.h:91
 
Size_t m_size
The number of bytes.
Definition: buffer_view.h:152
 
Size_t size() const
Return the number of bytes.
Definition: buffer_view.h:112
 
Const_iterator_t begin() const
Return pointer to the first character of the data.
Definition: buffer_view.h:100
 
std::basic_string< Str_char_t, Str_traits_t, Str_allocator_t > str(const Str_allocator_t &allocator=Str_allocator_t()) const
Return a copy of this object as a std::string.
Definition: buffer_view.h:118
 
Buffer_view(const Buffer_view &)=default
Shallow copy constructor.
 
std::string debug_string(bool show_contents=false) const
In debug mode, return a string with debug info.
Definition: buffer_view.h:128
 
Buffer_view(Buffer_view &&) noexcept=default
Default move constructor.
 
Const_iterator_t cbegin() const
Return const pointer to the first character of the data.
Definition: buffer_view.h:106
 
Definition: buffer_sequence_view.h:51
 
std::basic_ostringstream< char, std::char_traits< char >, ut::allocator< char > > ostringstream
Specialization of basic_ostringstream which uses ut::allocator.
Definition: ut0new.h:2875