Rudiments
Public Member Functions | List of all members
wstringbuffer Class Reference

Inherits bytebuffer.

Public Member Functions

 wstringbuffer ()
 
 wstringbuffer (size_t initialsize)
 
 wstringbuffer (wchar_t *initialcontents, size_t initialsize)
 
 wstringbuffer (const wstringbuffer &s)
 
wstringbufferoperator= (const wstringbuffer &s)
 
 ~wstringbuffer ()
 
void setPosition (size_t pos)
 
size_t getPosition ()
 
ssize_t write (const wchar_t *string)
 
ssize_t write (const wchar_t *string, size_t length)
 
ssize_t write (wchar_t character)
 
ssize_t write (int16_t number)
 
ssize_t write (int32_t number)
 
ssize_t write (int64_t number)
 
ssize_t write (uint16_t number)
 
ssize_t write (uint32_t number)
 
ssize_t write (uint64_t number)
 
ssize_t write (float number)
 
ssize_t write (float number, uint16_t scale)
 
ssize_t write (float number, uint16_t precision, uint16_t scale)
 
ssize_t write (double number)
 
ssize_t write (double number, uint16_t scale)
 
ssize_t write (double number, uint16_t precision, uint16_t scale)
 
wstringbufferappend (const wchar_t *string)
 
wstringbufferappend (const wchar_t *string, size_t length)
 
wstringbufferappend (wchar_t character)
 
wstringbufferappend (int16_t number)
 
wstringbufferappend (int32_t number)
 
wstringbufferappend (int64_t number)
 
wstringbufferappend (uint16_t number)
 
wstringbufferappend (uint32_t number)
 
wstringbufferappend (uint64_t number)
 
wstringbufferappend (int16_t number, uint16_t zeropadding)
 
wstringbufferappend (int32_t number, uint16_t zeropadding)
 
wstringbufferappend (int64_t number, uint16_t zeropadding)
 
wstringbufferappend (uint16_t number, uint16_t zeropadding)
 
wstringbufferappend (uint32_t number, uint16_t zeropadding)
 
wstringbufferappend (uint64_t number, uint16_t zeropadding)
 
wstringbufferappend (float number)
 
wstringbufferappend (float number, uint16_t scale)
 
wstringbufferappend (float number, uint16_t precision, uint16_t scale)
 
wstringbufferappend (double number)
 
wstringbufferappend (double number, uint16_t scale)
 
wstringbufferappend (double number, uint16_t precision, uint16_t scale)
 
void truncate (size_t pos)
 
void truncate ()
 
void clear ()
 
void clear (size_t initialsize)
 
void clear (wchar_t *initialcontents, size_t initialsize)
 
const wchar_t * getString ()
 
wchar_t * detachString ()
 
size_t getStringLength ()
 
- Public Member Functions inherited from bytebuffer
 bytebuffer ()
 
 bytebuffer (size_t initialsize)
 
 bytebuffer (unsigned char *initialcontents, size_t initialsize)
 
 bytebuffer (const bytebuffer &v)
 
bytebufferoperator= (const bytebuffer &v)
 
virtual ~bytebuffer ()
 
void setPosition (size_t pos)
 
size_t getPosition ()
 
ssize_t write (const unsigned char *data, size_t size)
 
ssize_t write (const char *string, size_t length)
 
ssize_t write (const char *string)
 
ssize_t write (const wchar_t *string, size_t length)
 
ssize_t write (const wchar_t *string)
 
ssize_t write (char character)
 
ssize_t write (wchar_t character)
 
ssize_t write (unsigned char character)
 
ssize_t writeFormatted (const char *format,...)
 
ssize_t writeFormatted (const char *format, va_list *argp)
 
ssize_t writeFormatted (const wchar_t *format,...)
 
ssize_t writeFormatted (const wchar_t *format, va_list *argp)
 
bytebufferappend (const unsigned char *data, size_t size)
 
bytebufferappend (const char *string, size_t length)
 
bytebufferappend (const char *string)
 
bytebufferappend (const wchar_t *string, size_t length)
 
bytebufferappend (const wchar_t *string)
 
bytebufferappend (char character)
 
bytebufferappend (wchar_t character)
 
bytebufferappend (int16_t number)
 
bytebufferappend (int32_t number)
 
bytebufferappend (int64_t number)
 
bytebufferappend (unsigned char character)
 
bytebufferappend (uint16_t number)
 
bytebufferappend (uint32_t number)
 
bytebufferappend (uint64_t number)
 
bytebufferappend (float number)
 
bytebufferappend (double number)
 
bytebufferappendFormatted (const char *format,...)
 
bytebufferappendFormatted (const char *format, va_list *argp)
 
bytebufferappendFormatted (const wchar_t *format,...)
 
bytebufferappendFormatted (const wchar_t *format, va_list *argp)
 
ssize_t read (unsigned char *data, size_t size)
 
void clear ()
 
void clear (size_t initialsize)
 
void clear (unsigned char *initialcontents, size_t initialsize)
 
const unsigned char * getBuffer ()
 
size_t getSize ()
 
size_t getActualSize ()
 
size_t getInitialSize ()
 
unsigned char * detachBuffer ()
 
- Public Member Functions inherited from output
virtual ssize_t write (const unsigned char *string, size_t size, int32_t sec, int32_t usec)
 
virtual ssize_t write (const char *string, int32_t sec, int32_t usec)
 
virtual ssize_t write (const char *string, size_t length, int32_t sec, int32_t usec)
 
virtual ssize_t write (char character, int32_t sec, int32_t usec)
 
virtual ssize_t write (int16_t number, int32_t sec, int32_t usec)
 
virtual ssize_t write (int32_t number, int32_t sec, int32_t usec)
 
virtual ssize_t write (int64_t number, int32_t sec, int32_t usec)
 
virtual ssize_t write (unsigned char character, int32_t sec, int32_t usec)
 
virtual ssize_t write (uint16_t number, int32_t sec, int32_t usec)
 
virtual ssize_t write (uint32_t number, int32_t sec, int32_t usec)
 
virtual ssize_t write (uint64_t number, int32_t sec, int32_t usec)
 
virtual ssize_t write (float number, int32_t sec, int32_t usec)
 
virtual ssize_t write (double number, int32_t sec, int32_t usec)
 

Detailed Description

The wstringbuffer class can be used to store wide strings of arbitrary length.

It is generally more efficient to reuse the same wstringbuffer over and over than to allocate a new one for each operation.

Constructor & Destructor Documentation

◆ wstringbuffer() [1/4]

wstringbuffer::wstringbuffer ( )
inline

Creates an instance of the wstringbuffer class with default initial size.

◆ wstringbuffer() [2/4]

wstringbuffer::wstringbuffer ( size_t  initialsize)
inline

Creates an instance of the wstringbuffer class with the specified "initialsize".

◆ wstringbuffer() [3/4]

wstringbuffer::wstringbuffer ( wchar_t *  initialcontents,
size_t  initialsize 
)
inline

Creates an instance of the wstringbuffer class. The buffer "initialcontents" will be attached to the instance and used as the initial contents. This buffer should not be freed by the calling program. The initial size may be specified by the "initialsize" parameter.

◆ wstringbuffer() [4/4]

wstringbuffer::wstringbuffer ( const wstringbuffer s)
inline

Creates an instance of the wstringbuffer class that is a copy of "s".

◆ ~wstringbuffer()

wstringbuffer::~wstringbuffer ( )
inline

Deletes this instance of the wstringbuffer class.

Member Function Documentation

◆ append() [1/21]

wstringbuffer * wstringbuffer::append ( const wchar_t *  string)
inline

Appends "string" to the wstringbuffer, growing the internal buffer as necessary to accommodate the new data.

Returns a pointer to "this" to enable chaining such as: sb->append("numbers: ")->append(5)->append(5.5);

◆ append() [2/21]

wstringbuffer * wstringbuffer::append ( const wchar_t *  string,
size_t  length 
)
inline

Appends the first "length" characters of "string" to the wstringbuffer, growing the internal buffer as necessary to accommodate the new data.

Returns a pointer to "this" to enable chaining such as: sb->append("numbers: ")->append(5)->append(5.5);

◆ append() [3/21]

wstringbuffer * wstringbuffer::append ( double  number)
inline

Converts "number" to a string (using a default scale of 4) and appends it to the wstringbuffer, growing the internal buffer as necessary to accommodate the new data.

Returns a pointer to "this" to enable chaining such as: sb->append("numbers: ")->append(5)->append(5.5);

◆ append() [4/21]

wstringbuffer * wstringbuffer::append ( double  number,
uint16_t  precision,
uint16_t  scale 
)
inline

Converts "number" to a string using the specified "precision" and "scale" and appends it to the wstringbuffer, growing the internal buffer as necessary to accommodate the new data.

Returns a pointer to "this" to enable chaining such as: sb->append("numbers: ")->append(5)->append(5.5);

◆ append() [5/21]

wstringbuffer * wstringbuffer::append ( double  number,
uint16_t  scale 
)
inline

Converts "number" to a string using the specified "scale" and appends it to the wstringbuffer, growing the internal buffer as necessary to accommodate the new data.

Returns a pointer to "this" to enable chaining such as: sb->append("numbers: ")->append(5)->append(5.5);

◆ append() [6/21]

wstringbuffer * wstringbuffer::append ( float  number)
inline

Converts "number" to a string (using a default scale of 4) and appends it to the wstringbuffer, growing the internal buffer as necessary to accommodate the new data.

Returns a pointer to "this" to enable chaining such as: sb->append("numbers: ")->append(5)->append(5.5);

◆ append() [7/21]

wstringbuffer * wstringbuffer::append ( float  number,
uint16_t  precision,
uint16_t  scale 
)
inline

Converts "number" to a string using the specified "precision" and "scale" and appends it to the wstringbuffer, growing the internal buffer as necessary to accommodate the new data.

Returns a pointer to "this" to enable chaining such as: sb->append("numbers: ")->append(5)->append(5.5);

◆ append() [8/21]

wstringbuffer * wstringbuffer::append ( float  number,
uint16_t  scale 
)
inline

Converts "number" to a string using the specified "scale" and appends it to the wstringbuffer, growing the internal buffer as necessary to accommodate the new data.

Returns a pointer to "this" to enable chaining such as: sb->append("numbers: ")->append(5)->append(5.5);

◆ append() [9/21]

wstringbuffer * wstringbuffer::append ( int16_t  number)
inline

Converts "number" to a string and appends it to the wstringbuffer, growing the internal buffer as necessary to accommodate the new data.

Returns a pointer to "this" to enable chaining such as: sb->append("numbers: ")->append(5)->append(5.5);

◆ append() [10/21]

wstringbuffer * wstringbuffer::append ( int16_t  number,
uint16_t  zeropadding 
)
inline

Converts "number" to a string with the specified amount of zeropadding and appends it to the wstringbuffer, growing the internal buffer as necessary to accommodate the new data.

Returns a pointer to "this" to enable chaining such as: sb->append("numbers: ")->append(5)->append(5.5);

◆ append() [11/21]

wstringbuffer * wstringbuffer::append ( int32_t  number)
inline

Converts "number" to a string and appends it to the wstringbuffer, growing the internal buffer as necessary to accommodate the new data.

Returns a pointer to "this" to enable chaining such as: sb->append("numbers: ")->append(5)->append(5.5);

◆ append() [12/21]

wstringbuffer * wstringbuffer::append ( int32_t  number,
uint16_t  zeropadding 
)
inline

Converts "number" to a string with the specified amount of zeropadding and appends it to the wstringbuffer, growing the internal buffer as necessary to accommodate the new data.

Returns a pointer to "this" to enable chaining such as: sb->append("numbers: ")->append(5)->append(5.5);

◆ append() [13/21]

wstringbuffer * wstringbuffer::append ( int64_t  number)
inline

Converts "number" to a string and appends it to the wstringbuffer, growing the internal buffer as necessary to accommodate the new data.

Returns a pointer to "this" to enable chaining such as: sb->append("numbers: ")->append(5)->append(5.5);

◆ append() [14/21]

wstringbuffer * wstringbuffer::append ( int64_t  number,
uint16_t  zeropadding 
)
inline

Converts "number" to a string with the specified amount of zeropadding and appends it to the wstringbuffer, growing the internal buffer as necessary to accommodate the new data.

Returns a pointer to "this" to enable chaining such as: sb->append("numbers: ")->append(5)->append(5.5);

◆ append() [15/21]

wstringbuffer * wstringbuffer::append ( uint16_t  number)
inline

Converts "number" to a string and appends it to the wstringbuffer, growing the internal buffer as necessary to accommodate the new data.

Returns a pointer to "this" to enable chaining such as: sb->append("numbers: ")->append(5)->append(5.5);

◆ append() [16/21]

wstringbuffer * wstringbuffer::append ( uint16_t  number,
uint16_t  zeropadding 
)
inline

Converts "number" to a string with the specified amount of zeropadding and appends it to the wstringbuffer, growing the internal buffer as necessary to accommodate the new data.

Returns a pointer to "this" to enable chaining such as: sb->append("numbers: ")->append(5)->append(5.5);

◆ append() [17/21]

wstringbuffer * wstringbuffer::append ( uint32_t  number)
inline

Converts "number" to a string and appends it to the wstringbuffer, growing the internal buffer as necessary to accommodate the new data.

Returns a pointer to "this" to enable chaining such as: sb->append("numbers: ")->append(5)->append(5.5);

◆ append() [18/21]

wstringbuffer * wstringbuffer::append ( uint32_t  number,
uint16_t  zeropadding 
)
inline

Converts "number" to a string with the specified amount of zeropadding and appends it to the wstringbuffer, growing the internal buffer as necessary to accommodate the new data.

Returns a pointer to "this" to enable chaining such as: sb->append("numbers: ")->append(5)->append(5.5);

◆ append() [19/21]

wstringbuffer * wstringbuffer::append ( uint64_t  number)
inline

Converts "number" to a string and appends it to the wstringbuffer, growing the internal buffer as necessary to accommodate the new data.

Returns a pointer to "this" to enable chaining such as: sb->append("numbers: ")->append(5)->append(5.5);

◆ append() [20/21]

wstringbuffer * wstringbuffer::append ( uint64_t  number,
uint16_t  zeropadding 
)
inline

Converts "number" to a string with the specified amount of zeropadding and appends it to the wstringbuffer, growing the internal buffer as necessary to accommodate the new data.

Returns a pointer to "this" to enable chaining such as: sb->append("numbers: ")->append(5)->append(5.5);

◆ append() [21/21]

wstringbuffer * wstringbuffer::append ( wchar_t  character)
inline

Appends "character" to the wstringbuffer, growing the internal buffer as necessary to accommodate the new data.

Returns a pointer to "this" to enable chaining such as: sb->append("numbers: ")->append(5)->append(5.5);

◆ clear() [1/3]

void wstringbuffer::clear ( )
inline

Empties the wstringbuffer.

◆ clear() [2/3]

void wstringbuffer::clear ( size_t  initialsize)
inline

Empties the bytebuffer and resets the specified "initialsize" parameter.

◆ clear() [3/3]

void wstringbuffer::clear ( wchar_t *  initialcontents,
size_t  initialsize 
)
inline

Empties the bytebuffer and attaches the buffer "initialcontents" to the instance as the initial contents. This buffer should not be freed by the calling program. Also resets the specified "initialsize" parameter.

◆ detachString()

wchar_t * wstringbuffer::detachString ( )
inline

Returns a pointer to the string currently stored in the wstringbuffer, then resets the wstringbuffer such that it will no longer use that string.

The calling program must deallocate the string returned from this method.

◆ getPosition()

size_t wstringbuffer::getPosition ( )
inline

Returns the position in the internal buffer at which the next write will occur.

◆ getString()

const wchar_t * wstringbuffer::getString ( )
inline

Returns the string currently stored in the wstringbuffer.

◆ getStringLength()

size_t wstringbuffer::getStringLength ( )
inline

Returns the length of the string currently stored in the wstringbuffer.

◆ operator=()

wstringbuffer & wstringbuffer::operator= ( const wstringbuffer s)
inline

Makes this instance of the wstringbuffer class identical to "s".

◆ setPosition()

void wstringbuffer::setPosition ( size_t  pos)
inline

Sets the position in the internal buffer at which the next write will occur to "pos". If the position is set beyond the end of the buffer, the buffer will grow but the data between the current end of the buffer and the new position will be undefined.

◆ truncate() [1/2]

void wstringbuffer::truncate ( )
inlinevirtual

Trucnates the wstringbuffer at the current position.

Reimplemented from bytebuffer.

◆ truncate() [2/2]

void wstringbuffer::truncate ( size_t  pos)
inlinevirtual

Trucnates the wstringbuffer at position "pos".

Reimplemented from bytebuffer.

◆ write() [1/15]

ssize_t wstringbuffer::write ( const wchar_t *  string)
inline

Writes "string" to the wstringbuffer at the current position and increments the current position to the next byte after the data that was written. If necessary, the internal buffer will grow to accommodate the new data.

Returns a pointer to "this" to enable chaining such as: sb->write("numbers: ")->write(5)->write(5.5);

◆ write() [2/15]

ssize_t wstringbuffer::write ( const wchar_t *  string,
size_t  length 
)
inline

Writes the first "length" characters of "string" to the wstringbuffer at the current position and increments the current position to the next byte after the data that was written. If necessary, the internal buffer will grow to accommodate the new data.

Returns a pointer to "this" to enable chaining such as: sb->write("numbers: ")->write(5)->write(5.5);

◆ write() [3/15]

ssize_t wstringbuffer::write ( double  number)
inlinevirtual

Converts "number" to a string (using a default scale of 4) and writes it to the wstringbuffer at the current position and increments the current position to the next byte after the data that was written. If necessary, the internal buffer will grow to accommodate the new data.

Returns a pointer to "this" to enable chaining such as: sb->write("numbers: ")->write(5)->write(5.5);

Reimplemented from bytebuffer.

◆ write() [4/15]

ssize_t wstringbuffer::write ( double  number,
uint16_t  precision,
uint16_t  scale 
)
inline

Converts "number" to a string using the specified "precision" and "scale" and writes it to the wstringbuffer at the current position and increments the current position to the next byte after the data that was written. If necessary, the internal buffer will grow to accommodate the new data.

Returns a pointer to "this" to enable chaining such as: sb->write("numbers: ")->write(5)->write(5.5);

◆ write() [5/15]

ssize_t wstringbuffer::write ( double  number,
uint16_t  scale 
)
inline

Converts "number" to a string using the specified "scale" and writes it to the wstringbuffer at the current position and increments the current position to the next byte after the data that was written. If necessary, the internal buffer will grow to accommodate the new data.

Returns a pointer to "this" to enable chaining such as: sb->write("numbers: ")->write(5)->write(5.5);

◆ write() [6/15]

ssize_t wstringbuffer::write ( float  number)
inlinevirtual

Converts "number" to a string (using a default scale of 4) and writes it to the wstringbuffer at the current position and increments the current position to the next byte after the data that was written. If necessary, the interna buffer will grow to accommodate the new data.

Returns a pointer to "this" to enable chaining such as: sb->write("numbers: ")->write(5)->write(5.5);

Reimplemented from bytebuffer.

◆ write() [7/15]

ssize_t wstringbuffer::write ( float  number,
uint16_t  precision,
uint16_t  scale 
)
inline

Converts "number" to a string using the specified "precision" and "scale" and writes it to the wstringbuffer at the current position and increments the current position to the next byte after the data that was written. If necessary, the internal buffer will grow to accommodate the new data.

Returns a pointer to "this" to enable chaining such as: sb->write("numbers: ")->write(5)->write(5.5);

◆ write() [8/15]

ssize_t wstringbuffer::write ( float  number,
uint16_t  scale 
)
inline

Converts "number" to a string using the specified "scale" and writes it to the wstringbuffer at the current position and increments the current position to the next byte after the data that was written. If necessary, the internal buffer will grow to accommodate the new data.

Returns a pointer to "this" to enable chaining such as: sb->write("numbers: ")->write(5)->write(5.5);

◆ write() [9/15]

ssize_t wstringbuffer::write ( int16_t  number)
inlinevirtual

Converts "number" to a string and writes it to the wstringbuffer at the current position and increments the current position to the next byte after the data that was written. If necessary, the internal buffer will grow to accommodate the new data.

Returns a pointer to "this" to enable chaining such as: sb->write("numbers: ")->write(5)->write(5.5);

Reimplemented from bytebuffer.

◆ write() [10/15]

ssize_t wstringbuffer::write ( int32_t  number)
inlinevirtual

Converts "number" to a string and writes it to the wstringbuffer at the current position and increments the current position to the next byte after the data that was written. If necessary, the internal buffer will grow to accommodate the new data.

Returns a pointer to "this" to enable chaining such as: sb->write("numbers: ")->write(5)->write(5.5);

Reimplemented from bytebuffer.

◆ write() [11/15]

ssize_t wstringbuffer::write ( int64_t  number)
inlinevirtual

Converts "number" to a string and writes it to the wstringbuffer at the current position and increments the current position to the next byte after the data that was written. If necessary, the inernal buffer will grow to accommodate the new data.

Returns a pointer to "this" to enable chaining such as: sb->write("numbers: ")->write(5)->write(5.5);

Reimplemented from bytebuffer.

◆ write() [12/15]

ssize_t wstringbuffer::write ( uint16_t  number)
inlinevirtual

Converts "number" to a string and writes it to the wstringbuffer at the current position and increments the current position to the next byte after the data that was written. If necessary, the internal buffer will grow to accommodate the new data.

Returns a pointer to "this" to enable chaining such as: sb->write("numbers: ")->write(5)->write(5.5);

Reimplemented from bytebuffer.

◆ write() [13/15]

ssize_t wstringbuffer::write ( uint32_t  number)
inlinevirtual

Converts "number" to a string and writes it to the wstringbuffer at the current position and increments the current position to the next byte after the data that was written. If necessary, the internal buffer will grow to accommodate the new data.

Returns a pointer to "this" to enable chaining such as: sb->write("numbers: ")->write(5)->write(5.5);

Reimplemented from bytebuffer.

◆ write() [14/15]

ssize_t wstringbuffer::write ( uint64_t  number)
inlinevirtual

Converts "number" to a string and writes it to the wstringbuffer at the current position and increments the current position to the next byte after the data that was written. If necessary, the internal buffer will grow to accommodate the new data.

Returns a pointer to "this" to enable chaining such as: sb->write("numbers: ")->write(5)->write(5.5);

Reimplemented from bytebuffer.

◆ write() [15/15]

ssize_t wstringbuffer::write ( wchar_t  character)
inline

Writes "character" to the wstringbuffer at the current position and increments the current position to the next byte after the data that was written. If necessary, the internal buffer will grow to accommodate the new data.

Returns a pointer to "this" to enable chaining such as: sb->write("numbers: ")->write(5)->write(5.5);