Original Symbian headers
Selected EUSER, Window Server, networking, graphics and device declarations
Loading...
Searching...
No Matches
TArray< T > Class Template Reference

Generic array. More...

#include <e32cmn.h>

Public Member Functions

 TArray (TInt(*aCount)(const CBase *aPtr), const TAny *(*anAt)(const CBase *aPtr, TInt anIndex), const CBase *aPtr)
 Constructor.
 
TInt Count () const
 Gets the number of elements currently held in the array for which this generic array has been constructed.
 
const T & operator[] (TInt anIndex) const
 Gets a reference to the element located at the specified position.
 

Detailed Description

template<class T>
class TArray< T >

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.

See also
CArrayFixFlat
CArrayFixSeg
CArrayVarFlat
CArrayVarSeg
CArrayPakFlat
RArray
RPointerArray
RArray<TInt>
RArray<TUint>
API status
Published to all clients. Released API.

Definition at line 5357 of file e32cmn.h.

Constructor & Destructor Documentation

◆ TArray()

template<class T >
TArray< T >::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
aCountA 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.
anAtA 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.
aPtrA pointer to the array for which this TArray is being constructed. This argument is supplied by the Array() member function of the array class.

(generated from Symbian Developer Library)

Member Function Documentation

◆ Count()

template<class T >
TInt TArray< T >::Count ( ) const
inline

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

(generated from Symbian Developer Library)

◆ operator[]()

template<class T >
const T & TArray< 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.

Parameters
anIndexThe 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.

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

(generated from Symbian Developer Library)


The documentation for this class was generated from the following files: