TBufBuf Class Reference

#include <s32mem.h>

class TBufBuf : public TStreamBuf

Inherits from

Public Member Enumerations
enumanonymous { ETruncate, EInsert }
Public Member Functions
TBufBuf()
IMPORT_C voidSet(CBufBase &, TInt, TInt)
Protected Member Functions
virtual IMPORT_C TStreamPosDoSeekL(TMark, TStreamLocation, TInt)
virtual IMPORT_C voidDoSynchL()
virtual IMPORT_C voidDoWriteL(const TAny *, TInt)
virtual IMPORT_C voidOverflowL()
virtual IMPORT_C TIntUnderflowL(TInt)
Inherited Enumerations
MStreamBuf:TRead
MStreamBuf:TWrite
Inherited Functions
MStreamBuf::Close()
MStreamBuf::MStreamBuf()
MStreamBuf::PushL()
MStreamBuf::Read(TDes8 &,TInt,TRequestStatus &)
MStreamBuf::Read(TDes8 &,TRequestStatus &)
MStreamBuf::ReadL(MStreamInput &)
MStreamBuf::ReadL(MStreamInput &,TInt)
MStreamBuf::ReadL(MStreamInput &,TStreamTransfer)
MStreamBuf::ReadL(TAny *,TInt)
MStreamBuf::ReadL(TDes8 &,TInt,TRequestStatus &)
MStreamBuf::ReadL(TDes8 &,TRequestStatus &)
MStreamBuf::Release()
MStreamBuf::SeekL(TMark,TStreamLocation,TInt)
MStreamBuf::SeekL(TMark,TStreamPos)
MStreamBuf::SeekL(TRead,TInt)
MStreamBuf::SeekL(TRead,TStreamLocation,TInt)
MStreamBuf::SeekL(TWrite,TInt)
MStreamBuf::SeekL(TWrite,TStreamLocation,TInt)
MStreamBuf::SizeL()const
MStreamBuf::Synch()
MStreamBuf::SynchL()
MStreamBuf::TellL(TRead)const
MStreamBuf::TellL(TWrite)const
MStreamBuf::Write(const TDesC8 &,TInt,TRequestStatus &)
MStreamBuf::Write(const TDesC8 &,TRequestStatus &)
MStreamBuf::WriteL(MStreamOutput &)
MStreamBuf::WriteL(MStreamOutput &,TInt)
MStreamBuf::WriteL(MStreamOutput &,TStreamTransfer)
MStreamBuf::WriteL(const TAny *,TInt)
MStreamBuf::WriteL(const TDesC8 &,TInt,TRequestStatus &)
MStreamBuf::WriteL(const TDesC8 &,TRequestStatus &)
TStreamBuf::Avail(TArea)const
TStreamBuf::Avail(TRead)const
TStreamBuf::Avail(TWrite)const
TStreamBuf::DoReadL(MStreamInput &,TStreamTransfer)
TStreamBuf::DoReadL(TAny *,TInt)
TStreamBuf::DoWriteL(MStreamOutput &,TStreamTransfer)
TStreamBuf::End(TArea)const
TStreamBuf::End(TRead)const
TStreamBuf::End(TWrite)const
TStreamBuf::Ptr(TArea)const
TStreamBuf::Ptr(TRead)const
TStreamBuf::Ptr(TWrite)const
TStreamBuf::SetBuf(TArea,TUint8 *,TUint8 *)
TStreamBuf::SetBuf(TRead,TUint8 *,TUint8 *)
TStreamBuf::SetBuf(TWrite,TUint8 *,TUint8 *)
TStreamBuf::SetEnd(TArea,TUint8 *)
TStreamBuf::SetEnd(TRead,TUint8 *)
TStreamBuf::SetEnd(TWrite,TUint8 *)
TStreamBuf::SetPtr(TArea,TUint8 *)
TStreamBuf::SetPtr(TRead,TUint8 *)
TStreamBuf::SetPtr(TWrite,TUint8 *)
TStreamBuf::TStreamBuf()
Inherited Type Definitions
MStreamBuf::TMark
TStreamBuf::TArea

Detailed Description

A stream buffer that uses a dynamic buffer for its implementation.

A stream of this type is used by RBufWriteStream and RBufReadStream objects. It also has intermediate buffering capabilities.

This is a seekable stream buffer.

There are three write modes:

insert mode - inserts new data into the buffer at the offset passed to Set()

overwrite mode - replaces the data in the buffer starting at the offset passed to Set(). Once the end of the buffer is reached, it is automatically extended as more data is written. This is the default mode.

truncate mode - truncates the buffer to the offset passed to Set() before data is written, extending the buffer. When writing, the buffer size as reported by CBufBase::Size() may be larger than the data written to the stream. To synchronise the buffer's reported size with the stream, call the MStreamBuf::SynchL() function.

Note that this object never takes ownership of the dynamic buffer, the CBufBase type object.

See also: RBufWriteStream RBufReadStream CBufBase::Size() MStreamBuf::SynchL()

Member Enumeration Documentation

Enum anonymous

EnumeratorValueDescription
ETruncate0x10
EInsert0x20

Constructor & Destructor Documentation

TBufBuf ( )

IMPORT_CTBufBuf()

Constructs an empty object.

Call Set() before using the object.

Member Function Documentation

DoSeekL ( TMark, TStreamLocation, TInt )

IMPORT_C TStreamPosDoSeekL(TMarkaMark,
TStreamLocationaLocation,
TIntanOffset
)[protected, virtual]

DoSynchL ( )

IMPORT_C voidDoSynchL()[protected, virtual]

Reimplemented from MStreamBuf::DoSynchL()

Synchronises the stream buffer with the stream, leaving if any error occurs.

In effect, this ensures that buffered data is delivered to the stream.

It is called by SynchL().

This implementation is empty, but classes derived from MStreamBuf can provide their own implementation, if necessary.

See also: MStreamBuf::SynchL()

DoWriteL ( const TAny *, TInt )

IMPORT_C voidDoWriteL(const TAny *aPtr,
TIntaLength
)[protected, virtual]

Writes data from the specified memory location into the intermediate buffer.

The function calls the virtual function OverfLowL() to give concrete implementations the chance to forward the intermediate buffer content to its destination.

This implementation overrides the one supplied by the base class MStreamBuf, and is called by MStreamBuf::WriteL(const TAny*,TInt).

See also: MStreamBuf::WriteL() MStreamBuf::DoWriteL()

Parameters
aPtrA pointer to the source memory location for the data to be written to the intermediate buffer.
aLengthThe number of bytes to be written.
Return Value
The number of bytes written.

OverflowL ( )

IMPORT_C voidOverflowL()[protected, virtual]

Reimplemented from TStreamBuf::OverflowL()

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.

Set ( CBufBase &, TInt, TInt )

IMPORT_C voidSet(CBufBase &aBuf,
TIntaPos,
TIntaMode = ERead|EWrite
)

Sets up the stream to use the specified dynamic buffer.

See also: CBufBase MStreamBuf::TRead MStreamBuf::TWrite

Parameters
aBufThe dynamic buffer that hosts the stream and that also acts as the intermediate buffer.
aPosThe offset within the dynamic buffer where the stream starts.
aModeThe mode in which the stream is to be used. It can be used in either or both read and write modes, represented by ERead and EWrite. In addition, specify TBufBuf::EInsert to imply insert mode; specify TBufBuf::ETruncate to imply truncate mode. If neither TBufBuf::EInsert nor TBufBuf::ETruncate are specified, then overwrite mode is implied. Both TBufBuf::EInsert and TBufBuf::ETruncate imply EWrite.

UnderflowL ( TInt )

IMPORT_C TIntUnderflowL(TIntaMaxLength)[protected, virtual]

Reimplemented from TStreamBuf::UnderflowL(TInt)

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.

Parameters
aMaxLengthThe maximum amount of data required for the intermediate buffer.
Return Value
The amount of data available in the intermediate buffer.