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.
Public Member Functions | |
---|---|
~CBufFlat() | |
IMPORT_C TPtr8 | BackPtr(TInt) |
TInt | Capacity() |
IMPORT_C void | Compress() |
IMPORT_C void | Delete(TInt, TInt) |
IMPORT_C CBufFlat * | NewL(TInt) |
IMPORT_C TPtr8 | Ptr(TInt) |
IMPORT_C void | SetReserveL(TInt) |
Protected Member Functions | |
---|---|
CBufFlat(TInt) |
Private Member Functions | |
---|---|
IMPORT_C void | DoInsertL(TInt, const TAny *, TInt) |
Private Attributes | |
---|---|
TInt | iMaxSize |
TUint8 * | iPtr |
Inherited Attributes | |
---|---|
CBufBase::iExpandSize | |
CBufBase::iSize |
IMPORT_C TPtr8 | BackPtr | ( | TInt | aPos | ) | [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(). |
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.
IMPORT_C void | Compress | ( | ) | [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.
IMPORT_C void | Delete | ( | TInt | aPos, |
TInt | aLength | |||
) | [virtual] |
Deletes data from the buffer.
Derived classes provide the implementation.
IMPORT_C void | DoInsertL | ( | TInt | aPos, |
const TAny * | aPtr, | |||
TInt | aLength | |||
) | [private, virtual] |
IMPORT_C TPtr8 | Ptr | ( | TInt | aPos | ) | [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(). |