class DataBlock

A class that holds just a block of raw data. More...

Full nameTelEngine::DataBlock
Definition#include <telephony.h>
InheritsTelEngine::GenObject [public ]
List of all Methods
Annotated List
Files
Globals
Hierarchy
Index

Public Methods

Public Static Methods


Detailed Description

The DataBlock holds a data buffer with no specific formatting.

 DataBlock ()

DataBlock

Constructs an empty data block

 DataBlock (const DataBlock &value)

DataBlock

Copy constructor

 DataBlock (void *value, unsigned int len, bool copyData = true)

DataBlock

Constructs an initialized data block

Parameters:
valueData to assign, may be NULL to fill with zeros
lenLength of data, may be zero (then value is ignored)
copyDataTrue to make a copy of the data, false to just insert the pointer

 ~DataBlock ()

~DataBlock

[virtual]

Destroys the data, disposes the memory.

const DataBlock&  empty ()

empty

[static]

A static empty data block

inline void * data ()

data

[const]

Get a pointer to the stored data.

Returns: A pointer to the data or NULL.

inline bool  null ()

null

[const]

Checks if the block holds a NULL pointer.

Returns: True if the block holds NULL, false otherwise.

inline unsigned int  length ()

length

[const]

Get the length of the stored data.

Returns: The length of the stored data, zero for NULL.

void  clear (bool deleteData = true)

clear

Clear the data and optionally free the memory

Parameters:
deleteDataTrue to free the deta block, false to just forget it

DataBlock&  assign (void *value, unsigned int len, bool copyData = true)

assign

Assign data to the object

Parameters:
valueData to assign, may be NULL to fill with zeros
lenLength of data, may be zero (then value is ignored)
copyDataTrue to make a copy of the data, false to just insert the pointer

void  append (const DataBlock &value)

append

Append data to the current block

Parameters:
valueData to append

void  append (const String &value)

append

Append a String to the current block

Parameters:
valueString to append

void  insert (const DataBlock &value)

insert

Insert data before the current block

Parameters:
valueData to insert

void  truncate (unsigned int len)

truncate

Truncate the data block

Parameters:
lenThe maximum length to keep

void  cut (int len)

cut

Cut off a number of bytes from the data block

Parameters:
lenAmount to cut, positive to cut from end, negative to cut from start of block

DataBlock&  operator= (const DataBlock &value)

operator=

Assignment operator.

inline DataBlock&  operator+= (const DataBlock &value)

operator+=

Appending operator.

inline DataBlock&  operator+= (const String &value)

operator+=

Appending operator for Strings.

bool  convert (const DataBlock &src, const String &sFormat, const String &dFormat, unsigned maxlen = 0)

convert

Convert data from a different format

Parameters:
srcSource data block
sFormatName of the source format
dFormatName of the destination format
maxlenMaximum amount to convert, 0 to use source

Returns: True if converted successfully, false on failure


Generated by: kk on nyx on Sat Jun 4 19:29:41 2005, using kdoc 2.0a54.