cawlign 0.0.1
Codon-aware pairwise sequence alignment
Loading...
Searching...
No Matches
StringBuffer Class Reference

Public Member Functions

 StringBuffer (void)
 
 ~StringBuffer (void)
 
char * getString (void) const
 
void appendChar (const char)
 
void appendBuffer (const char *, const long=-1)
 
void resetString (void)
 
void swap (StringBuffer &)
 
unsigned long length (void) const
 
void reset_length (unsigned long newL)
 
char getChar (const long i) const
 
void flip (void)
 
void detach (void)
 

Static Public Attributes

static long sbDefaultLength = 16
 
static long sbDefaultBoost = 16
 

Constructor & Destructor Documentation

◆ StringBuffer()

StringBuffer::StringBuffer ( void )

Initializes an empty StringBuffer with a default initial capacity. This buffer dynamically grows as new characters are appended.

◆ ~StringBuffer()

StringBuffer::~StringBuffer ( void )

Frees the memory allocated for the string buffer.

Member Function Documentation

◆ appendBuffer()

void StringBuffer::appendBuffer ( const char * buffer,
const long length = -1 )

Appends a string or a buffer of specified length to the StringBuffer.

Parameters
bufferThe string or character buffer to append.
lengthThe length of the buffer, if known. If not, the length is inferred using strlen.

◆ appendChar()

void StringBuffer::appendChar ( const char c)

Appends a single character to the end of the buffer, growing the buffer if needed.

Parameters
cThe character to append.

◆ flip()

void StringBuffer::flip ( void )

Reverses the content of the StringBuffer.

◆ resetString()

void StringBuffer::resetString ( void )

Resets the StringBuffer to an empty state.

Clears the buffer content by resetting its length, but keeps the allocated memory.

◆ swap()

void StringBuffer::swap ( StringBuffer & src)

Swaps the contents of this StringBuffer with another StringBuffer.

This function exchanges the data, length, and capacity of two StringBuffer objects.

Parameters
srcThe StringBuffer object to swap with.

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