Main Page   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members  

skStringBuffer Class Reference

This class provides an expandable buffer for textual characters. More...

#include <skStringBuffer.h>

List of all members.

Public Methods

 skStringBuffer (USize capacity, USize growth_increment=16)
 Constructs a blank buffer of the given capacity. More...

 skStringBuffer (const skString &s, USize growth_increment=16)
 Constructs a buffer from the given string. More...

 skStringBuffer (const skStringBuffer &s)
 Copy constructor - it takes a copy of the underlying buffer. More...

 ~skStringBuffer ()
 Destroys the underlying character buffer.

skStringBuffer & operator= (const skStringBuffer &s)
 Assignment operator- it takes a copy of the underlying buffer. More...

void append (Char ch)
 Adds a character to the buffer, growing it if necessary. More...

void append (const skString &s)
 Adds a string to the buffer, growing it if necessary. More...

void append (const Char *s)
 Adds a string to the buffer, growing it if necessary. More...

skString toString ()
 Creates a new string that owns the underlying buffer. More...

skString toStringCopy () const
 Creates a new string that copies the underlying buffer. More...

 operator const Char * () const
 Returns the underlying buffer. More...

USize length () const
 Returns the current length of the text in the buffer. More...

USize capacity () const
 Returns the current capacity the buffer. More...


Detailed Description

This class provides an expandable buffer for textual characters.


Constructor & Destructor Documentation

skStringBuffer::skStringBuffer USize    length,
USize    growth_increment = 16
 

Constructs a blank buffer of the given capacity.

The buffer's length will be zero.

Parameters:
capacity  - the capacity of the buffer to create. This can be zero
growth_increment  - the minimum amount to grow the buffer by if it is enlarged

skStringBuffer::skStringBuffer const skString   str,
USize    growth_increment = 16
 

Constructs a buffer from the given string.

The string's data will be copied. The buffer's initial capacity and length will be the length of the string.

Parameters:
s  - the string to copy
growth_increment  - the minimum amount to grow the buffer by if it is enlarged

skStringBuffer::skStringBuffer const skStringBuffer &    s
 

Copy constructor - it takes a copy of the underlying buffer.

Parameters:
s  - the other string buffer. A copy is taken of its underlying buffer


Member Function Documentation

void skStringBuffer::append const Char *    s
 

Adds a string to the buffer, growing it if necessary.

Parameters:
s  - the string to append to the end of the current buffer

void skStringBuffer::append const skString   s
 

Adds a string to the buffer, growing it if necessary.

Parameters:
s  - the string to append to the end of the current buffer

void skStringBuffer::append Char    ch
 

Adds a character to the buffer, growing it if necessary.

Parameters:
ch  - the character to add

USize skStringBuffer::capacity   const
 

Returns the current capacity the buffer.

Returns:
the capacity of the buffer

USize skStringBuffer::length   const
 

Returns the current length of the text in the buffer.

Returns:
the length of the text in the buffer

skStringBuffer::operator const Char *   const
 

Returns the underlying buffer.

Returns:
a pointer to the underlying buffer

skStringBuffer & skStringBuffer::operator= const skStringBuffer &    s
 

Assignment operator- it takes a copy of the underlying buffer.

Parameters:
s  - the other string buffer. A copy is taken of its underlying buffer

skString skStringBuffer::toString  
 

Creates a new string that owns the underlying buffer.

The current buffer is set to null.

Returns:
a string which owns the current buffer

skString skStringBuffer::toStringCopy   const
 

Creates a new string that copies the underlying buffer.

The current buffer remains the same

Returns:
a string which copies the current buffer


The documentation for this class was generated from the following files:
Generated on Tue Nov 20 17:56:22 2001 for Simkin by doxygen1.2.11.1 written by Dimitri van Heesch, © 1997-2001