CBufFlat Class Reference

class CBufFlat : public CBufBase

Provides a flat storage dynamic buffer.

This class should be used when high-speed pointer lookup is an important consideration, and you are reasonably confident that the insertion of data will not fail.

This class is an implementation of the abstract buffer interface provided by CBufBase and uses a single heap cell to contain the data.

Inherits from

Constructor & Destructor Documentation

CBufFlat(TInt)

IMPORT_CCBufFlat(TIntanExpandSize)[protected]

Parameters

TInt anExpandSize

~CBufFlat()

IMPORT_C~CBufFlat()

Member Functions Documentation

BackPtr(TInt)

IMPORT_C TPtr8BackPtr(TIntaPos)[virtual]

Gets a pointer descriptor to represent data from just before the specified data byte backward to the beginning of the contiguous region containing that byte.

Derived classes provide the implementation.

Descriptor representing the back contiguous region. The address in the descriptor is the pointer to the bytes at the buffer position, unless the buffer position was at the beginning of a non-first segment in the buffer: in this case, the address is a pointer just beyond the last data byte in the previous segment. The length is the number of contiguous bytes from the address backwards to the beginning of the segment.

CBufFlat::BackPtr

CBufSeg::BackPtr

Parameters

TInt aPosBuffer position: must be in range zero to Size().

Capacity()

TInt Capacity()const [inline]

Gets the size to which the buffer may expand without re-allocation.

The size of the allocated cell associated with the buffer. This is the maximum size the buffer may be expanded to without re-allocation.

Compress()

IMPORT_C voidCompress()[virtual]

Compresses the buffer so as to occupy minimal space.

Normally, you would call this when a buffer has reached its final size, or when you know it will not expand again for a while, or when an out-of-memory error has occurred and your program is taking measures to save space. Compression in these circumstances releases memory for other programs to use, but has no adverse effect on performance.

Derived classes provide the implementation.

CBufFlat::Compress

CBufSeg::Compress

Delete(TInt, TInt)

IMPORT_C voidDelete(TIntaPos,
TIntaLength
)[virtual]

Deletes data from the buffer.

Derived classes provide the implementation.

CBufFlat::Delete

CBufSeg::Delete

Parameters

TInt aPosBuffer position where the deletion will begin; must be in the range zero to (Size() minus the length of the data to be deleted).
TInt aLengthThe number of bytes to be deleted; must be non-negative.

DoInsertL(TInt, const TAny *, TInt)

IMPORT_C voidDoInsertL(TIntaPos,
const TAny *aPtr,
TIntaLength
)[private, virtual]

Parameters

TInt aPos
const TAny * aPtr
TInt aLength

NewL(TInt)

IMPORT_C CBufFlat *NewL(TIntanExpandSize)[static]

Parameters

TInt anExpandSize

Ptr(TInt)

IMPORT_C TPtr8Ptr(TIntaPos)[virtual]

Gets a pointer descriptor to represent the data from the specified position to the end of the contiguous region containing that byte.

Derived classes provide the implementation.

Descriptor representing the data starting at aPos, and whose length indicates the number of contiguous bytes stored in the buffer, forward from that point. The length will be non-zero unless aPos==Size().

CBufFlat::Ptr

CBufSeg::Ptr

Parameters

TInt aPosBuffer position: must be in range zero to Size().

SetReserveL(TInt)

IMPORT_C voidSetReserveL(TIntaSize)

Parameters

TInt aSize

Member Data Documentation

TInt iMaxSize

TInt iMaxSize[private]

TUint8 * iPtr

TUint8 *iPtr[private]