Om  1.0.0
A universal framework for multimedia simulation
Public Member Functions | List of all members
om::data::GenericStringBuffer< CharType > Class Template Reference

A class that contains a buffer of characters of templated type. More...

#include <omStringBuffer.h>

Public Member Functions

 GenericStringBuffer ()
 Create an empty buffer with the default initial capacity. More...
 
 GenericStringBuffer (Size initialCapacity, Float newResizeFactor=DEFAULT_RESIZE_FACTOR)
 Create an empty buffer with the specified initial capacity and resize factor. More...
 
 GenericStringBuffer (const GenericStringBuffer &other)
 Create an identical copy of the specified buffer. More...
 
 ~GenericStringBuffer ()
 Destroy a buffer, deallocating all resources used. More...
 
GenericStringBufferoperator= (const GenericStringBuffer &other)
 Assign the contents of one string buffer to another, performing a deep copy. More...
 
GenericStringBufferappend (const CharType &character)
 Append an element to the end of this buffer. More...
 
GenericStringBufferappend (const CharType *source)
 Append all characters from the given NULL-terminated string. More...
 
GenericStringBufferappend (const CharType *source, Size numElements)
 Append the specified number of elements from the given string. More...
 
GenericStringBufferappend (const GenericString< CharType > &string)
 Append a string to this string buffer. More...
 
template<typename OtherCharType >
GenericStringBufferappend (const GenericString< OtherCharType > &string)
 
GenericStringBufferappend (const util::Array< CharType > &array)
 Append all elements from the specified character array to the end of the buffer. More...
 
GenericStringBufferappend (const util::Array< CharType > &array, Size number)
 Append a certain number of elements from the specified array to the end of the buffer. More...
 
GenericStringBufferappend (const GenericStringBuffer &aBuffer)
 Append all data from the specified buffer. More...
 
template<typename T >
GenericStringBufferappend (const T &object)
 Convert the object of templated type to a string and append it to the buffer. More...
 
GenericStringBufferoperator<< (const CharType &character)
 Append a character to the end of this string buffer. More...
 
GenericStringBufferoperator<< (const CharType *character)
 Append a NULL-terminated character string to the end of this buffer. More...
 
GenericStringBufferoperator<< (const GenericString< CharType > &string)
 Append a string to the end of this buffer. More...
 
template<typename OtherCharType >
GenericStringBufferoperator<< (const GenericString< OtherCharType > &string)
 Append a string to the end of this buffer. More...
 
GenericStringBufferoperator<< (const util::Array< CharType > &array)
 Append all elements from the specified character array to the end of the string buffer. More...
 
GenericStringBufferoperator<< (const GenericStringBuffer &aBuffer)
 Append all characters from the specified buffer to this buffer. More...
 
template<typename T >
GenericStringBufferoperator<< (const T &object)
 Convert the object of templated type to a string and append it to the buffer. More...
 
Size remove (Size numCharacters)
 Remove the specified number of code points from the end of this string buffer. More...
 
void clear ()
 Clear the contents of the buffer, keeping its capacity intact. More...
 
GenericString< CharType > toString () const
 Convert the contents of this buffer to a string object. More...
 
 operator GenericString< CharType > ()
 Convert the contents of this buffer to a string object. More...
 
const CharType * getPointer () const
 Get a pointer pointing to the buffer's internal array. More...
 
const CharType * getCString () const
 Get a pointer pointing to the buffer's internal array. More...
 
Size getSize () const
 Get the number of characters in the buffer, excluding the NULL terminator. More...
 
Size getLength () const
 Get the number of characters in the buffer, excluding the NULL terminator. More...
 
Size getCapacity () const
 Get the number of elements the buffer can hold without resizing. More...
 
Bool setCapacity (Size newCapacity)
 Set the number of elements the buffer can hold. More...
 
Float getResizeFactor () const
 Get the resize factor for this buffer. More...
 
void setResizeFactor (Float newResizeFactor)
 Set the resize factor for this buffer, clamped to [1.1, 10.0]. More...
 

Detailed Description

template<typename CharType>
class om::data::GenericStringBuffer< CharType >

A class that contains a buffer of characters of templated type.

This class allows the user to accumulate characters in a resizing buffer, then convert the buffer's internal array to a string for other uses.

Constructor & Destructor Documentation

template<typename CharType >
om::data::GenericStringBuffer< CharType >::GenericStringBuffer ( )

Create an empty buffer with the default initial capacity.

template<typename CharType >
om::data::GenericStringBuffer< CharType >::GenericStringBuffer ( Size  initialCapacity,
Float  newResizeFactor = DEFAULT_RESIZE_FACTOR 
)

Create an empty buffer with the specified initial capacity and resize factor.

template<typename CharType >
om::data::GenericStringBuffer< CharType >::GenericStringBuffer ( const GenericStringBuffer< CharType > &  other)

Create an identical copy of the specified buffer.

template<typename CharType >
om::data::GenericStringBuffer< CharType >::~GenericStringBuffer ( )
inline

Destroy a buffer, deallocating all resources used.

Member Function Documentation

template<typename CharType >
GenericStringBuffer& om::data::GenericStringBuffer< CharType >::operator= ( const GenericStringBuffer< CharType > &  other)

Assign the contents of one string buffer to another, performing a deep copy.

template<typename CharType >
GenericStringBuffer& om::data::GenericStringBuffer< CharType >::append ( const CharType &  character)

Append an element to the end of this buffer.

template<typename CharType >
GenericStringBuffer& om::data::GenericStringBuffer< CharType >::append ( const CharType *  source)

Append all characters from the given NULL-terminated string.

template<typename CharType >
GenericStringBuffer& om::data::GenericStringBuffer< CharType >::append ( const CharType *  source,
Size  numElements 
)

Append the specified number of elements from the given string.

template<typename CharType >
GenericStringBuffer& om::data::GenericStringBuffer< CharType >::append ( const GenericString< CharType > &  string)
inline

Append a string to this string buffer.

template<typename CharType >
template<typename OtherCharType >
GenericStringBuffer& om::data::GenericStringBuffer< CharType >::append ( const GenericString< OtherCharType > &  string)
inline
template<typename CharType >
GenericStringBuffer& om::data::GenericStringBuffer< CharType >::append ( const util::Array< CharType > &  array)
inline

Append all elements from the specified character array to the end of the buffer.

template<typename CharType >
GenericStringBuffer& om::data::GenericStringBuffer< CharType >::append ( const util::Array< CharType > &  array,
Size  number 
)
inline

Append a certain number of elements from the specified array to the end of the buffer.

template<typename CharType >
GenericStringBuffer& om::data::GenericStringBuffer< CharType >::append ( const GenericStringBuffer< CharType > &  aBuffer)
inline

Append all data from the specified buffer.

template<typename CharType >
template<typename T >
GenericStringBuffer& om::data::GenericStringBuffer< CharType >::append ( const T &  object)
inline

Convert the object of templated type to a string and append it to the buffer.

template<typename CharType >
GenericStringBuffer& om::data::GenericStringBuffer< CharType >::operator<< ( const CharType &  character)
inline

Append a character to the end of this string buffer.

template<typename CharType >
GenericStringBuffer& om::data::GenericStringBuffer< CharType >::operator<< ( const CharType *  character)
inline

Append a NULL-terminated character string to the end of this buffer.

template<typename CharType >
GenericStringBuffer& om::data::GenericStringBuffer< CharType >::operator<< ( const GenericString< CharType > &  string)
inline

Append a string to the end of this buffer.

template<typename CharType >
template<typename OtherCharType >
GenericStringBuffer& om::data::GenericStringBuffer< CharType >::operator<< ( const GenericString< OtherCharType > &  string)
inline

Append a string to the end of this buffer.

template<typename CharType >
GenericStringBuffer& om::data::GenericStringBuffer< CharType >::operator<< ( const util::Array< CharType > &  array)
inline

Append all elements from the specified character array to the end of the string buffer.

template<typename CharType >
GenericStringBuffer& om::data::GenericStringBuffer< CharType >::operator<< ( const GenericStringBuffer< CharType > &  aBuffer)
inline

Append all characters from the specified buffer to this buffer.

template<typename CharType >
template<typename T >
GenericStringBuffer& om::data::GenericStringBuffer< CharType >::operator<< ( const T &  object)
inline

Convert the object of templated type to a string and append it to the buffer.

template<typename CharType >
Size om::data::GenericStringBuffer< CharType >::remove ( Size  numCharacters)
inline

Remove the specified number of code points from the end of this string buffer.

The method returns the number of character code points that were removed.

template<typename CharType >
void om::data::GenericStringBuffer< CharType >::clear ( )
inline

Clear the contents of the buffer, keeping its capacity intact.

template<typename CharType >
GenericString<CharType> om::data::GenericStringBuffer< CharType >::toString ( ) const
inline

Convert the contents of this buffer to a string object.

template<typename CharType >
om::data::GenericStringBuffer< CharType >::operator GenericString< CharType > ( )
inline

Convert the contents of this buffer to a string object.

template<typename CharType >
const CharType* om::data::GenericStringBuffer< CharType >::getPointer ( ) const
inline

Get a pointer pointing to the buffer's internal array.

template<typename CharType >
const CharType* om::data::GenericStringBuffer< CharType >::getCString ( ) const
inline

Get a pointer pointing to the buffer's internal array.

template<typename CharType >
Size om::data::GenericStringBuffer< CharType >::getSize ( ) const
inline

Get the number of characters in the buffer, excluding the NULL terminator.

template<typename CharType >
Size om::data::GenericStringBuffer< CharType >::getLength ( ) const
inline

Get the number of characters in the buffer, excluding the NULL terminator.

template<typename CharType >
Size om::data::GenericStringBuffer< CharType >::getCapacity ( ) const
inline

Get the number of elements the buffer can hold without resizing.

template<typename CharType >
Bool om::data::GenericStringBuffer< CharType >::setCapacity ( Size  newCapacity)
inline

Set the number of elements the buffer can hold.

template<typename CharType >
Float om::data::GenericStringBuffer< CharType >::getResizeFactor ( ) const
inline

Get the resize factor for this buffer.

template<typename CharType >
void om::data::GenericStringBuffer< CharType >::setResizeFactor ( Float  newResizeFactor)
inline

Set the resize factor for this buffer, clamped to [1.1, 10.0].


The documentation for this class was generated from the following files: