Symbian Developer Library

SYMBIAN OS V6.1 EDITION FOR C++

[Index] [Glossary] [Previous] [Next]



Location: e32base.h
Link against: euser.lib

Class CArrayPakBase

CArrayPakBase

Support

Supported from 5.0

Description

An implementation base class for variable length, packed, arrays. It provides implementation and public functions which are common to all variable length, packed, type arrays.

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

Derivation

CArrayPakBaseAn implementation base class for variable length, packed, arrays
CBaseBase class for all classes to be instantiated on the heap

Defined in CArrayPakBase:
Compress(), Count(), Delete(), Length(), Reset(), SortL(), ~CArrayPakBase()

Inherited from CBase:
operator new()


Destruction


~CArrayPakBase()

~CArrayPakBase();

Description

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

[Top]


Basic information


Count()

TInt Count() const;

Description

Returns the number of elements held in the array.

Return value

TInt

The number of array elements


Length()

TInt Length(TInt anIndex) const;

Description

Returns the length of a specific element.

Parameters

TInt anIndex

The 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). This value must not be negative and must not be greater than the number of elements currently in the array, otherwise the function raises an E32USER-CBase 21 panic.

Return value

TInt

The length of the element at position anIndex

[Top]


Array housekeeping


Reset()

void Reset();

Description

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


Compress()

void Compress();

Description

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 contain the elements of the array.

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


SortL()

void SortL(TKeyArrayVar &aKey);

Description

Sorts the elements of the array into key sequence.

Notes

The function requires a TKeyArrayVar key object because SortL() creates a temporary CArrayVarFlat array in its implementation and uses that array’s Sort() member function.

Parameters

TKeyArrayVar& aKey

The key object defining the properties of the key.

Leave codes

 

Unless the array has no elements, memory is always allocated from the heap to implement this function. If there is insufficient memory, then it may leave. The leave code is one of the system wide error codes. If the function leaves, the array is left in the state it was in before the call.

[Top]


Delete elements


Delete()

void Delete(TInt anIndex);
void Delete(TInt anIndex,TInt aCount);

Description

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

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

Notes

The sum of anIndex and aCount must not be greater than the number of elements currently in the array, otherwise the function raises an E32USER-CBase 29 panic.

Parameters

TInt anIndex

The 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. This value must not be negative and must not be greater than the number of elements currently in the array, otherwise the function raises an E32USER-CBase 21 panic.

TInt aCount

If specified, the number of elements to be deleted from the array. If this argument is not specified, a value of one is assumed. If specified, the value must not be negative otherwise the function raises an E32USER-CBase 26 panic.