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

Provides a segmented dynamic buffer. More...

#include <e32base.h>

Inheritance diagram for CBufSeg:
CBufBase CBase

Public Member Functions

IMPORT_C ~CBufSeg ()
 Destructor.
 
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 CBufSeg * NewL (TInt anExpandSize)
 Allocates and constructs a segmented buffer.
 
- Static Public Member Functions inherited from CBase
static IMPORT_C void Delete (CBase *aPtr)
 Deletes the specified object.
 

Protected Member Functions

IMPORT_C CBufSeg (TInt anExpandSize)
 
void InsertIntoSegment (TBufSegLink *aSeg, TInt anOffset, const TAny *aPtr, TInt aLength)
 
void DeleteFromSegment (TBufSegLink *aSeg, TInt anOffset, TInt aLength)
 
void FreeSegment (TBufSegLink *aSeg)
 
void SetSBO (TInt aPos)
 
void AllocSegL (TBufSegLink *aSeg, TInt aNumber)
 
- 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 segmented dynamic buffer.

This class should be used when the object has a long life-time and an unpredictable number of insertions, or there is concern about the performance of insertion and deletion operations into large buffers.

This class is an implementation of the abstract buffer interface provided by CBufBase and uses doubly-linked list of heap cells to contain the data; each cell containing a segment of the buffer.

Its (private) data members include an anchor for the doubly-linked list, and also a reference to the buffer position used by the last operation. This reference acts as a cache; if the next operation uses a similar buffer position, then calculation of the pointer corresponding to its buffer position is much faster.

API status
Published to all clients. Released API.

Definition at line 242 of file e32base.h.

Constructor & Destructor Documentation

◆ ~CBufSeg()

IMPORT_C CBufSeg::~CBufSeg ( )

Destructor.

Frees all resources owned by the object, prior to its destruction.

Specifically, it frees all segments allocated to the buffer.

(generated from Symbian Developer Library)

◆ CBufSeg()

IMPORT_C CBufSeg::CBufSeg ( TInt  anExpandSize)
protected

Member Function Documentation

◆ AllocSegL()

void CBufSeg::AllocSegL ( TBufSegLink *  aSeg,
TInt  aNumber 
)
protected

◆ BackPtr()

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

◆ Compress()

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

◆ DeleteFromSegment()

void CBufSeg::DeleteFromSegment ( TBufSegLink *  aSeg,
TInt  anOffset,
TInt  aLength 
)
protected

◆ FreeSegment()

void CBufSeg::FreeSegment ( TBufSegLink *  aSeg)
protected

◆ InsertIntoSegment()

void CBufSeg::InsertIntoSegment ( TBufSegLink *  aSeg,
TInt  anOffset,
const TAny *  aPtr,
TInt  aLength 
)
protected

◆ NewL()

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

Allocates and constructs a segmented buffer.

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

Parameters
anExpandSizeThe granularity of the buffer. Each segment contains (in addition to 16 bytes of overhead) this number of bytes for data. 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 CBufSeg::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.

◆ SetSBO()

void CBufSeg::SetSBO ( TInt  aPos)
protected

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