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

Constructs a new bufferStore.

 bufferStore (const unsigned char *, long)

Constructs a new bufferStore and initializes its content.

Parameters:

bufferStore ()

Destroys a bufferStore instance.

 bufferStore (const bufferStore &)

Constructs a new bufferStore and initializes its content.

Parameters:

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 <em>pos</em>.

Parameters:

Returns: The value of the byte at index <em>pos</em>

u_int16_t  getWord (long pos = 0)

[const]

Retrieves the word at index <em>pos</em>.

Parameters:

Returns: The value of the word at index <em>pos</em>

u_int32_t  getDWord (long pos = 0)

[const]

Retrieves the dword at index <em>pos</em>.

Parameters:

Returns: The value of the dword at index <em>pos</em>

const char *  getString (long pos = 0)

[const]

Retrieves the characters at index <em>pos</em>.

Parameters:

Returns: A pointer to characters at index <em>pos</em>

void  discardFirstBytes (int len = 0)

Removes bytes from the start of the buffer.

Parameters:

friend ostreamoperator<< (ostream &, const bufferStore &)

Prints a dump of the content.

Mainly used for debugging purposes.

Parameters:

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:

void  addByte (unsigned char c)

Appends a byte to the content of this instance.

Parameters:

void  addWord (int)

Appends a word to the content of this instance.

Parameters:

void  addDWord (long dw)

Appends a dword to the content of this instance.

Parameters:

void  addString (const char *s)

Appends a string to the content of this instance.

The trailing zero byte is <em>not</em> copied to the content.

Parameters:

void  addStringT (const char *s)

Appends a string to the content of this instance.

The trailing zero byte <em>is</em> copied to the content.

Parameters:

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

Appends data to the content of this instance.

Parameters:

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

Appends data to the content of this instance.

Parameters:

void  truncate (long newLen)

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

Parameters:


Generated by: felfert@floh.fe.think on Mon Jul 23 21:42:43 2001, using kdoc 2.0a40.