Original Symbian headers
Selected EUSER, Window Server, networking, graphics and device declarations
Loading...
Searching...
No Matches
CBufFlat Class Reference

Provides a flat storage dynamic buffer. More...

#include <e32base.h>

Inheritance diagram for CBufFlat:
CBufBase CBase

Public Member Functions

IMPORT_C ~CBufFlat ()
 Destructor.
 
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.
 
IMPORT_C void Compress ()
 Compresses the buffer so as to occupy minimal space.
 
IMPORT_C void Delete (TInt aPos, TInt aLength)
 Deletes data from the buffer.
 
IMPORT_C TPtr8 Ptr (TInt aPos)
 Gets a pointer descriptor to represent the data from the specified position to
the end of the contiguous region containing that byte.
 
IMPORT_C TPtr8 BackPtr (TInt aPos)
 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.
 
- Public Member Functions inherited from CBufBase
IMPORT_C ~CBufBase ()
 Destructor.
 
TInt Size () const
 Gets the number of data bytes in the buffer.
 
IMPORT_C void Reset ()
 Deletes all data in the buffer.
 
IMPORT_C void Read (TInt aPos, TDes8 &aDes) const
 Reads data from the buffer into a descriptor.
 
IMPORT_C void Read (TInt aPos, TDes8 &aDes, TInt aLength) const
 Reads the specified number of bytes of data from the buffer into a descriptor.
 
IMPORT_C void Read (TInt aPos, TAny *aPtr, TInt aLength) const
 Reads the specified number of bytes of data from the buffer into a specified address.
 
IMPORT_C void Write (TInt aPos, const TDesC8 &aDes)
 Writes data from a descriptor to the buffer.
 
IMPORT_C void Write (TInt aPos, const TDesC8 &aDes, TInt aLength)
 Writes the specified number of bytes of data from a descriptor to the buffer.
 
IMPORT_C void Write (TInt aPos, const TAny *aPtr, TInt aLength)
 Writes the specified number of bytes of data from the specified address to the buffer.
 
IMPORT_C void InsertL (TInt aPos, const TDesC8 &aDes)
 Inserts data into the buffer.
 
IMPORT_C void InsertL (TInt aPos, const TDesC8 &aDes, TInt aLength)
 Inserts the specified number of bytes of data from a descriptor into the buffer.
 
IMPORT_C void InsertL (TInt aPos, const TAny *aPtr, TInt aLength)
 Inserts bytes of data from the specified address into the buffer.
 
IMPORT_C void ExpandL (TInt aPos, TInt aLength)
 Inserts an uninitialised region into the buffer.
 
IMPORT_C void ResizeL (TInt aSize)
 Re-sizes the buffer to the specified size.
 
- Public Member Functions inherited from CBase
 CBase ()
 Default constructor.
 
virtual IMPORT_C ~CBase ()
 Virtual destructor.
 
TAny * operator new (TUint aSize, TAny *aBase) __NO_THROW
 Initialises the object to binary zeroes.
 
TAny * operator new (TUint aSize) __NO_THROW
 Allocates the object from the heap and then initialises its contents to binary zeroes.
 
TAny * operator new (TUint aSize, TLeave)
 Allocates the object from the heap and then initialises its contents to binary zeroes.
 
TAny * operator new (TUint aSize, TUint aExtraSize) __NO_THROW
 Allocates the object from the heap and then initialises its contents to binary zeroes.
 
TAny * operator new (TUint aSize, TLeave, TUint aExtraSize)
 Allocates the object from the heap and then initialises its contents to binary zeroes.
 

Static Public Member Functions

static IMPORT_C CBufFlat * NewL (TInt anExpandSize)
 Allocates and constructs a flat buffer.
 
- Static Public Member Functions inherited from CBase
static IMPORT_C void Delete (CBase *aPtr)
 Deletes the specified object.
 

Protected Member Functions

IMPORT_C CBufFlat (TInt anExpandSize)
 / : CBufBase(anExpandSize) {
 
- Protected Member Functions inherited from CBufBase
IMPORT_C CBufBase (TInt anExpandSize)
 Constructor.
 
- Protected Member Functions inherited from CBase
virtual IMPORT_C TInt Extension_ (TUint aExtensionId, TAny *&a0, TAny *a1)
 Extension function.
 

Additional Inherited Members

- Protected Attributes inherited from CBufBase
TInt iSize
 
TInt iExpandSize
 

Detailed Description

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.

API status
Published to all clients. Released API.

Definition at line 203 of file e32base.h.

Constructor & Destructor Documentation

◆ ~CBufFlat()

IMPORT_C CBufFlat::~CBufFlat ( )

Destructor.

Frees all resources owned by the object, prior to its destruction. Specifically, it frees the allocated cell used as a buffer.

(generated from Symbian Developer Library)

◆ CBufFlat()

IMPORT_C CBufFlat::CBufFlat ( TInt  anExpandSize)
protected

/ : CBufBase(anExpandSize) {

iMaxSize=0; iPtr=NULL; }

EXPORT_C CBufFlat::~CBufFlat() /** Destructor.

Frees all resources owned by the object, prior to its destruction. Specifically, it frees the allocated cell used as a buffer.

API status

(generated from Original Symbian implementation)

API status
Internal component API.

Member Function Documentation

◆ BackPtr()

IMPORT_C TPtr8 CBufFlat::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.

Parameters
aPosBuffer position: must be in range zero to Size().
Returns
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.
See also
CBufFlat::BackPtr
CBufSeg::BackPtr

Implements CBufBase.

◆ Capacity()

TInt CBufFlat::Capacity ( ) const
inline

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

(generated from Symbian Developer Library)

◆ Compress()

IMPORT_C void CBufFlat::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.

See also
CBufFlat::Compress
CBufSeg::Compress

Implements CBufBase.

◆ Delete()

IMPORT_C void CBufFlat::Delete ( TInt  aPos,
TInt  aLength 
)
virtual

Deletes data from the buffer.

Derived classes provide the implementation.

Parameters
aPosBuffer position where the deletion will begin; must be in the range zero to (Size() minus the length of the data to be deleted).
aLengthThe number of bytes to be deleted; must be non-negative.
See also
CBufFlat::Delete
CBufSeg::Delete

Implements CBufBase.

◆ NewL()

static IMPORT_C CBufFlat * CBufFlat::NewL ( TInt  anExpandSize)
static

Allocates and constructs a flat buffer.

If there is insufficient memory available to allocate the flat buffer, the function leaves.

Parameters
anExpandSizeThe granularity of buffer expansion. Additional space, when required, is always allocated in multiples of this number. Note: although a value of zero is permitted by this interface, it has no meaning, and risks raising panics later during execution. We suggest that you pass a positive value.

Panic condition: E32USER-CBase 3 if the granularity is negative.

(generated from Symbian Developer Library)

◆ Ptr()

IMPORT_C TPtr8 CBufFlat::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.

Parameters
aPosBuffer position: must be in range zero to Size().
Returns
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().
See also
CBufFlat::Ptr
CBufSeg::Ptr

Implements CBufBase.

◆ SetReserveL()

IMPORT_C void CBufFlat::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.

Parameters
aSizeThe size of the buffer required. If there is no data in the buffer, i.e. Size() returns zero, then this value can be zero, which causes the buffer's allocated heap cell to be deleted.

Panic condition: E32USER-CBase 10, if aSize is negative.

Panic condition: E32USER-CBase 11, if there is data in the buffer, and aSize is less than the value returned by Size().

(generated from Symbian Developer Library)


The documentation for this class was generated from the following files: