CDesC8Array Class Reference

#include <badesca.h>

Link against: bafl.lib

class CDesC8Array : public CArrayFixBase, public MDesC8Array

Inherits from

Public Member Functions
~CDesC8Array()
IMPORT_C voidAppendL(const TDesC8 &)
IMPORT_C voidDelete(TInt)
IMPORT_C voidDelete(TInt, TInt)
IMPORT_C TIntFind(const TDesC8 &, TInt &, TKeyCmpText)
IMPORT_C TIntFindIsq(const TDesC8 &, TInt &, TKeyCmpText)
IMPORT_C TIntInsertIsqAllowDuplicatesL(const TDesC8 &, TKeyCmpText)
IMPORT_C TIntInsertIsqL(const TDesC8 &, TKeyCmpText)
IMPORT_C voidInsertL(TInt, const TDesC8 &)
virtual IMPORT_C TIntMdcaCount()
virtual IMPORT_C TPtrC8MdcaPoint(TInt)
IMPORT_C voidReset()
IMPORT_C voidSort(TKeyCmpText)
TPtrC8 operator[](TInt)
Protected Member Functions
CDesC8Array(TBufRep, TInt)
Inherited Functions
CArrayFixBase::At(TInt)const
CArrayFixBase::AtR(const CBase *,TInt)
CArrayFixBase::Back(TInt)const
CArrayFixBase::CArrayFixBase(TBufRep,TInt,TInt)
CArrayFixBase::Compress()
CArrayFixBase::Count()const
CArrayFixBase::CountR(const CBase *)
CArrayFixBase::End(TInt)const
CArrayFixBase::ExpandL(TInt)
CArrayFixBase::Find(const TAny *,TKeyArrayFix &,TInt &)const
CArrayFixBase::FindIsq(const TAny *,TKeyArrayFix &,TInt &)const
CArrayFixBase::InsertIsqAllowDuplicatesL(const TAny *,TKeyArrayFix &)
CArrayFixBase::InsertIsqL(const TAny *,TKeyArrayFix &)
CArrayFixBase::InsertL(TInt,const TAny *)
CArrayFixBase::InsertL(TInt,const TAny *,TInt)
CArrayFixBase::InsertRepL(TInt,const TAny *,TInt)
CArrayFixBase::Length()const
CArrayFixBase::ResizeL(TInt,const TAny *)
CArrayFixBase::SetKey(TKeyArrayFix &)const
CArrayFixBase::SetReserveFlatL(TInt)
CArrayFixBase::Sort(TKeyArrayFix &)
CArrayFixBase::~CArrayFixBase()
CBase::CBase()
CBase::Delete(CBase *)
CBase::Extension_(TUint,TAny *&,TAny *)
CBase::operator new(TUint)
CBase::operator new(TUint,TAny *)
CBase::operator new(TUint,TLeave)
CBase::operator new(TUint,TLeave,TUint)
CBase::operator new(TUint,TUint)
CBase::~CBase()
MDesC8Array::~MDesC8Array()

Detailed Description

An implementation base class for 8 bit descriptor arrays.

It provides some of the behaviour for 8 bit descriptor arrays. The class is abstract and cannot be instantiated.

Constructor & Destructor Documentation

CDesC8Array ( TBufRep, TInt )

IMPORT_CCDesC8Array(TBufRepaRep,
TIntaGranularity
)[protected]

~CDesC8Array ( )

IMPORT_C~CDesC8Array()

Frees all resources owned by the object, prior to its destruction. In particular, it deletes all descriptors from the array and frees the memory allocated to the array buffer.

Member Function Documentation

AppendL ( const TDesC8 & )

IMPORT_C voidAppendL(const TDesC8 &aPtr)

Appends a descriptor onto the end of any existing descriptor elements in the array.

Parameters
aPtrA reference to the descriptor to be appended to the array.
Leave Codes
KErrNoMemoryThere is insufficient memory available. If the function leaves, the array is left in the state it was in before the call.

Delete ( TInt )

IMPORT_C voidDelete(TIntaPos)

Reimplemented from CArrayFixBase::Delete(TInt)

Delete ( TInt, TInt )

IMPORT_C voidDelete(TIntaIndex,
TIntaCount
)

Deletes one or more logically contiguous descriptor elements from the array.

The deletion starts at the specified position.Deleting descriptor elements from the array frees the memory occupied by the associated heap descriptors and removes their pointers from the array buffer but does not cause the array buffer to be automatically compressed. Call the Compress() function to return excess space in the array buffer to the heap.

Find ( const TDesC8 &, TInt &, TKeyCmpText )

IMPORT_C TIntFind(const TDesC8 &aPtr,
TInt &aPos,
TKeyCmpTextaTextComparisonType = ECmpFolded
)const

Finds the position of a descriptor element within the array which matches the specified descriptor using a sequential search.

The array is searched sequentially for a matching descriptor element, starting with the first descriptor element in the array. Descriptors are compared using one of the TDesC comparison functions. The enumeration aTextComparisonType governs how the descriptors are to be compared.

Where an array has duplicate descriptor elements, the function only supplies the position of the first descriptor element.

Parameters
aPtrA reference to a descriptor to be used for comparison.
aPosIf the descriptor element is found, this reference is set to the position of that descriptor element within the array. The position is relative to zero, (i.e. the first descriptor element in the array is at position 0). If the descriptor element is not found and the array is not empty, then the value of the reference is set to the number of descriptor elements in the array. If the descriptor element is not found and the array is empty, then the reference is set to zero.
aTextComparisonTypeAn enumeration which determines the type of comparison to be made between descriptors. If no parameter is explicitly passed, ECmpFolded is used by default.
Return Value
Zero, if a matching descriptor element is found. Non-zero, if no matching descriptor element can be found.

FindIsq ( const TDesC8 &, TInt &, TKeyCmpText )

IMPORT_C TIntFindIsq(const TDesC8 &aPtr,
TInt &aPos,
TKeyCmpTextaTextComparisonType = ECmpFolded
)const

Finds the position of a descriptor element within the array which matches the specified descriptor using a binary search technique. The array must be in sequence, otherwise the outcome is unpredictable.

Descriptors are compared using one of the TDesC comparison functions. The enumeration aTextComparisonType governs how the descriptors are to be compared.

Where an array has duplicate descriptor elements, the function cannot guarantee which matching descriptor element it will return; except that it will find one of them.

Parameters
aPtrA reference to a descriptor to be used for comparison.
aPosIf the descriptor element is found, the reference is set to the position of that descriptor element within the array. The position is relative to zero, (i.e. the first descriptor element in the array is at position 0). If the descriptor element is not found and the array is not empty, then the reference is set to the position of the first descriptor element in the array whose content is greater than the content of aPtr. If the descriptor element is not found and the array is empty, then the reference is set to zero.
aTextComparisonTypeAn enumeration which determines the type of comparison to be made between descriptors. If no parameter is explicitly passed, ECmpFolded is used by default.
Return Value
Zero, if a matching descriptor element is found. Non-zero, if no matching descriptor element can be found.

InsertIsqAllowDuplicatesL ( const TDesC8 &, TKeyCmpText )

IMPORT_C TIntInsertIsqAllowDuplicatesL(const TDesC8 &aPtr,
TKeyCmpTextaTextComparisonType = ECmpFolded
)

Inserts a descriptor into the array at a position which maintains the sequence of the descriptors - allows duplicates.

The sequence is determined by comparing descriptors using one of the TDesC comparison functions. The enumeration aTextComparisonType governs how the descriptors are to be compared.

The array should already be in sequence, otherwise the position of the new descriptor element is unpredictable. Descriptor elements which are the same are permitted; if the descriptor aPtr is a duplicate of an existing descriptor within the array, then the new descriptor element is positioned after the existing descriptor element.

Parameters
aPtrA reference to the descriptor to be inserted into the array.
aTextComparisonTypeAn enumeration which determines the type of comparison to be made between descriptors for the purpose of choosing the insertion position. If no parameter is explicitly passed, ECmpFolded is used by default.
Return Value
The position within the array of the inserted descriptor.
Leave Codes
KErrNoMemoryThere is insufficient memory available. If the function leaves, the array is left in the state it was in before the call.

InsertIsqL ( const TDesC8 &, TKeyCmpText )

IMPORT_C TIntInsertIsqL(const TDesC8 &aPtr,
TKeyCmpTextaTextComparisonType = ECmpFolded
)

Inserts a descriptor into the array at a position which maintains the sequence of the descriptors.

The sequence is determined by comparing descriptors using one of the TDesC comparison functions. The enumeration aTextComparisonType governs how the descriptors are to be compared.

The array should already be in sequence, otherwise the position of the new descriptor element is unpredictable. Descriptor elements which are the same are not permitted.

Parameters
aPtrA reference to the descriptor to be inserted into the array.
aTextComparisonTypeAn enumeration which determines the type of comparison to be made between descriptors for the purpose of choosing the insertion position. If no parameter is explicitly passed, ECmpFolded is used by default.
Return Value
The position within the array of the inserted descriptor.
Leave Codes
KErrAlreadyExistsA descriptor with the same data (i.e. the same length and the same content) already exists within the array.
KErrNoMemoryThere is insufficient memory available. If the function leaves, the array is left in the state it was in before the call.

InsertL ( TInt, const TDesC8 & )

IMPORT_C voidInsertL(TIntaPos,
const TDesC8 &aPtr
)

Inserts a descriptor into the array at the specified position.

If the specified position is the same as the current number of descriptor elements in the array, this has the effect of appending the element.

Parameters
aPosThe position within the array where the descriptor element is to be inserted. The position is relative to zero, i.e. zero implies the first descriptor element. This value must not be negative and must not be greater than the number of descriptor elements currently in the array, otherwise the function rasises an E32USER-CBase 21 panic.
aPtrThe descriptor to be inserted into the array.
Leave Codes
KErrNoMemoryThere is insufficient memory available. If the function leaves, the array is left in the state it was in before the call.

MdcaCount ( )

IMPORT_C TIntMdcaCount()const [virtual]

Returns the number of descriptor elements in the array. The function implements the interface MDesC8Array::MdcaCount().

Return Value
The number of descriptor elements.

MdcaPoint ( TInt )

IMPORT_C TPtrC8MdcaPoint(TIntaIndex)const [virtual]

Indexes into a descriptor array. The function implements the interface MDesC8Array::MdcaPoint().

Parameters
aIndexThe position of the descriptor element within the array. The position is relative to zero; i.e. zero implies the first descriptor element in the array. This value must be non-negative and less than the number of descriptors currently within the array otherwise the operator panics with EArrayIndexOutOfRange.
Return Value
A non-modifiable pointer descriptor representing the descriptor element located at position aIndex within the array.

Reset ( )

IMPORT_C voidReset()

Reimplemented from CArrayFixBase::Reset()

Deletes all descriptors from the array and frees the memory allocated to the array buffer.

See also: CDesC8Array::Delete()

Sort ( TKeyCmpText )

IMPORT_C voidSort(TKeyCmpTextaTextComparisonType = ECmpFolded)

Sorts the descriptor elements into sequence.

The sequence is determined by comparing descriptors using one of the member functions of the descriptor base class TDesC.

Parameters
aTextComparisonTypeAn enumeration which defines the type of comparison to be made between descriptors. By default the comparison type is ECmpFolded.

operator[] ( TInt )

TPtrC8 operator[](TIntaIndex)const [inline]