Overview
Examples
Screenshots
Comparisons
Applications
Download
Documentation
Bazaar
Status & Roadmap
FAQ
Authors & License
Forums
Funding Ultimate++
Search on this site
Language
English













SourceForge.net Logo



StringBuffer

 

class StringBuffer : private NoCopy

A class useful when working with code that expects a character buffer, like C code. It supports constant time pick assignment to and from String.

 

 

Constructor Detail

 

StringBuffer()

Constructs empty buffer.

 


 

StringBuffer(int len)

Constructs buffer of len characters.

 


 

StringBuffer(String& s)

Assigns content of s to StringBuffer. Clears s.

 


 

~StringBuffer()

Default destructor.

 

 

Public Method List

 

char *Begin()

Returns a pointer to the buffer of characters. Mutating operations invalidate this pointer.

 


 

char *End()

Returns Begin() + GetCount(). Mutating operations invalidate this pointer.

 


 

void Cat(int c)

Appends single character c.

 


 

void Cat(int c, int count)

Appends count characters c.

 


 

void Cat(const char *s)

void Cat(const String& s)

Appends the string s.

 


 

void Cat(const char *s, int l)

Appends the first l characters of s.

 


 

int GetLength() const

int GetCount() const

Returns the number of characters in the buffer.

 


 

void SetLength(int l)

void SetCount(int l)

Sets the length of the character buffer to l.

 


 

void Strlen()

Sets the length of the character buffer to the length of the zero terminated string stored in the buffer (up to the first zero character). Useful for converting C strings returned from system to String.

 


 

void Clear()

Clears the contents of the string buffer.

 


 

void Reserve(int r)

Preallocates internal buffer (avoids resizing of internal buffer up to r characters).

 


 

int GetAlloc() const

Returns the maximum number of characters in the internal buffer.

 


 

operator char*()

char *operator~()

Returns Begin().

 


 

void operator=(String& s)

Clears the string buffer and assigns the content of s. Clears s.

 

 

 

 

WStringBuffer

 

class WStringBuffer : private NoCopy

A class useful when working with code that expects a wide character buffer, like C code. It supports constant time pick assignment to and from WString.

 

 

Constructor Detail

 

WStringBuffer()

Constructs empty buffer.

 


 

WStringBuffer(int len)

Constructs buffer of len characters.

 


 

WStringBuffer(WString& s)

Assigns content of s to StringBuffer. Clears s.

 


 

~WStringBuffer()

Default destructor.

 

 

Public Method List

 

wchar *Begin()

Returns a pointer to the buffer of characters. Mutating operations invalidate this pointer.

 


 

wchar *End()

Returns Begin() + GetCount(). Mutating operations invalidate this pointer.

 


 

void Cat(int c)

Appends single character c.

 


 

void Cat(int c, int count)

Appends count characters c.

 


 

void Cat(const wchar *s)

void Cat(const WString& s)

void Cat(const char *s)

Appends the string s.

 


 

void Cat(const wchar *s, int l)

Appends the first l characters of s.

 


 

int GetLength() const

int GetCount() const

Returns the number of characters in the buffer.

 


 

void SetLength(int l)

void SetCount(int l)

Sets the length of the character buffer to l.

 


 

void Strlen()

Sets the length of the character buffer to the length of the zero terminated string stored in the buffer (up to the first zero character). Useful for converting C strings returned from system to String.

 


 

void Clear()

Clears the contents of the string buffer.

 


 

void Reserve(int r)

Preallocates internal buffer (avoids resizing of internal buffer up to r characters).

 


 

int GetAlloc() const

Returns the maximum number of characters in the internal buffer.

 


 

operator wchar*()

wchar *operator~()

Returns Begin().

 


 

void operator=(WString& s)

Clears the string buffer and assigns the content of s. Clears s.

 

 

Last edit by cxl on 11/10/2012. Do you want to contribute?. T++