Symbian Developer Library

SYMBIAN OS V6.1 EDITION FOR C++

[Index] [Glossary] [Previous] [Next]



Location: s32buf.h
Link against: estor.lib

Class TStreamFilter

TStreamFilter

Support

Supported from 5.0

Description

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.

Derivation

MStreamBufA stream buffer that provides a generic I/O interface for streamed data
TStreamFilterInterface to a stream filter

Defined in TStreamFilter:
Capacity(), Committed(), DoReadL(), DoRelease(), DoSynchL(), DoWriteL(), EmitL(), FilterL(), IsCommitted(), Set(), TStreamFilter()

Inherited from MStreamBuf:
SeekL(), Close(), DoSeekL(), ERead, EWrite, PushL(), Read(), ReadL(), Release(), SeekL(), SizeL(), Synch(), SynchL(), TMark, TRead, TWrite, TellL(), Write(), WriteL()


Construction


TStreamFilter()

protected : TStreamFilter();

Description

Constructs an empty stream filter object.

[Top]


Member functions


Set()

protected : void Set(MStreamBuf* aHost,TInt aMode);

Description

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

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.

Notes:

See also:


Committed()

protected : void Committed();
    

Description

Flags the streamed data as committed.


IsCommitted()

protected : TBool IsCommitted() const;

Description

Tests whether the streamed data is committed.

Return value

TBool

True, if streamed data is committed; false, otherwise.


EmitL()

protected : void EmitL(const TAny* aPtr,TInt aLength);

Description

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().

Parameters

constTAny* 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.

Notes:

See also:

[Top]


Virtual functions overriding default behaviour


DoReadL()

protected : TInt DoReadL(TAny* aPtr,TInt aMaxLength);

Description

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

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.

Return value

TInt

The number of bytes read.

Notes:


DoWriteL()

protected : void DoWriteL(const TAny* aPtr,TInt aLength);

Description

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

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.

Notes:


DoRelease()

protected : void DoRelease();

Description

Frees the host stream's resources.

See also:


DoSynchL()

protected : void DoSynchL();

Description

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

See also:

[Top]


Interface functions


Capacity()

private:    virtual TInt Capacity(TInt aMaxLength)=0;

Description

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.

Return value

TInt

The maximum amount of unfiltered data guaranteed not to generate more than aMaxLength bytes of filtered output.


FilterL()

private : virtual TInt FilterL(TAny* aPtr,TInt aMaxLength,const TUint8*& aFrom,const TUint8* anEnd)=0;

Description

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.

Return value

TInt

The size of the filtered data.