class CBufBase : public CBase |
Defines the interface for dynamic buffers.
The basic functions, InsertL(), Read(), Write(), Delete(), Reset() and Size(), transfer data between the buffer and other places, and allow that data to be deleted
The ExpandL() and Resize() functions allow some operations to be carried out with greater efficiency
A Compress() function frees (back to the heap) any space which may have been allocated, but not used
Ptr() and BackPtr() allow look-up of contiguous data from any given position, forward or backward
Public Member Functions | |
---|---|
~CBufBase() | |
TPtr8 | BackPtr(TInt) |
void | Compress() |
void | Delete(TInt, TInt) |
IMPORT_C void | ExpandL(TInt, TInt) |
IMPORT_C void | InsertL(TInt, const TDesC8 &) |
IMPORT_C void | InsertL(TInt, const TDesC8 &, TInt) |
IMPORT_C void | InsertL(TInt, const TAny *, TInt) |
TPtr8 | Ptr(TInt) |
IMPORT_C void | Read(TInt, TDes8 &) |
IMPORT_C void | Read(TInt, TDes8 &, TInt) |
IMPORT_C void | Read(TInt, TAny *, TInt) |
IMPORT_C void | Reset() |
IMPORT_C void | ResizeL(TInt) |
TInt | Size() |
IMPORT_C void | Write(TInt, const TDesC8 &) |
IMPORT_C void | Write(TInt, const TDesC8 &, TInt) |
IMPORT_C void | Write(TInt, const TAny *, TInt) |
Protected Member Functions | |
---|---|
CBufBase(TInt) |
Private Member Functions | |
---|---|
void | DoInsertL(TInt, const TAny *, TInt) |
Protected Attributes | |
---|---|
TInt | iExpandSize |
TInt | iSize |
TPtr8 | BackPtr | ( | TInt | aPos | ) | [pure 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.
TInt aPos | Buffer position: must be in range zero to Size(). |
void | Compress | ( | ) | [pure 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.
void | Delete | ( | TInt | aPos, |
TInt | aLength | |||
) | [pure virtual] |
Deletes data from the buffer.
Derived classes provide the implementation.
void | DoInsertL | ( | TInt | aPos, |
const TAny * | aPtr, | |||
TInt | aLength | |||
) | [private, pure virtual] |
IMPORT_C void | InsertL | ( | TInt | aPos, |
const TDesC8 & | aDes, | |||
TInt | aLength | |||
) |
TPtr8 | Ptr | ( | TInt | aPos | ) | [pure 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().
TInt aPos | Buffer position: must be in range zero to Size(). |
TInt | Size | ( | ) | const [inline] |
Gets the number of data bytes in the buffer.
Note that the number of heap bytes used by the buffer may be greater than its size, because there is typically extra room to allow for expansion. Use the Compress() function to reduce the extra allocation as much as possible.
The number of data bytes in the buffer.