MySQL 5.6.14 Source Code Document
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
BaseString Class Reference

Null terminated strings. More...

#include <BaseString.hpp>

Public Member Functions

 BaseString ()
 Constructs an empty string.
 BaseString (const char *s)
 Constructs a copy of a char *.
 BaseString (const char *s, size_t len)
 Constructs a copy of a char * with length.
 BaseString (const BaseString &str)
 Constructs a copy of another BaseString.
 ~BaseString ()
 Destructor.
const char * c_str () const
 Returns a C-style string.
unsigned length () const
 Returns the length of the string.
bool empty () const
 Checks if the string is empty.
void clear ()
 Clear a string.
BaseStringndb_toupper ()
 Convert to uppercase.
BaseStringndb_tolower ()
 Convert to lowercase.
BaseStringassign (const char *s)
 Assigns from a char *.
BaseStringassign (const BaseString &str)
 Assigns from another BaseString.
BaseStringassign (const char *s, size_t n)
 Assigns from char *s, with maximum length n.
BaseStringassign (const BaseString &str, size_t n)
 Assigns from another BaseString, with maximum length n.
BaseStringassign (const Vector< BaseString > &vector, const BaseString &separator=BaseString(" "))
BaseStringappend (const char *s)
 Appends a char * to the end.
BaseStringappend (char c)
 Appends a char to the end.
BaseStringappend (const BaseString &str)
 Appends another BaseString to the end.
BaseStringappend (const Vector< BaseString > &vector, const BaseString &separator=BaseString(" "))
BaseStringassfmt (const char *ftm,...) ATTRIBUTE_FORMAT(printf
 Assigns from a format string a la printf()
BaseString BaseStringappfmt (const char *ftm,...) ATTRIBUTE_FORMAT(printf
 Appends a format string a la printf() to the end.
BaseString BaseString int split (Vector< BaseString > &vector, const BaseString &separator=BaseString(" "), int maxSize=-1) const
ssize_t indexOf (char c) const
ssize_t lastIndexOf (char c) const
BaseString substr (ssize_t start, ssize_t stop=-1) const
BaseStringoperator= (const BaseString &str)
 Assignment operator.
bool operator< (const BaseString &str) const
 Compare two strings.
bool operator== (const BaseString &str) const
 Are two strings equal?
bool operator== (const char *str) const
 Are two strings equal?
bool operator!= (const BaseString &str) const
 Are two strings not equal?
bool operator!= (const char *str) const
 Are two strings not equal?
BaseStringtrim (const char *delim=" \t")

Static Public Member Functions

static char ** argify (const char *argv0, const char *src)
static char * trim (char *src, const char *delim)
static int snprintf (char *str, size_t size, const char *format,...) ATTRIBUTE_FORMAT(printf
static int static int vsnprintf (char *str, size_t size, const char *format, va_list ap)
template<unsigned size>
static BaseString getText (const Bitmask< size > &mask)
template<unsigned size>
static BaseString getPrettyText (const Bitmask< size > &mask)
template<unsigned size>
static BaseString getPrettyTextShort (const Bitmask< size > &mask)
template<unsigned size>
static BaseString getText (const BitmaskPOD< size > &mask)
template<unsigned size>
static BaseString getPrettyText (const BitmaskPOD< size > &mask)
template<unsigned size>
static BaseString getPrettyTextShort (const BitmaskPOD< size > &mask)
static BaseString getText (unsigned size, const Uint32 data[])
static BaseString getPrettyText (unsigned size, const Uint32 data[])
static BaseString getPrettyTextShort (unsigned size, const Uint32 data[])

Friends

bool operator! (const BaseString &str)

Detailed Description

Null terminated strings.

Definition at line 29 of file BaseString.hpp.

Member Function Documentation

BaseString & BaseString::append ( const Vector< BaseString > &  vector,
const BaseString separator = BaseString(" ") 
)

Appends a Vector of BaseStrings to the end, each Vector entry separated by separator.

Parameters
vectorVector of BaseStrings to append
separatorSeparation between appended strings

Definition at line 197 of file BaseString.cpp.

Here is the call graph for this function:

char ** BaseString::argify ( const char *  argv0,
const char *  src 
)
static

Return c-array with strings suitable for execve When whitespace is detected, the characters '"' and '\' are honored, to make it possible to give arguments containing whitespace. The semantics of '"' and '\' match that of most Unix shells.

Definition at line 342 of file BaseString.cpp.

BaseString & BaseString::assign ( const Vector< BaseString > &  vector,
const BaseString separator = BaseString(" ") 
)
inline

Assings from a Vector of BaseStrings, each Vector entry separated by separator.

Parameters
vectorVector of BaseStrings to append
separatorSeparation between appended strings

Definition at line 320 of file BaseString.hpp.

Here is the call graph for this function:

ssize_t BaseString::indexOf ( char  c) const

Returns the index of the first occurance of the character c.

c character to look for

Returns
index of character, of -1 if no character found

Definition at line 300 of file BaseString.cpp.

ssize_t BaseString::lastIndexOf ( char  c) const

Returns the index of the last occurance of the character c.

c character to look for

Returns
index of character, of -1 if no character found

Definition at line 309 of file BaseString.cpp.

int BaseString::snprintf ( char *  str,
size_t  size,
const char *  format,
  ... 
)
static

snprintf on some platforms need special treatment

Definition at line 495 of file BaseString.cpp.

Here is the caller graph for this function:

int BaseString::split ( Vector< BaseString > &  vector,
const BaseString separator = BaseString(" "),
int  maxSize = -1 
) const

Split a string into a vector of strings. Separate the string where any character included in separator exists. Maximally maxSize entries are added to the vector, if more separators exist in the string, the remainder of the string will be appended to the last entry in the vector. The vector will not be cleared, so any existing strings in the vector will remain.

Parameters
separatorcharacters separating the entries
vectorwhere the separated strings will be stored
maximumnumber of strings extracted
Returns
the number of string added to the vector

Definition at line 277 of file BaseString.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

BaseString BaseString::substr ( ssize_t  start,
ssize_t  stop = -1 
) const

Returns a subset of a string

Parameters
startindex of first character
stopindex of last character
Returns
a new string

Definition at line 318 of file BaseString.cpp.

Here is the call graph for this function:

BaseString & BaseString::trim ( const char *  delim = " \t")

Trim string from delim

Definition at line 461 of file BaseString.cpp.

Here is the caller graph for this function:

char * BaseString::trim ( char *  src,
const char *  delim 
)
static

Trim string from delim

Definition at line 468 of file BaseString.cpp.


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