TStreamFilter Class Reference

class TStreamFilter : public MStreamBuf

Interface to a stream filter.

A stream filter is an object that allows stream data to be filtered after retrieval from a host or filtered before being written to a host.

The class is abstract and a derived class must be defined an implemented.

Inherits from

Protected Member Functions
TStreamFilter ()
void Committed ()
IMPORT_C TInt DoReadL ( TAny *, TInt )
IMPORT_C void DoRelease ()
IMPORT_C void DoSynchL ()
IMPORT_C void DoWriteL (const TAny *, TInt )
IMPORT_C void EmitL (const TAny *, TInt )
TBool IsCommitted ()
void Set ( MStreamBuf *, TInt )
Private Member Functions
TInt Capacity ( TInt )
TInt FilterL ( TAny *, TInt , const TUint8 *&, const TUint8 *)
IMPORT_C void __DbgChkMode ( TInt )
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 &)
Inherited Enumerations
MStreamBuf:TRead
MStreamBuf:TWrite
Private Attributes
MStreamBuf * iHost
TInt iMode

Constructor & Destructor Documentation

TStreamFilter()

IMPORT_C TStreamFilter ( ) [protected]

Constructs an empty stream filter object.

Member Functions Documentation

Capacity(TInt)

TInt Capacity ( TInt aMaxLength ) [private, pure virtual]

Calculates the maximum size of unfiltered data necessary to give the specified amount of filtered data.

Parameters

TInt aMaxLength The amount of filtered data required.

Committed()

void Committed ( ) [protected, inline]

Flags the streamed data as committed.

DoReadL(TAny *, TInt)

IMPORT_C TInt DoReadL ( TAny * aPtr,
TInt aMaxLength
) [protected, virtual]

Reads data from the host stream through the filter into the specified memory location.

In debug mode: the filter must be in read mode, otherwise the function raises a STORE-Stream 10 panic.

In debug mode, a host stream must have been set before calling this function, otherwise it raises a STORE-Stream 0 panic.

Parameters

TAny * aPtr A pointer to the target memory location for the filtered data.
TInt aMaxLength The maximum number of bytes to be read. In debug mode: if this value is negative then the function raises a STORE-Stream 1 panic; if this value is zero, then the function raises a STORE-Stream 3 panic.

DoRelease()

IMPORT_C void DoRelease ( ) [protected, virtual]

Frees the host stream's resources.

MStreamBuf::DoRelease()

DoSynchL()

IMPORT_C void DoSynchL ( ) [protected, virtual]

Synchronizes the host's intermediate buffer with its stream, leaving if any error occurs.

MStreamBuf::DoSynchL()

DoWriteL(const TAny *, TInt)

IMPORT_C void DoWriteL ( const TAny * aPtr,
TInt aLength
) [protected, virtual]

Writes data to the host stream through the filter from the specified memory location.

In debug mode: the filter must be in write mode, otherwise the function raises a STORE-Stream 11 panic.

In debug mode, a host stream must have been set before calling this function, otherwise it raises a STORE-Stream 0 panic.

Parameters

const TAny * aPtr A pointer to the source memory location.
TInt aLength The number of bytes to be written. In debug mode: if this value is negative then the function raises a STORE-Stream 1 panic; if this value is zero, then the function raises a STORE-Stream 7 panic.

EmitL(const TAny *, TInt)

IMPORT_C void EmitL ( const TAny * aPtr,
TInt aLength
) [protected]

Writes data from the specified memory location directly to the host without filtering.

This is useful for sending any final data, when flushing the filter as part of DoSynchL() .

In debug mode: the filter must be in write mode, otherwise the function raises a STORE-Stream 11 panic.

In debug mode, a host stream must have been set before calling this function, otherwise it raises a STORE-Stream 0 panic.

DoSynchL()

Parameters

const TAny * aPtr A pointer to the memory location from which data is to be written to the host stream.
TInt aLength The number of bytes to be written.

FilterL(TAny *, TInt, const TUint8 *&, const TUint8 *)

TInt FilterL ( TAny * aPtr,
TInt aMaxLength,
const TUint8 *& aFrom,
const TUint8 * anEnd
) [private, pure virtual]

Performs the filtration process.

Parameters

TAny * aPtr Pointer to the output location for the filtered data.
TInt aMaxLength The maximum amount of space available for the filtered data.
const TUint8 *& aFrom A reference to a pointer to the unfiltered data source. This pointer should be advanced as the source is consumed.
const TUint8 * anEnd Pointer to the first byte beyond the end of the unfiltered data source.

IsCommitted()

TBool IsCommitted ( ) const [protected, inline]

Tests whether the streamed data is committed.

Set(MStreamBuf *, TInt)

void Set ( MStreamBuf * aHost,
TInt aMode
) [protected, inline]

Sets up the filter to use the specified host for streamed data.

Taking ownership of the host stream buffer means that calls to SynchL() propagate to the host buffer after the filter has flushed its data, and that when the filter is released it also releases the host buffer.

MStreamBuf::TRead MStreamBuf::TWrite

Parameters

MStreamBuf * aHost The host for the streamed data - a stream buffer.
TInt aMode The mode in which the stream buffer is to be used. It can be used in either read or write modes, represented by ERead and EWrite, but not both at the same time. In debug mode, setting both raises a STORE-Stream 18 panic. In addition, specify EAttached to indicate that the filter should take ownership of the host stream buffer.

__DbgChkMode(TInt)

IMPORT_C void __DbgChkMode ( TInt aMode ) [private, static]

Parameters

TInt aMode

Member Data Documentation

MStreamBuf * iHost

MStreamBuf * iHost [private]

TInt iMode

TInt iMode [private]