class TStreamBuf : public MStreamBuf |
Adds buffering capabilities to a stream buffer
The class provides pointers to mark out the current read and write areas within the intermediate buffer. The class also defines the pure virtual functions UnderflowL() and OverflowL() which must be provided by a derived class.
Streams which have buffering capabilities derive from this class, otherwise they derive from MStreamBuf.
Note that the class does not provide the buffer; this is left to the class derived from it. For example, the memory buffer classes use the memory area directly, the file buffer class allocate a heap cell to use as a buffer.
Protected Member Functions | |
---|---|
TStreamBuf() | |
IMPORT_C TInt | Avail(TArea) |
TInt | Avail(TRead) |
TInt | Avail(TWrite) |
IMPORT_C TInt | DoReadL(TAny *, TInt) |
IMPORT_C TStreamTransfer | DoReadL(MStreamInput &, TStreamTransfer) |
IMPORT_C void | DoWriteL(const TAny *, TInt) |
IMPORT_C TStreamTransfer | DoWriteL(MStreamOutput &, TStreamTransfer) |
IMPORT_C TUint8 * | End(TArea) |
TUint8 * | End(TRead) |
TUint8 * | End(TWrite) |
IMPORT_C TUint8 * | Ptr(TArea) |
TUint8 * | Ptr(TRead) |
TUint8 * | Ptr(TWrite) |
IMPORT_C void | SetBuf(TArea, TUint8 *, TUint8 *) |
void | SetBuf(TRead, TUint8 *, TUint8 *) |
void | SetBuf(TWrite, TUint8 *, TUint8 *) |
IMPORT_C void | SetEnd(TArea, TUint8 *) |
void | SetEnd(TRead, TUint8 *) |
void | SetEnd(TWrite, TUint8 *) |
IMPORT_C void | SetPtr(TArea, TUint8 *) |
void | SetPtr(TRead, TUint8 *) |
void | SetPtr(TWrite, TUint8 *) |
Private Member Functions | |
---|---|
void | OverflowL() |
TInt | UnderflowL(TInt) |
Inherited Enumerations | |
---|---|
MStreamBuf:TRead | |
MStreamBuf:TWrite |
Protected Member Type Definitions | |
---|---|
typedef | TInt TArea |
Private Attributes | |
---|---|
TUint8 * | iREnd |
TUint8 * | iRPtr |
TUint8 * | iWEnd |
TUint8 * | iWPtr |
TInt | Avail | ( | TRead | ) | const [protected, inline] |
Gets the number of bytes available in the read area within the intermediate buffer.
The number of bytes available.
TRead |
TInt | Avail | ( | TWrite | ) | const [protected, inline] |
Gets the number of bytes available in the write area within the intermediate buffer.
The number of bytes available.
TWrite |
IMPORT_C TStreamTransfer | DoReadL | ( | MStreamInput & | anInput, |
TStreamTransfer | aTransfer | |||
) | [protected, virtual] |
MStreamInput & anInput | |
TStreamTransfer aTransfer |
IMPORT_C void | DoWriteL | ( | const TAny * | aPtr, |
TInt | aLength | |||
) | [protected, virtual] |
IMPORT_C TStreamTransfer | DoWriteL | ( | MStreamOutput & | anOutput, |
TStreamTransfer | aTransfer | |||
) | [protected, virtual] |
MStreamOutput & anOutput | |
TStreamTransfer aTransfer |
TUint8 * | End | ( | TRead | ) | const [protected, inline] |
Gets the current end point of the read area within the intermediate buffer.
An end point is always the first byte beyond the end of an area.
The end point.
TRead |
TUint8 * | End | ( | TWrite | ) | const [protected, inline] |
Gets the current end point of the write area within the intermediate buffer.
An end point is always the first byte beyond the end of an area.
The end point.
TWrite |
void | OverflowL | ( | ) | [private, pure virtual] |
Empties the intermediate buffer and resets the start and end points of the write area.
The implementation of this function depends on the way the stream itself is implemented. For example, the in-memory streams have simple implementations.
TUint8 * | Ptr | ( | TRead | ) | const [protected, inline] |
Gets the current start point of the read area within the intermediate buffer.
The start point.
TRead |
TUint8 * | Ptr | ( | TWrite | ) | const [protected, inline] |
Gets the current start point of the write area within the intermediate buffer.
The start point.
TWrite |
IMPORT_C void | SetBuf | ( | TArea | anArea, |
TUint8 * | aPtr, | |||
TUint8 * | anEnd | |||
) | [protected] |
void | SetBuf | ( | TRead | , |
TUint8 * | aPtr, | |||
TUint8 * | anEnd | |||
) | [protected, inline] |
Sets the start and end points of the read area within the intermediate buffer.
A start point is always within an area; an end point is always the first byte beyond the end of an area.
void | SetBuf | ( | TWrite | , |
TUint8 * | aPtr, | |||
TUint8 * | anEnd | |||
) | [protected, inline] |
Sets the start and end points of the write area within the intermediate buffer.
A start point is always within an area; an end point is always the first byte beyond the end of an area.
void | SetPtr | ( | TRead | , |
TUint8 * | aPtr | |||
) | [protected, inline] |
Sets the start point of the write area within the intermediate buffer.
A start point is always within an area.
void | SetPtr | ( | TWrite | , |
TUint8 * | aPtr | |||
) | [protected, inline] |
Sets the start point of the write area within the intermediate buffer.
A start point is always within an area.
TInt | UnderflowL | ( | TInt | aMaxLength | ) | [private, pure virtual] |
Re-fills the intermediate buffer and resets the start and end points of the read area.
The implementation of this function depends on the way the stream itself is implemented. For example, the in-memory streams have simple implementations.
The amount of data available in the intermediate buffer.
TInt aMaxLength | The maximum amount of data required for the intermediate buffer. |
typedef TInt | TArea | [protected] |
Used to identify the type of area within an intermediate buffer.
The type is used by functions of this class that set or get pointers into the intermediate buffer.
The type uses the ERead and EWrite enumeration values, as bit flags, to identify the read and write areas respectively.
ERead is an MStreamBuf::TRead enumerator. EWrite is an MStreamBuf::EWrite enumerator.