Symbian Developer Library

SYMBIAN OS V6.1 EDITION FOR C++

[Index] [Glossary] [Previous] [Next]



Location: e32base.h
Link against: euser.lib

Class CArrayFix<TAny>

CArrayFix<TAny>

Support

Supported from 5.0

Description

A template specialisation base class for arrays of fixed length untyped objects. The public functions provide standard array behaviour.

The class is always derived from and is never instantiated explicitly.

Derivation

CArrayFix<TAny>A template specialisation base class for arrays of fixed length untyped objects
CArrayFixBaseBase class for arrays of fixed length objects
CBaseBase class for all classes to be instantiated on the heap

Defined in CArrayFix:
AppendL(), AppendL()Append, At(), Back(), End(), ExtendL()

Inherited from CArrayFixBase:
Compress(), Count(), Delete(), Length(), Reset(), Sort()

Inherited from CBase:
operator new()


Appending elements


AppendL()

void AppendL(const TAny* aPtr);

Description

Appends the specified untyped element onto the end of the array.

Parameters

const TAny* aPtr

A pointer to an untyped element to be appended.

Leave codes

 

The function may 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.


AppendL()Append

void AppendL(const TAny* aPtr,TInt aCount);

Description

Appends one or more untyped elements onto the end of the array.

Parameters

const TAny* aPtr

A pointer to the first of the contiguous untyped elements to be appended.

TInt aCount

The number of contiguous elements located at aPtr to be appended. The value must not be negative otherwise the function raises an E32USER-CBase 23 panic.

Leave codes

 

The function may 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.

[Top]


Expanding the array


ExtendL()

TAny* ExtendL();

Description

Expands the array by the length of one element 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.

Return value

TAny*

A pointer to the new element location at the end of the array.

Leave codes

 

The function may 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.

[Top]


Indexing into the array


At()

const TAny* At(TInt anIndex) const;
TAny* At(TInt anIndex);

Description

Returns a pointer to the untyped element located at the specified position within the array.

Two versions of the function are supplied. The compiler chooses the appropriate version based on the use made of the returned reference. If the returned reference is used in an expression where that reference can be modified, then the non-const version is chosen.

Parameters

TInt anIndex

The position of the element within the array. The position is relative to zero; i.e. zero implies the first element in the array. This value must be non-negative and less than the number of objects currently within the array otherwise the functions raise an E32User-CBase 21 panic.

Return value

TAny*

A non-const pointer to the untyped element located at position anIndex within the array.

const TAny*

A const pointer to the untyped element located at position anIndex within the array.


End()

const T* End(TInt anIndex) const;
T* End(TInt anIndex);

Description

Returns a pointer to the first byte following the end of the contiguous region containing the element at the specfied position within the array.

For flat buffers, the pointer always points to the first byte following the end of the buffer.

For segmented buffers, the pointer always points to the first byte following the end of the segment which contains the element.

Parameters

TInt anIndex

The position of the element within the array. The position is relative to zero; i.e. zero implies the first element in the array. This value must be non-negative and less than the number of objects currently within the array otherwise the operators raise an E32USER-CBase 21 panic.

Return value

T*

A non-const pointer to the byte following the end of the contiguous region.

const T*

A const pointer to the byte following the end of the contiguous region.


Back()

const T* Back(TInt anIndex) const;
T* Back(TInt anIndex);

Description

Returns a pointer to the beginning of a contiguous region.

For flat buffers, the function always returns a pointer to the beginning of the buffer.

For segmented buffers, the function returns a pointer to the beginning of the segment for all elements in that segment except the first. If the element at the specified position is the first in a segment, then the function returns a pointer the beginning of the previous segment.

For the first element in the array, the function returns a NULL pointer.

Parameters

TInt anIndex

The position of the element within the array. The position is relative to zero; i.e. zero implies the first element in the array. This value must be non-negative and less than the number of objects currently within the array otherwise the operators raise an E32User-CBase 21 panic.

Return value

T*

A non-const pointer to the beginning of the contiguous region.

const T*

A const pointer to the beginning ofd the contiguous region.