#include <tlstring.h>
Collaboration diagram for TLString::SData:
Public Member Functions | |
void | DownSizeIfNeeded (size_t s) |
void | _EnsureSize (size_t s) |
void | _DoTightenSize () |
void | EnsureSize (size_t s) |
void | TightenSize () |
SData (const char *str) | |
SData (const char *str, size_t len) | |
SData (const SData &s) | |
SData (size_t ensure_size) | |
Create internal data with at least passed size. | |
~SData () | |
Destroy internal data freeing the string memory. | |
Static Public Member Functions | |
size_t | RoundUp (size_t s) |
Round up for allocation: next higher 8 byte boundary. | |
size_t | GrowRoundUp (size_t s) |
Public Attributes | |
AtomicInt | refcnt |
used for reference counting | |
char * | str |
NUL-terminated string is stored here. | |
size_t | len |
length of string; s[l]=NUL. | |
size_t | asize |
amount of memory allocated under str[]. |
Definition at line 62 of file tlstring.h.
|
Create internal data and store passed string (!=NULL) in there. Created with ref count 1! Definition at line 77 of file tlstring.cc. |
|
Definition at line 86 of file tlstring.cc. |
|
Create internal data by _copying_ passed data. Created with ref count 1! Definition at line 95 of file tlstring.cc. |
|
Create internal data with at least passed size.
Definition at line 104 of file tlstring.cc. References asize, GrowRoundUp(), len, and str. |
|
Destroy internal data freeing the string memory.
Definition at line 110 of file tlstring.h. |
|
For internal use only. Internally used by TightenSize(). Definition at line 50 of file tlstring.cc. References asize, Assert, len, REALLOC(), refcnt, str, and AtomicInt::val(). Referenced by TightenSize(). |
|
For internal use only. Internally used by EnsureSize(). Definition at line 33 of file tlstring.cc. References asize, Assert, GrowRoundUp(), REALLOC(), refcnt, str, and AtomicInt::val(). Referenced by TLString::append(), EnsureSize(), and TLString::prepend(). |
|
Make allocated chunk smaller if too much memory is allocated. Only call if refcnt=1. Definition at line 60 of file tlstring.cc. References asize, Assert, GrowRoundUp(), REALLOC(), refcnt, str, and AtomicInt::val(). Referenced by TLString::ParseString(), TLString::skip(), and TLString::trunc(). |
|
Make sure that the passed amount of data can be stored. Only call if refcnt=1. Definition at line 92 of file tlstring.h. References _EnsureSize(), and asize. Referenced by TLString::vsprintf(). |
|
Size of growing string; Call when re-allocating the pointer, so allocat a bit too much so that we probably need not realloc the next time. Definition at line 78 of file tlstring.h. References RoundUp(). Referenced by _EnsureSize(), DownSizeIfNeeded(), and SData(). |
|
Round up for allocation: next higher 8 byte boundary.
Definition at line 70 of file tlstring.h. Referenced by GrowRoundUp(), and SData(). |
|
Make sure the size is as small as possible. Only call if refcnt=1. Definition at line 97 of file tlstring.h. References _DoTightenSize(), asize, and len. Referenced by TLString::TightenSize(). |
|
amount of memory allocated under str[].
Definition at line 67 of file tlstring.h. Referenced by _DoTightenSize(), _EnsureSize(), DownSizeIfNeeded(), EnsureSize(), TLString::ParseString(), SData(), TightenSize(), TLString::TightenSize(), and TLString::vsprintf(). |
|
length of string; s[l]=NUL.
Definition at line 66 of file tlstring.h. Referenced by _DoTightenSize(), TLString::append(), TLString::compare(), TLString::find(), TLString::index(), TLString::length(), TLString::operator[](), TLString::ParseString(), TLString::prepend(), TLString::rfind(), TLString::rindex(), SData(), TLString::skip(), TightenSize(), TLString::TLString(), TLString::trunc(), TLString::vsprintf(), and TLString::zero(). |
|
used for reference counting
Definition at line 64 of file tlstring.h. Referenced by TLString::_aqref(), TLString::_aqrefN(), TLString::_deref(), TLString::_derefN(), TLString::_detachN(), _DoTightenSize(), _EnsureSize(), DownSizeIfNeeded(), TLString::skip(), TLString::TightenSize(), TLString::trunc(), TLString::vsprintf(), and TLString::zero(). |
|
NUL-terminated string is stored here.
Definition at line 65 of file tlstring.h. Referenced by _DoTightenSize(), _EnsureSize(), TLString::append(), TLString::compare(), DownSizeIfNeeded(), TLString::find(), TLString::index(), TLString::operator[](), TLString::ParseString(), TLString::prepend(), TLString::rfind(), TLString::rindex(), SData(), TLString::skip(), TLString::str(), TLString::TLString(), TLString::trunc(), TLString::vsprintf(), TLString::zero(), and ~SData(). |