MySQL 8.3.0
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:
[legend]

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)
 
 Simple_cstring (const LEX_CSTRING 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 virtual methods to this class!

Constructor & Destructor Documentation

◆ Simple_cstring() [1/4]

Simple_cstring::Simple_cstring ( )
inline

◆ Simple_cstring() [2/4]

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

◆ Simple_cstring() [3/4]

Simple_cstring::Simple_cstring ( const LEX_STRING  arg)
inline

◆ Simple_cstring() [4/4]

Simple_cstring::Simple_cstring ( const LEX_CSTRING  arg)
inline

Member Function Documentation

◆ eq_bin()

bool Simple_cstring::eq_bin ( const Simple_cstring  other) const
inline

Compare to another Simple_cstring.

◆ is_set()

bool Simple_cstring::is_set ( ) const
inline

Check if m_ptr is set.

◆ length()

size_t Simple_cstring::length ( ) const
inline

Return name length.

◆ ptr()

const char * Simple_cstring::ptr ( ) const
inline

Return string buffer.

◆ reset()

void Simple_cstring::reset ( )
inline

◆ set() [1/2]

void Simple_cstring::set ( const char *  str)
inline

Set to a null-terminated string.

◆ set() [2/2]

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

Initialize from a C string whose length is already known.

◆ strcpy()

void Simple_cstring::strcpy ( char *  buff) const
inline

Copy to the given buffer.

Member Data Documentation

◆ m_length

size_t Simple_cstring::m_length
private

◆ m_str

const char* Simple_cstring::m_str
private

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