28 #include "lib/charbuf.h" 103 buf =
new char[size];
116 unsigned int tempsize =
cursize;
129 unsigned int offset =
ptr -
buf;
130 char *temp =
new char[
cursize];
141 if (
cursize < blocksize * blocks) {
147 unsigned int tptr =
ptr -
buf;
148 char *temp =
new char[blocksize * blocks];
189 while ((*
ptr++ = *s++))
206 unsigned int n = count;
213 while ((*
ptr++ = *source++));
234 int len =
StrLen(string
) *
sizeof(
char);
void Append(const char c)
bool Is(const char *string)
Compare content of CharBuffer with string)
bool RemoveTrailing(const char c)
CharBuffer(unsigned int size)
Initialize while allocating specified amount of memory.
void ClearBuffer()
Release memory in buffer.
bool RemoveTrailing(const char *string)
void Append(const char *source)
CharBuffer()
Initialize without allocating memory.
bool StrIsEqual(const char *s1, const char *s2)
Compare two null terminated strings to each other.
unsigned int AllocAndCopy(char **destination, const char *source)
Allocate memory and copy a string into the array.
void EnsureGrowth(unsigned int size)
int StrLen(const char *string)
Get the length of a null terminated string.
void Copy(CharBuffer *buf)
void ClearAndCopy(const char *source)
Release memory, allocate and copy source.
void EnsureSize(unsigned int blocksize, unsigned int blocks)
void Append(const char c, unsigned int count)
static const unsigned int minimumSize
Encapsulate an character array which can be used as a string.
void EnsureSize(unsigned int size)
Ensure a memory block of speficied size is allocated.
void MemCopy(void *destination, const void *source, unsigned int length)
Copy a block of memory, handling overlap.
void ClearAndAlloc(unsigned int size)
Release memory and allocate new size.