#include <e32cmn.h>
class TArray |
Public Member Functions | |
---|---|
TArray(TInt(*)(const CBase *aPtr), const TAny *(*)(const CBase *aPtr, TInt anIndex), const CBase *) | |
TInt | Count() |
const T & | operator[](TInt) |
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>
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.
See also: CArrayFixFlat CArrayFixSeg CArrayVarFlat CArrayVarSeg CArrayPakFlat RArray RPointerArray RArray<TInt> RArray<TUint>
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
See also: CArrayFixFlat::Array CArrayFixSeg::Array CArrayVarFlat::Array CArrayVarSeg::Array CArrayPakFlat::Array RArray::Array RPointerArray::Array RArray<TInt>::Array RArray<TUint>::Array
Parameter | Description |
---|---|
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. |
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. |
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. |
TInt | Count | ( | ) | const [inline] |
Gets the number of elements currently held in the array for which this generic array has been constructed.
Returns: The number of array elements.
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.
Parameter | Description |
---|---|
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. |
Returns: A const reference to the element located at position anIndex within the array for which this TArray has been constructed.