MySQL  8.0.16
Source Code Documentation
Simple_cstring Class Reference

A wrapper class for null-terminated constant strings. More...

#include <sql_string.h>

Inheritance diagram for Simple_cstring:
Name_string Item_name_string

Public Member Functions

void set (const char *str_arg, size_t length_arg)
 Initialize from a C string whose length is already known. More...
 Simple_cstring ()
 Simple_cstring (const char *str_arg, size_t length_arg)
 Simple_cstring (const LEX_STRING arg)
void reset ()
void set (const char *str)
 Set to a null-terminated string. More...
const char * ptr () const
 Return string buffer. More...
bool is_set () const
 Check if m_ptr is set. More...
size_t length () const
 Return name length. More...
bool eq_bin (const Simple_cstring other) const
 Compare to another Simple_cstring. More...
void strcpy (char *buff) const
 Copy to the given buffer. More...

Private Attributes

const char * m_str
size_t m_length

Detailed Description

A wrapper class for null-terminated constant strings.

Constructors make sure that the position of the '\0' terminating byte in m_str is always in sync with m_length.

This class must stay as small as possible as we often pass it and its descendants (such as Name_string) into functions using call-by-value evaluation.

Don't add new members or virual methods into this class!

Constructor & Destructor Documentation

◆ Simple_cstring() [1/3]

Simple_cstring::Simple_cstring ( )

◆ Simple_cstring() [2/3]

Simple_cstring::Simple_cstring ( const char *  str_arg,
size_t  length_arg 

◆ Simple_cstring() [3/3]

Simple_cstring::Simple_cstring ( const LEX_STRING  arg)

Member Function Documentation

◆ eq_bin()

bool Simple_cstring::eq_bin ( const Simple_cstring  other) const

Compare to another Simple_cstring.

◆ is_set()

bool Simple_cstring::is_set ( ) const

Check if m_ptr is set.

◆ length()

size_t Simple_cstring::length ( ) const

Return name length.

◆ ptr()

const char* Simple_cstring::ptr ( ) const

Return string buffer.

◆ reset()

void Simple_cstring::reset ( )

◆ set() [1/2]

void Simple_cstring::set ( const char *  str_arg,
size_t  length_arg 

Initialize from a C string whose length is already known.

◆ set() [2/2]

void Simple_cstring::set ( const char *  str)

Set to a null-terminated string.

◆ strcpy()

void Simple_cstring::strcpy ( char *  buff) const

Copy to the given buffer.

Member Data Documentation

◆ m_length

size_t Simple_cstring::m_length

◆ m_str

const char* Simple_cstring::m_str

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