Location:
e32base.h
class CArrayVar< TAny > : public CArrayVarBase;
A template specialisation base class for variable length arrays.
The array buffer organisation is defined at construction.
The class is useful for constructing an array of variable length buffers, where the length is decided at run time.
This class is also useful as a data member of a base class in a thin template class/base class pair, where the type of the array element is not known until the owning thin template class is instantiated.
CBase
- Base class for all classes to be instantiated on the heap
CArrayVarBase
- An implementation base class for variable length arrays
CArrayVar< TAny >
- A template specialisation base class for variable length arrays
Defined in CArrayVar< TAny >
:
AppendL()
, At()
, At()
, CArrayVar()
, ExtendL()
Inherited from CArrayVarBase
:
Compress()
,
Count()
,
Delete()
,
Length()
,
Reset()
,
Sort()
Inherited from CBase
:
Extension_()
,
operator new()
inline CArrayVar(TBufRep aRep, TInt aGranularity);
Constructs a variable array with the specified granularity and buffer organization.
Note that no memory is allocated to the array buffer by this constructor.
|
|
|
inline const TAny *At(TInt anIndex) const;
Returns a pointer to the untyped element located at the specified position within the array.
The compiler uses this variant of the function if the returned pointer is used in an expression where it cannot be modified.
|
|
|
inline TAny *At(TInt anIndex);
Returns a pointer to the untyped element located at the specified position within the array.
The compiler uses this variant of the function if the returned pointer is used in an expression where it can be modified.
|
|
|
inline void AppendL(const TAny *aPtr, TInt aLength);
Appends an untyped element of specified length onto the end of the array.
|
inline TAny *ExtendL(TInt aLength);
Extends the array by one element of specified length at the end of the array, i.e. at position CArrayVarBase::Count()
, and returns a pointer to the new element location.
As elements are untyped, no construction is possible and the content of the new location remains undefined.
Note that the function always attempts to allocate a cell to contain the new element and may also attempt to expand the array buffer. If there is insufficient memory available, the function leaves. 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.
|
|