MySQL 9.0.0
Source Code Documentation
StringBuffer_ostream< BUFFER_SIZE > Class Template Reference

A basic output stream based on StringBuffer class. More...

#include <basic_ostream.h>

Inheritance diagram for StringBuffer_ostream< BUFFER_SIZE >:
[legend]

Public Member Functions

 StringBuffer_ostream ()=default
 
 StringBuffer_ostream (const StringBuffer_ostream &)=delete
 
StringBuffer_ostreamoperator= (const StringBuffer_ostream &)=delete
 
bool write (const unsigned char *buffer, my_off_t length) override
 Write some bytes into the output stream. More...
 
- Public Member Functions inherited from Basic_ostream
virtual ~Basic_ostream ()=default
 
- Public Member Functions inherited from StringBuffer< BUFFER_SIZE >
 StringBuffer ()
 
 StringBuffer (const CHARSET_INFO *cs)
 
 StringBuffer (const char *str, size_t length, const CHARSET_INFO *cs)
 
- Public Member Functions inherited from String
 String ()
 
 String (size_t length_arg)
 
 String (const char *str, const CHARSET_INFO *cs)
 
 String (const char *str, size_t len, const CHARSET_INFO *cs)
 
 String (char *str, size_t len, const CHARSET_INFO *cs)
 
 String (const String &str)
 
 String (String &&str) noexcept
 
 ~String ()
 
void set_charset (const CHARSET_INFO *charset_arg)
 
const CHARSET_INFOcharset () const
 
size_t length () const
 
size_t alloced_length () const
 
const char & operator[] (size_t i) const
 
char & operator[] (size_t i)
 
void length (size_t len)
 
bool is_empty () const
 
void mark_as_const ()
 
const char * ptr () const
 
char * ptr ()
 
char * c_ptr ()
 
char * c_ptr_quick ()
 
char * c_ptr_safe ()
 Returns a pointer to a C-style null-terminated string. More...
 
LEX_STRING lex_string ()
 
LEX_CSTRING lex_cstring () const
 
void set (String &str, size_t offset, size_t arg_length)
 
void set (char *str, size_t arg_length, const CHARSET_INFO *cs)
 Points the internal buffer to the supplied one. More...
 
void set (const char *str, size_t arg_length, const CHARSET_INFO *cs)
 
bool set_ascii (const char *str, size_t arg_length)
 
void set_quick (char *str, size_t arg_length, const CHARSET_INFO *cs)
 
bool set_int (longlong num, bool unsigned_flag, const CHARSET_INFO *cs)
 
bool set (longlong num, const CHARSET_INFO *cs)
 
bool set (ulonglong num, const CHARSET_INFO *cs)
 
bool set_real (double num, uint decimals, const CHARSET_INFO *cs)
 Sets the contents of this string to the string representation of the given double value. More...
 
void chop ()
 
void mem_claim (bool claim)
 
void mem_free ()
 
bool alloc (size_t arg_length)
 
bool real_alloc (size_t arg_length)
 
bool mem_realloc (size_t arg_length, bool force_on_heap=false)
 Allocates a new buffer on the heap for this String. More...
 
void shrink (size_t arg_length)
 
bool is_alloced () const
 
Stringoperator= (const String &s)
 
Stringoperator= (String &&s) noexcept
 
void takeover (String &s)
 Takeover the buffer owned by another string. More...
 
bool copy ()
 
bool copy (const String &s)
 Copies the internal buffer from str. More...
 
bool copy (const char *s, size_t arg_length, const CHARSET_INFO *cs)
 
bool copy (const char *s, size_t arg_length, const CHARSET_INFO *from_cs, const CHARSET_INFO *to_cs, uint *errors)
 Copies the character data into this String, with optional character set conversion. More...
 
bool needs_conversion (const CHARSET_INFO *cs_to) const
 
bool is_valid_string (const CHARSET_INFO *cs_to) const
 
bool copy_aligned (const char *s, size_t arg_length, size_t offset, const CHARSET_INFO *cs)
 
bool set_or_copy_aligned (const char *s, size_t arg_length, const CHARSET_INFO *cs)
 
bool append (const String &s)
 
bool append (std::string_view s)
 
bool append (LEX_STRING *ls)
 
bool append (Simple_cstring str)
 
bool append (const char *s, size_t arg_length)
 
bool append (const char *s, size_t arg_length, const CHARSET_INFO *cs)
 
bool append_ulonglong (ulonglong val)
 Append an unsigned longlong to the string. More...
 
bool append_longlong (longlong val)
 Append a signed longlong to the string. More...
 
bool append_with_prefill (const char *s, size_t arg_length, size_t full_length, char fill_char)
 
bool append_parenthesized (int64_t nr)
 Append a parenthesized number to String. More...
 
int strstr (const String &search, size_t offset=0) const
 Search for a substring. More...
 
int strrstr (const String &search, size_t offset=0) const
 Reverse search for a substring. More...
 
String substr (int offset, int count) const
 Returns substring of given characters length, starting at given character offset. More...
 
bool replace (size_t offset, size_t arg_length, const char *to, size_t length)
 
bool replace (size_t offset, size_t arg_length, const String &to)
 
bool append (char chr)
 
bool fill (size_t max_length, char fill)
 
size_t numchars () const
 
size_t charpos (size_t i, size_t offset=0) const
 
bool reserve (size_t space_needed)
 
bool reserve (size_t space_needed, size_t grow_by)
 
char * prep_append (size_t arg_length, size_t step_alloc)
 
bool append (const char *s, size_t arg_length, size_t step_alloc)
 
void print (String *print) const
 
void swap (String &s) noexcept
 
bool uses_buffer_owned_by (const String *s) const
 
bool is_ascii () const
 
char * dup (MEM_ROOT *root) const
 Make a zero-terminated copy of our value,allocated in the specified MEM_ROOT. More...
 

Additional Inherited Members

- Static Public Member Functions inherited from String
static void * operator new (size_t size, MEM_ROOT *mem_root, const std::nothrow_t &arg=std::nothrow) noexcept
 
static void operator delete (void *ptr_arg, size_t size)
 
static void operator delete (void *, MEM_ROOT *, const std::nothrow_t &) noexcept
 
static bool needs_conversion (size_t arg_length, const CHARSET_INFO *cs_from, const CHARSET_INFO *cs_to, size_t *offset)
 Checks that the source string can be just copied to the destination string without conversion. More...
 
static bool needs_conversion_on_storage (size_t arg_length, const CHARSET_INFO *cs_from, const CHARSET_INFO *cs_to)
 

Detailed Description

template<int BUFFER_SIZE>
class StringBuffer_ostream< BUFFER_SIZE >

A basic output stream based on StringBuffer class.

It has a stack buffer of size BUFFER_SIZE. It will allocate memory to create a heap buffer if data exceeds the size of heap buffer.

Constructor & Destructor Documentation

◆ StringBuffer_ostream() [1/2]

template<int BUFFER_SIZE>
StringBuffer_ostream< BUFFER_SIZE >::StringBuffer_ostream ( )
default

◆ StringBuffer_ostream() [2/2]

template<int BUFFER_SIZE>
StringBuffer_ostream< BUFFER_SIZE >::StringBuffer_ostream ( const StringBuffer_ostream< BUFFER_SIZE > &  )
delete

Member Function Documentation

◆ operator=()

template<int BUFFER_SIZE>
StringBuffer_ostream & StringBuffer_ostream< BUFFER_SIZE >::operator= ( const StringBuffer_ostream< BUFFER_SIZE > &  )
delete

◆ write()

template<int BUFFER_SIZE>
bool StringBuffer_ostream< BUFFER_SIZE >::write ( const unsigned char *  buffer,
my_off_t  length 
)
inlineoverridevirtual

Write some bytes into the output stream.

When all data is written into the stream successfully, then it return false. Otherwise, true is returned. It will never returns false when partial data is written into the stream.

Parameters
[in]bufferData to be written
[in]lengthLength of the data
Return values
falseSuccess.
trueError.

Implements Basic_ostream.


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