class CArrayPak< TAny > : public CArrayPakBase;
Description
A template specialisation base class for variable length, packed, 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.
Derivation
CBase
-
Base class for all classes to be instantiated on the heap.
CArrayPakBase
-
An implementation base class for all variable length, packed arrays.
CArrayPak< TAny >
- A template specialisation base class for variable length, packed, arrays.
Members
Defined in CArrayPak< TAny >
:
AppendL(const TAny *,TInt)
Appends the untyped element of the specified length onto the end of the array.
At(TInt)
Gets a pointer to the untyped element located at the specified position within t...
At(TInt)const
Gets a pointer to the untyped element located at the specified position within t...
CArrayPak(TBufRep,TInt)
Constructs a variable array with the specified granularity and buffer organisati...
ExtendL(TInt)
Expands the array by one element of the specified length at the end of the array...
Inherited from CArrayPakBase
:
Compress()
Removes excess space from the array buffer.
Count()const
Gets the number of elements held in the array.
Delete(TInt)
Removes a single element from the array.
Delete(TInt,TInt)
Removes one or more contiguous elements from the array, starting at a specific p...
Length(TInt)const
Gets the length of the specified element.
Reset()
Deletes all elements from the array and frees the memory allocated to the array ...
SortL(TKeyArrayVar &)
Sorts the elements of the array into key sequence.
Inherited from CBase
:
Member functions
inline CArrayPak(TBufRep aRep, TInt aGranularity);
Description
Constructs a variable array with the specified granularity and buffer organisation.
Note that no memory is allocated to the array buffer by this constructor.
Parameters
TBufRep aRep |
A pointer to a function used to expand the array buffer. The organisation of the array buffer is implied by the choice of
this function. For a flat array buffer, pass (TBufRep)CBufFlat::NewL(TInt) . For a segmented array buffer, pass (TBufRep)CBufSeg::NewL(TInt) .
|
TInt aGranularity |
The granularity of the array.
|
|
Return value
Panic codes
E32USER-CBase |
19, if aGranularity is not positive.
|
|
inline const TAny* At(TInt anIndex) const;
Description
Gets 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 reference is used in an expression where that reference cannot
be modified.
Parameters
TInt anIndex |
The position of the element within the array, relative to zero; i.e. zero implies the first element.
|
|
Return value
const TAny * |
A pointer to the const element located at position anIndex within the array.
|
|
Panic codes
E32USER-CBase |
21, if anIndex is negative or greater than or equal to the number of objects currently within the array.
|
|
inline TAny* At(TInt anIndex);
Description
Gets 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 reference is used in an expression where that reference can
be modified.
Parameters
TInt anIndex |
The position of the element within the array, relative to zero; i.e. zero implies the first element.
|
|
Return value
TAny * |
A pointer to the non-const element located at position anIndex within the array.
|
|
Panic codes
E32USER-CBase |
21, if anIndex is negative or greater than or equal to the number of objects currently within the array.
|
|
AppendL(const TAny *,TInt)
inline void AppendL(const TAny *aPtr, TInt aLength);
Description
Appends the untyped element of the specified length onto the end of the array.
Parameters
const TAny *aPtr |
A pointer to an untyped element to be appended.
|
TInt aLength |
The length of the untyped element.
|
|
Leave codes
KErrNoMemory |
The function attempted to expand the array buffer and there is insufficient memory available. In this case, the array is left
in the state it was in before the call.
|
|
inline TAny* ExtendL(TInt aLength);
Description
Expands the array by one element of the specified length at the end of the array, and returns a pointer to this new location.
As elements are untyped, no construction is possible and the content of the new location remains undefined.
Parameters
TInt aLength |
The length of the new element.
|
|
Return value
TAny * |
A pointer to the new element location at the end of the array.
|
|
Leave codes
KErrNoMemory |
The function attempted to expand the array buffer and there is insufficient memory available. In this case, the array is left
in the state it was in before the call.
|
|