TArray Class Reference

class TArray

Generic array.

This class defines a generic array which can be constructed by any of the following templated concrete arrays:

1. CArrayFixFlat<class T>

2. CArrayFixSeg<class T>

3. CArrayVarFlat<class T>

4. CArrayVarSeg<class T>

5. CArrayPakFlat<class T>

6. RArray<class T>

7. RPointerArray<class T>

and also by the following template specialisation classes:

1. RArray<TInt>

2. RArray<TUint>

It allows a degree of polymorphism amongst the array classes. It permits the operator[] and the Count() member functions of an array to be invoked without knowing which array class has been used to construct that array.

TArray allows access to elements of an array but does not permit changes to those elements.

Use the Array() member function of an array to construct and return a TArray<class T> object for that array.

A TArray<class T> type object is not intended to be constructed explicitly by user code.

CArrayFixFlat CArrayFixSeg CArrayVarFlat CArrayVarSeg CArrayPakFlat RArray RPointerArray RArray<TInt> RArray<TUint>

Public Member Functions
TArray ( TInt (*)(const CBase *aPtr), const TAny *(*)(const CBase *aPtr, TInt anIndex), const CBase *)
TInt Count ()
const T & operator[] ( TInt )
Private Attributes
const TAny *(* iAt
TInt (* iCount
const CBase * iPtr

Constructor & Destructor Documentation

TArray(TInt(*)(const CBase *aPtr), const TAny *(*)(const CBase *aPtr, TInt anIndex), const CBase *)

TArray ( TInt (*)(const CBase *aPtr) aCount,
const TAny *(*)(const CBase *aPtr, TInt anIndex) anAt,
const CBase * aPtr
) [inline]

Constructor.

A TArray object is not intended to be instantiated explicitly. An object of this type is instantiated as a result of a call to to the Array() member function of a concrete array class

CArrayFixFlat::Array CArrayFixSeg::Array CArrayVarFlat::Array CArrayVarSeg::Array CArrayPakFlat::Array RArray::Array RPointerArray::Array RArray<TInt>::Array RArray<TUint>::Array

Parameters

TInt (*)(const CBase *aPtr) aCount A pointer to a function which takes a const CBase* argument and returns a TInt aCount must point to the member function which returns the current number of elements of type class T contained in the array at aPtr, for which this TArray is being constructed. This argument is supplied by the Array() member function of the array class.
const TAny *(*)(const CBase *aPtr, TInt anIndex) anAt A pointer to a function which takes a const CBase* and a TInt argument, and returns a pointer to TAny anAt must point to the member function which returns a reference to the element located at position anIndex within the array at aPtr, for which this TArray is being constructed. This argument is supplied by the Array() member function of the array class.
const CBase * aPtr A pointer to the array for which this TArray is being constructed. This argument is supplied by the Array() member function of the array class.

Member Functions Documentation

Count()

TInt Count ( ) const [inline]

Gets the number of elements currently held in the array for which this generic array has been constructed.

operator[](TInt)

const T & operator[] ( TInt anIndex ) const [inline]

Gets a reference to the element located at the specified position.

The returned reference is const and cannot be used to change the element. Any member function of the referenced template class T must be declared as const if that function is to be accessed through this operator.

panic
E32USER-CBase 21, if anIndex is negative, or greater than or equal to the number of objects currently within the array.

Parameters

TInt anIndex The position of the element within the array for which this TArray has been constructed. The position is relative to zero; i.e. zero implies the first element in the array.

Member Data Documentation

const TAny *(* iAt

const TAny *(* iAt [private]

TInt(* iCount

TInt (* iCount [private]

const CBase * iPtr

const CBase * iPtr [private]