class bufferStore

A generic container for an array of bytes. More...

Definition#include <lib/bufferstore.h>
List of all Methods
Annotated List
Files
Globals
Hierarchy
Index

Public Methods


Detailed Description

A generic container for an array of bytes.

bufferStore provides an array of bytes which can be accessed using various types.

 bufferStore ()

Constructs a new bufferStore.

 bufferStore (const unsigned char *, long)

Constructs a new bufferStore and initializes its content.

Parameters:
bufPointer to data for initialization.
lenLength of data for initialization.

bufferStore ()

Destroys a bufferStore instance.

 bufferStore (const bufferStore &)

Constructs a new bufferStore and initializes its content.

Parameters:
bA bufferStore, whose content is used for initialization.

bufferStoreoperator = (const bufferStore &)

Copies a bufferStore.

unsigned long  getLen ()

[const]

Retrieves the length of a bufferStore.

Returns: The current length of the contents in bytes.

unsigned char  getByte (long pos = 0)

[const]

Retrieves the byte at index pos.

Parameters:
posThe index of the byte to retrieve.

Returns: The value of the byte at index pos

u_int16_t  getWord (long pos = 0)

[const]

Retrieves the word at index pos.

Parameters:
posThe index of the word to retrieve.

Returns: The value of the word at index pos

u_int32_t  getDWord (long pos = 0)

[const]

Retrieves the dword at index pos.

Parameters:
posThe index of the dword to retrieve.

Returns: The value of the dword at index pos

const char *  getString (long pos = 0)

[const]

Retrieves the characters at index pos.

Parameters:
posThe index of the characters to retrieve.

Returns: A pointer to characters at index pos

void  discardFirstBytes (int len = 0)

Removes bytes from the start of the buffer.

Parameters:
lenNumber of bytes to remove.

friend class std::ostream & operator<< (std::ostream &, const bufferStore &)

Prints a dump of the content.

Mainly used for debugging purposes.

Parameters:
sThe stream to write to.
bThe bufferStore do be dumped.

Returns: The stream.

bool  empty ()

[const]

Tests if the bufferStore is empty.

Returns: true, if the bufferStore is empty. false, if it contains data.

void  init ()

Initializes the bufferStore.

All data is removed, the length is reset to 0.

void  init (const unsigned char * buf, long len)

Initializes the bufferStore with a given data.

Parameters:
bufPointer to data to initialize from.
lenLength of data.

void  addByte (unsigned char c)

Appends a byte to the content of this instance.

Parameters:
cThe byte to append.

void  addWord (int)

Appends a word to the content of this instance.

Parameters:
wThe word to append.

void  addDWord (long dw)

Appends a dword to the content of this instance.

Parameters:
dwThe dword to append.

void  addString (const char *s)

Appends a string to the content of this instance.

The trailing zero byte is not copied to the content.

Parameters:
sThe string to append.

void  addStringT (const char *s)

Appends a string to the content of this instance.

The trailing zero byte is copied to the content.

Parameters:
sThe string to append.

void  addBytes (const unsigned char *buf, int len)

Appends data to the content of this instance.

Parameters:
bufThe data to append.
lenLength of data.

void  addBuff (const bufferStore &b, long maxLen = -1)

Appends data to the content of this instance.

Parameters:
bThe bufferStore whose content to append.
maxLenLength of content to append. If maxLen is less than 0 or greater than the current length of b , then the whole content of b is appended.

void  truncate (long newLen)

Truncates the buffer. If the buffer is smaller, does nothing.

Parameters:
newLenThe new length of the buffer.

void  prependByte (unsigned char c)

Prepends a byte to the content of this instance.

Parameters:
cThe byte to append.

void  prependWord (int)

Prepends a word to the content of this instance.

Parameters:
wThe word to append.


Generated by: felfert@usw-pr-shell1.sourceforge.net on Sat Aug 10 18:46:04 2002, using kdoc 2.0a36.