TStreamExchange Class Reference

class TStreamExchange

Manages access to a shared host buffer for shared stream buffers.

The class maintains independent markers for the shared stream buffer that has most recently read or written to the shared host buffer.

This is the way in which multiple requests from the same shared stream buffer are handled without the need for repeated seeking. The shared host buffer only needs to seek when a new shared buffer needs to use it

RShareBuf

Public Member Functions
TStreamExchange ()
TStreamExchange ( MStreamBuf *)
IMPORT_C MStreamBuf * Host ()
IMPORT_C MStreamBuf * HostL ()
TBool IsActive ()
IMPORT_C void Release ()
void Share ( MStreamBuf *)
IMPORT_C TInt SizeL ()
Private Member Functions
TStreamExchange (const TStreamExchange &)
MStreamBuf & Buf ()
MStreamBuf & BufL ()
IMPORT_C TInt DoReadL ( TAny *, TInt , TStreamMark &)
IMPORT_C TInt DoReadL ( TDes8 &, TInt , TRequestStatus &, TStreamMark &)
IMPORT_C TStreamTransfer DoReadL ( MStreamInput &, TStreamTransfer , TStreamMark &)
IMPORT_C TStreamPos DoSeekL ( TStreamMark &, TStreamLocation , TInt )
IMPORT_C void DoWriteL (const TAny *, TInt , TStreamMark &)
IMPORT_C TInt DoWriteL (const TDesC8 &, TInt , TRequestStatus &, TStreamMark &)
IMPORT_C TStreamTransfer DoWriteL ( MStreamOutput &, TStreamTransfer , TStreamMark &)
IMPORT_C void Drop (const TStreamMark &)
IMPORT_C void GetL ( TStreamMark &)
TStreamPos MarkSeekL ( TStreamMark &, TStreamLocation , TInt )
TInt PrepareAndReadL ( TAny *, TInt , TStreamMark &)
TInt PrepareAndReadL ( TDes8 &, TInt , TRequestStatus &, TStreamMark &)
TStreamTransfer PrepareAndReadL ( MStreamInput &, TStreamTransfer , TStreamMark &)
void PrepareAndWriteL (const TAny *, TInt , TStreamMark &)
TInt PrepareAndWriteL (const TDesC8 &, TInt , TRequestStatus &, TStreamMark &)
TStreamTransfer PrepareAndWriteL ( MStreamOutput &, TStreamTransfer , TStreamMark &)
void PrepareForReadingL ( TStreamMark &)
void PrepareForWritingL ( TStreamMark &)
IMPORT_C TBool RefersTo (const TStreamMark &)
TStreamExchange & operator= (const TStreamExchange &)
Private Member Type Definitions
typedef MStreamBuf::TMark TMark
Private Attributes
MStreamBuf * iHost
TStreamMark * iRMrk
TStreamMark * iWMrk

Constructor & Destructor Documentation

TStreamExchange()

TStreamExchange ( ) [inline]

Constructs an empty object.

Call Share() to prepare for access to a shared stream buffer.

TStreamExchange(MStreamBuf *)

TStreamExchange ( MStreamBuf * aHost ) [inline]

Constructs the object, specifying the stream buffer that will act as the shared host.

Parameters

MStreamBuf * aHost A pointer to a stream buffer that will act as the shared host.

TStreamExchange(const TStreamExchange &)

TStreamExchange ( const TStreamExchange & ) [private]

Constructs an empty object.

Call Share() to prepare for access to a shared stream buffer.

Parameters

const TStreamExchange &

Member Functions Documentation

Buf()

MStreamBuf & Buf ( ) const [private, inline]

BufL()

MStreamBuf & BufL ( ) const [private, inline]

DoReadL(TAny *, TInt, TStreamMark &)

IMPORT_C TInt DoReadL ( TAny * aPtr,
TInt aMaxLength,
TStreamMark & aMark
) [private]

Parameters

TAny * aPtr
TInt aMaxLength
TStreamMark & aMark

DoReadL(TDes8 &, TInt, TRequestStatus &, TStreamMark &)

IMPORT_C TInt DoReadL ( TDes8 & aDes,
TInt aMaxLength,
TRequestStatus & aStatus,
TStreamMark & aMark
) [private]

Parameters

TDes8 & aDes
TInt aMaxLength
TRequestStatus & aStatus
TStreamMark & aMark

DoReadL(MStreamInput &, TStreamTransfer, TStreamMark &)

IMPORT_C TStreamTransfer DoReadL ( MStreamInput & anInput,
TStreamTransfer aTransfer,
TStreamMark & aMark
) [private]

Parameters

MStreamInput & anInput
TStreamTransfer aTransfer
TStreamMark & aMark

DoSeekL(TStreamMark &, TStreamLocation, TInt)

IMPORT_C TStreamPos DoSeekL ( TStreamMark & aMark,
TStreamLocation aLocation,
TInt anOffset
) [private]

Parameters

TStreamMark & aMark
TStreamLocation aLocation
TInt anOffset

DoWriteL(const TAny *, TInt, TStreamMark &)

IMPORT_C void DoWriteL ( const TAny * aPtr,
TInt aLength,
TStreamMark & aMark
) [private]

Parameters

const TAny * aPtr
TInt aLength
TStreamMark & aMark

DoWriteL(const TDesC8 &, TInt, TRequestStatus &, TStreamMark &)

IMPORT_C TInt DoWriteL ( const TDesC8 & aDes,
TInt aMaxLength,
TRequestStatus & aStatus,
TStreamMark & aMark
) [private]

Parameters

const TDesC8 & aDes
TInt aMaxLength
TRequestStatus & aStatus
TStreamMark & aMark

DoWriteL(MStreamOutput &, TStreamTransfer, TStreamMark &)

IMPORT_C TStreamTransfer DoWriteL ( MStreamOutput & anOutput,
TStreamTransfer aTransfer,
TStreamMark & aMark
) [private]

Parameters

MStreamOutput & anOutput
TStreamTransfer aTransfer
TStreamMark & aMark

Drop(const TStreamMark &)

IMPORT_C void Drop ( const TStreamMark & aMark ) [private]

Parameters

const TStreamMark & aMark

GetL(TStreamMark &)

IMPORT_C void GetL ( TStreamMark & aMark ) [private]

Parameters

TStreamMark & aMark

Host()

IMPORT_C MStreamBuf * Host ( )

Gets a pointer to the stream buffer that acts as the shared host.

The function refreshes the active read/write marks and gives the caller exclusive use of the shared host.

HostL()

IMPORT_C MStreamBuf * HostL ( )

Gets a pointer to the stream buffer that acts as the shared host, and leaves if this object is not active.

The function refreshes the active read/write marks and gives the caller exclusive use of the shared host.

IsActive()

IsActive()

TBool IsActive ( ) const [inline]

Tests whether this object is using a stream buffer that is acting as shared host.

MarkSeekL(TStreamMark &, TStreamLocation, TInt)

TStreamPos MarkSeekL ( TStreamMark & aMark,
TStreamLocation aLocation,
TInt anOffset
) [private]

Parameters

TStreamMark & aMark
TStreamLocation aLocation
TInt anOffset

PrepareAndReadL(TAny *, TInt, TStreamMark &)

TInt PrepareAndReadL ( TAny * aPtr,
TInt aMaxLength,
TStreamMark & aMark
) [private]

Parameters

TAny * aPtr
TInt aMaxLength
TStreamMark & aMark

PrepareAndReadL(TDes8 &, TInt, TRequestStatus &, TStreamMark &)

TInt PrepareAndReadL ( TDes8 & aDes,
TInt aMaxLength,
TRequestStatus & aStatus,
TStreamMark & aMark
) [private]

Parameters

TDes8 & aDes
TInt aMaxLength
TRequestStatus & aStatus
TStreamMark & aMark

PrepareAndReadL(MStreamInput &, TStreamTransfer, TStreamMark &)

TStreamTransfer PrepareAndReadL ( MStreamInput & anInput,
TStreamTransfer aTransfer,
TStreamMark & aMark
) [private]

Parameters

MStreamInput & anInput
TStreamTransfer aTransfer
TStreamMark & aMark

PrepareAndWriteL(const TAny *, TInt, TStreamMark &)

void PrepareAndWriteL ( const TAny * aPtr,
TInt aLength,
TStreamMark & aMark
) [private]

Parameters

const TAny * aPtr
TInt aLength
TStreamMark & aMark

PrepareAndWriteL(const TDesC8 &, TInt, TRequestStatus &, TStreamMark &)

TInt PrepareAndWriteL ( const TDesC8 & aDes,
TInt aMaxLength,
TRequestStatus & aStatus,
TStreamMark & aMark
) [private]

Parameters

const TDesC8 & aDes
TInt aMaxLength
TRequestStatus & aStatus
TStreamMark & aMark

PrepareAndWriteL(MStreamOutput &, TStreamTransfer, TStreamMark &)

TStreamTransfer PrepareAndWriteL ( MStreamOutput & anOutput,
TStreamTransfer aTransfer,
TStreamMark & aMark
) [private]

Parameters

MStreamOutput & anOutput
TStreamTransfer aTransfer
TStreamMark & aMark

PrepareForReadingL(TStreamMark &)

void PrepareForReadingL ( TStreamMark & aMark ) [private]

Parameters

TStreamMark & aMark

PrepareForWritingL(TStreamMark &)

void PrepareForWritingL ( TStreamMark & aMark ) [private]

Parameters

TStreamMark & aMark

RefersTo(const TStreamMark &)

IMPORT_C TBool RefersTo ( const TStreamMark & aMark ) [private]

Parameters

const TStreamMark & aMark

Release()

IMPORT_C void Release ( )

Releases the reference to the shared host, and drops any active read or write marks.

Share(MStreamBuf *)

void Share ( MStreamBuf * aHost ) [inline]

Tells the object to use the specified stream buffer that will act as the shared host.

Parameters

MStreamBuf * aHost A pointer to a stream buffer that will act as the shared host.

SizeL()

IMPORT_C TInt SizeL ( ) const

Gets the size of the shared host buffer.

operator=(const TStreamExchange &)

TStreamExchange & operator= ( const TStreamExchange & ) [private]

Parameters

const TStreamExchange &

Member Type Definitions Documentation

Typedef TMark

typedef MStreamBuf::TMark TMark [private]

Used to identify the type of mark in a stream.

The type is used by functions of this class and derived classes that perform seek operations to marks within a stream.

The type uses the ERead and EWrite enumeration values, as bit flags, to identify the read and write marks respectively.

ERead is an MStreamBuf::TRead enumerator. EWrite is an MStreamBuf::EWrite enumerator.

MStreamBuf::TRead MStreamBuf::TWrite

Member Data Documentation

MStreamBuf * iHost

MStreamBuf * iHost [private]

TStreamMark * iRMrk

TStreamMark * iRMrk [private]

TStreamMark * iWMrk

TStreamMark * iWMrk [private]