My Project
Public Member Functions | Static Public Member Functions | Friends
String Class Reference
Inheritance diagram for String:
StringBuffer< buff_sz > XPathFilter

List of all members.

Public Member Functions

 String (uint32 length_arg)
 String (const char *str, const CHARSET_INFO *cs)
 String (const char *str, uint32 len, const CHARSET_INFO *cs)
 String (char *str, uint32 len, const CHARSET_INFO *cs)
 String (const String &str)
void set_charset (const CHARSET_INFO *charset_arg)
const CHARSET_INFO * charset () const
uint32 length () const
uint32 alloced_length () const
char & operator[] (uint32 i) const
void length (uint32 len)
bool is_empty () const
void mark_as_const ()
const char * ptr () const
char * c_ptr ()
char * c_ptr_quick ()
char * c_ptr_safe ()
LEX_STRING lex_string () const
void set (String &str, uint32 offset, uint32 arg_length)
void set (char *str, uint32 arg_length, const CHARSET_INFO *cs)
void set (const char *str, uint32 arg_length, const CHARSET_INFO *cs)
bool set_ascii (const char *str, uint32 arg_length)
void set_quick (char *str, uint32 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)
void chop ()
void free ()
bool alloc (uint32 arg_length)
bool real_alloc (uint32 arg_length)
bool realloc (uint32 arg_length)
void shrink (uint32 arg_length)
bool is_alloced () const
Stringoperator= (const String &s)
void takeover (String &s)
bool copy ()
bool copy (const String &s)
bool copy (const char *s, uint32 arg_length, const CHARSET_INFO *cs)
bool copy_aligned (const char *s, uint32 arg_length, uint32 offset, const CHARSET_INFO *cs)
bool set_or_copy_aligned (const char *s, uint32 arg_length, const CHARSET_INFO *cs)
bool copy (const char *s, uint32 arg_length, const CHARSET_INFO *csfrom, const CHARSET_INFO *csto, uint *errors)
bool append (const String &s)
bool append (const char *s)
bool append (LEX_STRING *ls)
bool append (Simple_cstring str)
bool append (const char *s, uint32 arg_length)
bool append (const char *s, uint32 arg_length, const CHARSET_INFO *cs)
bool append_ulonglong (ulonglong val)
bool append (IO_CACHE *file, uint32 arg_length)
bool append_with_prefill (const char *s, uint32 arg_length, uint32 full_length, char fill_char)
bool append_parenthesized (long nr, int radix=10)
int strstr (const String &search, uint32 offset=0)
int strrstr (const String &search, uint32 offset=0)
bool replace (uint32 offset, uint32 arg_length, const char *to, uint32 length)
bool replace (uint32 offset, uint32 arg_length, const String &to)
bool append (char chr)
bool fill (uint32 max_length, char fill)
void strip_sp ()
uint32 numchars () const
int charpos (int i, uint32 offset=0)
int reserve (uint32 space_needed)
int reserve (uint32 space_needed, uint32 grow_by)
void q_append (const char c)
void q_append (const uint32 n)
void q_append (double d)
void q_append (double *d)
void q_append (const char *data, uint32 data_len)
void write_at_position (int position, uint32 value)
void qs_append (const char *str, uint32 len)
void qs_append (double d)
void qs_append (double *d)
void qs_append (const char c)
void qs_append (int i)
void qs_append (uint i)
char * prep_append (uint32 arg_length, uint32 step_alloc)
bool append (const char *s, uint32 arg_length, uint32 step_alloc)
void print (String *print)
void swap (String &s)
bool uses_buffer_owned_by (const String *s) const
bool is_ascii () const
char * dup (MEM_ROOT *root) const

Static Public Member Functions

static void * operator new (size_t size, MEM_ROOT *mem_root) throw ()
static void operator delete (void *ptr_arg, size_t size)
static void operator delete (void *, MEM_ROOT *)
static bool needs_conversion (uint32 arg_length, const CHARSET_INFO *cs_from, const CHARSET_INFO *cs_to, uint32 *offset)
static bool needs_conversion_on_storage (uint32 arg_length, const CHARSET_INFO *cs_from, const CHARSET_INFO *cs_to)


int sortcmp (const String *a, const String *b, const CHARSET_INFO *cs)
int stringcmp (const String *a, const String *b)
Stringcopy_if_not_alloced (String *a, String *b, uint32 arg_length)

Member Function Documentation

bool String::append_parenthesized ( long  nr,
int  radix = 10 

Append a parenthesized number to String. Used in various pieces of SHOW related code.

radixRadix, optional parameter, 10 by default.
bool String::copy ( const String str)

Copies the internal buffer from str. If this String has a private heap allocated buffer where new data does not fit, a new buffer is allocated before copying and the old buffer freed. Character set information is also copied.

strThe string whose internal buffer is to be copied.
Return values:
trueMemory allocation failed.
bool String::copy ( const char *  str,
uint32  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.

FALSE ok TRUE Could not allocate result buffer
char* String::dup ( MEM_ROOT *  root) const [inline]

Make a zero-terminated copy of our value,allocated in the specified MEM_ROOT

rootMEM_ROOT to allocate the result
allocated string or NULL
bool String::realloc ( uint32  alloc_length)

Allocates a new buffer on the heap for this String.

  • If the String's internal buffer is privately owned and heap allocated, one of the following is performed.
  • If the requested length is greater than what fits in the buffer, a new buffer is allocated, data moved and the old buffer freed.
  • If the requested length is less or equal to what fits in the buffer, a null character is inserted at the appropriate position.
  • If the String does not keep a private buffer on the heap, such a buffer will be allocated and the string copied accoring to its length, as found in String::length().

For C compatibility, the new string buffer is null terminated.

alloc_lengthThe requested string size in characters, excluding any null terminator.
Return values:
falseEither the copy operation is complete or, if the size of the new buffer is smaller than the currently allocated buffer (if one exists), no allocation occured.
trueAn error occured when attempting to allocate memory.
void String::set ( char *  str,
uint32  arg_length,
const CHARSET_INFO *  cs 
) [inline]

Points the internal buffer to the supplied one. The old buffer is freed.

strPointer to the new buffer.
arg_lengthLength of the new buffer in characters, excluding any null character.
csCharacter set to use for interpreting string data.
The new buffer will not be null terminated.
void String::takeover ( String s) [inline]

Takeover the buffer owned by another string. "this" becames the owner of the buffer and is further responsible to free it. The string "s" is detouched from the buffer (cleared).

s- a String object to steal buffer from.

The documentation for this class was generated from the following files:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines