RWriteStream Class Reference

class RWriteStream

The write stream interface. The process of externalising to a stream is achieved through a reference to an object of this type.

A store aware class defines and implements an ExternalizeL() member function which is used to externalise that object and takes a reference to an RWriteStream as the interface to the write stream.

Public Member Functions
RWriteStream ()
RWriteStream (const MExternalizer < TStreamRef > &)
RWriteStream ( MStreamBuf *)
IMPORT_C void Close ()
IMPORT_C void CommitL ()
void Pop ()
IMPORT_C void PushL ()
IMPORT_C void Release ()
MStreamBuf * Sink ()
IMPORT_C void WriteInt16L ( TInt )
IMPORT_C void WriteInt32L ( TInt32 )
IMPORT_C void WriteInt8L ( TInt )
IMPORT_C void WriteL (const TDesC8 &)
IMPORT_C void WriteL (const TDesC8 &, TInt )
IMPORT_C void WriteL (const TUint8 *, TInt )
IMPORT_C void WriteL ( RReadStream &)
IMPORT_C void WriteL ( RReadStream &, TInt )
IMPORT_C void WriteL (const TDesC16 &)
IMPORT_C void WriteL (const TDesC16 &, TInt )
IMPORT_C void WriteL (const TUint16 *, TInt )
IMPORT_C void WriteReal32L ( TReal )
IMPORT_C void WriteReal64L ( TReal64 )
IMPORT_C void WriteUint16L ( TUint )
IMPORT_C void WriteUint32L ( TUint32 )
IMPORT_C void WriteUint8L ( TUint )
Protected Member Functions
void Attach ( MStreamBuf *)
void Detach ()
Private Member Functions
IMPORT_C void WriteRefL ( TStreamRef )
Private Attributes
const MExternalizer < TStreamRef > * iExterL
MStreamBuf * iSnk

Constructor & Destructor Documentation

RWriteStream()

RWriteStream ( ) [inline]

The stream buffer sink, as returned by Sink() , is set to NULL, and the stream has no associated Store map.

RWriteStream(const MExternalizer< TStreamRef > &)

RWriteStream ( const MExternalizer < TStreamRef > & anExter ) [inline]

Constructs a write stream with an associated store map. The stream buffer sink is set to NULL.

Parameters

const MExternalizer < TStreamRef > & anExter Specifies an externaliser. For example, CStoreMap implements MExternalizer<TStreamRef>.

RWriteStream(MStreamBuf *)

RWriteStream ( MStreamBuf * aSink ) [inline]

Constructs a write stream over the supplied stream buffer. The stream has no associated Store map.

Parameters

MStreamBuf * aSink The stream buffer used to write to the write stream.

Member Functions Documentation

Attach(MStreamBuf *)

void Attach ( MStreamBuf * aSink ) [protected, inline]

Sets the stream buffer sink for this write stream. The existing sink, if there is one, will be discarded.

This is useful for derived classes, enabling them to set the sink following construction.

Note:

Release() is not called for discarded sinks.

Parameters

MStreamBuf * aSink The stream buffer sink for this write stream.

Close()

IMPORT_C void Close ( )

Commits data to the stream before freeing resources used by the stream. This ensures that any buffered data is written to the stream.

Note that the function cannot leave. Any errors arising from the attempt to commit data to the stream are ignored.

CommitL()

IMPORT_C void CommitL ( )

Ensures that any buffered data is written to the stream. Once committed, it is not possible to roll back the newly written data.

Detach()

void Detach ( ) [protected, inline]

Sets the stream buffer sink for this write stream to NULL. The existing sink, if there is one, will be discarded.

Note:

Release() is not called for discarded sinks.

Pop()

void Pop ( ) [inline]

Removes the cleanup item for this write stream object from the cleanup stack.

PushL()

IMPORT_C void PushL ( )

Puts a cleanup item for this write stream object onto the cleanup stack. This allows allocated resources to be cleaned up if a subsequent leave occurs.

Release()

IMPORT_C void Release ( )

Frees resources before abandoning the stream. The function is called after data has been committed to the stream.

Note that if a cleanup item for the stream was placed on the cleanup stack when the stream was opened (e.g by a call to RStoreWriteStreamss CreateLC(), OpenLC(), ReplaceLC() or RDictionaryStores AssignLC() etc), then this function need not be called explicitly; clean up is implicitly done by CleanupStack::PopAndDestroy() .

Sink()

MStreamBuf * Sink ( ) [inline]

Gets the underlying stream buffer for the write stream. This provides access to the stream-buffer implementation used by the write stream.

WriteInt16L(TInt)

IMPORT_C void WriteInt16L ( TInt aValue )

Writes a TInt value as a 16 bit value to this stream.

Parameters

TInt aValue The value to be written to this stream.

WriteInt32L(TInt32)

IMPORT_C void WriteInt32L ( TInt32 aValue )

Writes a TInt32 value as a 32 bit value to this stream.

Parameters

TInt32 aValue The value to be written to this stream.

WriteInt8L(TInt)

IMPORT_C void WriteInt8L ( TInt aValue )

Writes a TInt value as an 8 bit value to this stream.

Parameters

TInt aValue The value to be written to this stream.

WriteL(const TDesC8 &)

IMPORT_C void WriteL ( const TDesC8 & aDes )

Writes the content of the 8 bit descriptor to the stream. No other information is written to this write stream.

Parameters

const TDesC8 & aDes A reference to a descriptor. Passing the build independent type TDesC& allows the compiler to choose the appropriate WriteL() variant (i.e the 8 bit or the 16 bit) at build time.

WriteL(const TDesC8 &, TInt)

IMPORT_C void WriteL ( const TDesC8 & aDes,
TInt aLength
)

Writes data of the specified length from the 8 bit descriptor to the stream. No other information is written to this write stream.

Parameters

const TDesC8 & aDes A reference to a descriptor. Passing the build independent type TDesC& allows the compiler to choose the appropriate WriteL() variant (i.e the 8 bit or the 16 bit) at build time.
TInt aLength The length of data to be written to this stream.

WriteL(const TUint8 *, TInt)

IMPORT_C void WriteL ( const TUint8 * aPtr,
TInt aLength
)

Writes 8 bit data of the specified length from the specified location to this write stream.

Parameters

const TUint8 * aPtr The location from where data is to be streamed out.
TInt aLength The length of data to be streamed out.

WriteL(RReadStream &)

IMPORT_C void WriteL ( RReadStream & aStream )

Writes the content of the specified read stream to this write stream.

Parameters

RReadStream & aStream A reference to a read stream which is to be written to this stream.

WriteL(RReadStream &, TInt)

IMPORT_C void WriteL ( RReadStream & aStream,
TInt aLength
)

Writes data of the specified length from the specified read stream to this stream.

Parameters

RReadStream & aStream A reference to a read stream part of whose content is to be written to this stream.
TInt aLength The length of data from the read stream to be written to this write stream.

WriteL(const TDesC16 &)

IMPORT_C void WriteL ( const TDesC16 & aDes )

Writes the content of the 16 bit descriptor to the stream. No other information is written to this write stream.

Parameters

const TDesC16 & aDes A reference to a descriptor. Passing the build independent type TDesC& allows the compiler to choose the appropriate WriteL() variant (i.e the 8 bit or the 16 bit) at build time.

WriteL(const TDesC16 &, TInt)

IMPORT_C void WriteL ( const TDesC16 & aDes,
TInt aLength
)

Writes data of the specified length from the 16 bit descriptor to the stream. No other information is written to this write stream.

Parameters

const TDesC16 & aDes A reference to a descriptor. Passing the build independent type TDesC& allows the compiler to choose the appropriate WriteL() variant (i.e the 8 bit or the 16 bit) at build time.
TInt aLength The length of data to be written to this stream.

WriteL(const TUint16 *, TInt)

IMPORT_C void WriteL ( const TUint16 * aPtr,
TInt aLength
)

Writes 16 bit data of the specified length from the specified location to this write stream.

Parameters

const TUint16 * aPtr The location from where data is to be streamed out.
TInt aLength The length of data to be streamed out.

WriteReal32L(TReal)

IMPORT_C void WriteReal32L ( TReal aValue )

Writes a TReal value as a 32 bit value to this stream.

Parameters

TReal aValue The value to be written to this stream.

WriteReal64L(TReal64)

IMPORT_C void WriteReal64L ( TReal64 aValue )

Writes a TReal64 value as a 64 bit value to this stream.

Parameters

TReal64 aValue The value to be written to this stream.

WriteRefL(TStreamRef)

IMPORT_C void WriteRefL ( TStreamRef aRef ) [private]

Parameters

TStreamRef aRef

WriteUint16L(TUint)

IMPORT_C void WriteUint16L ( TUint aValue )

Writes a TUint value as a 16 bit value to this stream.

Parameters

TUint aValue The value to be written to this stream.

WriteUint32L(TUint32)

IMPORT_C void WriteUint32L ( TUint32 aValue )

Writes a TUint32 value as a 32 bit value to this stream.

Parameters

TUint32 aValue The value to be written to this stream.

WriteUint8L(TUint)

IMPORT_C void WriteUint8L ( TUint aValue )

Writes a TUint value as an 8 bit value to this stream.

Parameters

TUint aValue The value to be written to this stream.

Member Data Documentation

const MExternalizer< TStreamRef > * iExterL

const MExternalizer < TStreamRef > * iExterL [private]

MStreamBuf * iSnk

MStreamBuf * iSnk [private]