Location:
e32base.h
Link against: euser.lib
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.
CBase
- Base class for all classes to be instantiated on the heap
CBufBase
- Defines the interface for dynamic buffers
CBufFlat
- Provides a flat storage dynamic buffer
Defined in CBufFlat
:
BackPtr()
, Capacity()
, Compress()
, Delete()
, DoInsertL()
, NewL()
, Ptr()
, SetReserveL()
, ~CBufFlat()
Inherited from CBase
:
Extension_()
,
operator new()
Inherited from CBufBase
:
ExpandL()
,
InsertL()
,
Read()
,
Reset()
,
ResizeL()
,
Size()
,
Write()
,
iExpandSize
,
iSize
IMPORT_C ~CBufFlat();
Destructor.
Frees all resources owned by the object, prior to its destruction. Specifically, it frees the allocated cell used as a buffer.
static IMPORT_C CBufFlat *NewL(TInt anExpandSize);
Allocates and constructs a flat buffer.
If there is insufficient memory available to allocate the flat buffer, the function leaves.
|
|
|
inline TInt Capacity() const;
Gets the size to which the buffer may expand without re-allocation.
|
IMPORT_C void SetReserveL(TInt aSize);
Specifies a minimum amount of space which the flat buffer should occupy.
If the required size is zero, the heap cell is deleted. If it is different from the current size, the heap cell is rellocated accordingly.
|
|
virtual IMPORT_C void Compress();
Compresses the buffer so as to occupy minimal space.
This frees any unused memory at the end of the buffer.
virtual IMPORT_C void Delete(TInt aPos, TInt aLength);
Deletes data from the buffer.
During deletion, any data beyond the deleted data is shuffled up so that the buffer contents are contiguous. No memory is freed.
|
|
virtual IMPORT_C TPtr8 Ptr(TInt aPos);
Gets a pointer descriptor to represent the data starting at the specified data byte through to the end of the contiguous region containing that byte.
Calculation of the pointer and length involves only a few machine instructions and is independent of the data contained in the buffer.
|
|
virtual IMPORT_C TPtr8 BackPtr(TInt aPos);
Gets a pointer descriptor to represent the data starting at the beginning of the contiguous region containing that byte through to the byte immediately preceding the specified byte.
The descriptor always points to the beginning of the buffer containing the specified byte. Calculation of the pointer and length involves only a few machine instructions and is independent of the data contained in the buffer.
|
|