CArrayVarBase Class Reference

class CArrayVarBase : public CBase

An implementation base class for variable length arrays.

It provides implementation and public functions which are common to all variable length type arrays.

The class is always derived from and is never instantiated explicitly.

Inherits from

Constructor & Destructor Documentation

CArrayVarBase(TBufRep, TInt)

IMPORT_CCArrayVarBase(TBufRepaRep,
TIntaGranularity
)[protected]

Parameters

TBufRep aRep
TInt aGranularity

~CArrayVarBase()

IMPORT_C~CArrayVarBase()

Destructor.

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

Member Functions Documentation

At(TInt)

IMPORT_C TAny *At(TIntanIndex)const

Parameters

TInt anIndex

AtR(const CBase *, TInt)

IMPORT_C const TAny *AtR(const CBase *aPtr,
TIntanIndex
)[protected, static]

Parameters

const CBase * aPtr
TInt anIndex

Compress()

IMPORT_C voidCompress()

Removes excess space from the array buffer.

The effect is to reduce the memory allocated to the array buffer so that it is just sufficient to represent the array. This applies to both flat and segmented array buffers.

If the array is empty, then the memory allocated to the array buffer is freed.

Count()

TInt Count()const [inline]

Gets the number of elements held in the array.

CountR(const CBase *)

IMPORT_C TIntCountR(const CBase *aPtr)[protected, static]

Parameters

const CBase * aPtr

Delete(TInt)

IMPORT_C voidDelete(TIntanIndex)

Removes one element from the array.

Deleting elements from the array does not cause the array buffer to be automatically compressed. Call CArrayVarBase::Compress() to return excess space to the heap.

panic
E32USER-CBase 21, if anIndex is negative or greater than the number of elements currently in the array.

Parameters

TInt anIndexThe position within the array of the element to delete. The position is relative to zero.

Delete(TInt, TInt)

IMPORT_C voidDelete(TIntanIndex,
TIntaCount
)

Removes one or more contiguous elements from the array, starting at the specified position.

Deleting elements from the array does not cause the array buffer to be automatically compressed. Call CArrayVarBase::Compress() to return excess space to the heap.

panic
E32USER-CBase 21, if anIndex is negative or greater than or equal to the number of elements currently in the array.
panic
E32USER-CBase 25, if aCount is negative.
panic
E32USER-CBase 29, if the sum of anIndexPos and aCount is greater than the number of elements currently in the array.

Parameters

TInt anIndexThe position within the array from where deletion of elements is to start. The position is relative to zero, i.e. zero implies that elements, starting with the first, are deleted from the array.
TInt aCountThe number of elements to be deleted from the array.

ExpandL(TInt, TInt)

IMPORT_C TAny *ExpandL(TIntanIndex,
TIntaLength
)

Parameters

TInt anIndex
TInt aLength

Find(const TAny *, TKeyArrayVar &, TInt &)

IMPORT_C TIntFind(const TAny *aPtr,
TKeyArrayVar &aKey,
TInt &anIndex
)const

Parameters

const TAny * aPtr
TKeyArrayVar & aKey
TInt & anIndex

FindIsq(const TAny *, TKeyArrayVar &, TInt &)

IMPORT_C TIntFindIsq(const TAny *aPtr,
TKeyArrayVar &aKey,
TInt &anIndex
)const

Parameters

const TAny * aPtr
TKeyArrayVar & aKey
TInt & anIndex

InsertIsqAllowDuplicatesL(const TAny *, TInt, TKeyArrayVar &)

IMPORT_C TIntInsertIsqAllowDuplicatesL(const TAny *aPtr,
TIntaLength,
TKeyArrayVar &aKey
)

Parameters

const TAny * aPtr
TInt aLength
TKeyArrayVar & aKey

InsertIsqL(const TAny *, TInt, TKeyArrayVar &)

IMPORT_C TIntInsertIsqL(const TAny *aPtr,
TIntaLength,
TKeyArrayVar &aKey
)

Parameters

const TAny * aPtr
TInt aLength
TKeyArrayVar & aKey

InsertL(TInt, const TAny *, TInt)

IMPORT_C voidInsertL(TIntanIndex,
const TAny *aPtr,
TIntaLength
)

Parameters

TInt anIndex
const TAny * aPtr
TInt aLength

Length(TInt)

IMPORT_C TIntLength(TIntanIndex)const

Gets the length of a specific element.

panic
E32USER-CBase 21, if anIndex is negative or is greater than the number of elements currently in the array.

Parameters

TInt anIndexThe position of the element within the array. The position is relative to zero, (i.e. the first element in the array is at position 0).

Reset()

IMPORT_C voidReset()

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

As each element of a variable array is contained within its own heap cell, this function has the effect of freeing all such cells.

SetKey(TKeyArrayVar &)

IMPORT_C voidSetKey(TKeyArrayVar &aKey)const [protected]

Parameters

TKeyArrayVar & aKey

Sort(TKeyArrayVar &)

IMPORT_C TIntSort(TKeyArrayVar &aKey)

Sorts the elements of the array into key sequence.

Parameters

TKeyArrayVar & aKeyThe key object defining the properties of the key.

Member Data Documentation

CBufBase * iBase

CBufBase *iBase[private]

TInt iCount

TInt iCount[private]

TBufRep iCreateRep

TBufRep iCreateRep[private]

TInt iGranularity

TInt iGranularity[private]