class bufferStore

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

Definition#include <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 ()

bufferStore

Constructs a new bufferStore.

 bufferStore (const unsigned char *, long)

bufferStore

Constructs a new bufferStore and initializes its content.

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

 ~bufferStore ()

~bufferStore

Destroys a bufferStore instance.

 bufferStore (const bufferStore &)

bufferStore

Constructs a new bufferStore and initializes its content.

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

bufferStoreoperator = (const bufferStore &)

operator =

Copies a bufferStore.

unsigned long  getLen ()

getLen

[const]

Retrieves the length of a bufferStore.

Returns: The current length of the contents in bytes.

unsigned char  getByte (long pos = 0)

getByte

[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)

getWord

[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)

getDWord

[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)

getString

[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)

discardFirstBytes

Removes bytes from the start of the buffer.

Parameters:
lenNumber of bytes to remove.

friend std::ostream & operato ()

operato

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 ()

empty

[const]

Tests if the bufferStore is empty.

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

void  init ()

init

Initializes the bufferStore.

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

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

init

Initializes the bufferStore with a given data.

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

void  addByte (unsigned char c)

addByte

Appends a byte to the content of this instance.

Parameters:
cThe byte to append.

void  addWord (int)

addWord

Appends a word to the content of this instance.

Parameters:
wThe word to append.

void  addDWord (long dw)

addDWord

Appends a dword to the content of this instance.

Parameters:
dwThe dword to append.

void  addString (const char *s)

addString

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)

addStringT

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)

addBytes

Appends data to the content of this instance.

Parameters:
bufThe data to append.
lenLength of data.

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

addBuff

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)

truncate

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

Parameters:
newLenThe new length of the buffer.

void  prependByte (unsigned char c)

prependByte

Prepends a byte to the content of this instance.

Parameters:
cThe byte to append.

void  prependWord (int)

prependWord

Prepends a word to the content of this instance.

Parameters:
wThe word to append.


Generated by: rrt on drom on Mon Nov 26 16:06:15 2007, using kdoc 2.0a54.