EPOC   SDK Home Glossary Indexes Previous Next Up

CContactIdArray class


Contents


CContactIdArray class — Array of contact IDs

Section Contents


Overview

Compatibility

Applications that use this class will not work correctly on a version of EPOC earlier than ER5.

Derivation

CBase

Abstract: CBase behaviour.

Defined in

cntdef.h

Link against

cntmodel.lib

Description

This class represents an array of contact item IDs.

The contact ID array is used to specify a list of contact items. Objects of this class are used in several contact database functions, for instance CContactDatabase::DeleteContactsL().


Allocation and construction


NewL() — Allocate and construct

static CContactIdArray* NewL();

static CContactIdArray* NewLC();

Description

Use these functions to allocate and construct a new, empty contact ID array.

If the new array is successfully constructed, NewLC() leaves it on the cleanup stack.

Return value

CContactIdArray*

Pointer to the newly created contact ID array.


NewL() — Allocate and construct from a CContactIdArray

static CContactIdArray* NewL(const CContactIdArray* aArray);

static CContactIdArray* NewLC(const CContactIdArray* aArray);

Description

Creates a new contact ID array copying the contents from aArray.

If the new contact array is successfully constructed, NewLC() leaves it on the cleanup stack.

Arguments

const CContactIdArray* aArray

Contact ID array to copy.

Return value

CContactIdArray*

Pointer to the newly created contact ID array.


Stream persistence


InternalizeL() — Internalize

void InternalizeL(RReadStream& aStream);

Description

Use this function to internalize a CContactIdArray object from a read stream. The presence of this function means that the standard templated operator>>() (defined in s32strm.h) is available to internalize objects of this class.

Arguments

RReadStream& aStream

Stream from which the object should be internalized

Leave considerations

This function may leave if there is a problem reading from the stream, or if internalization causes an out of memory error.


ExternalizeL() — Externalize

void ExternalizeL(RWriteStream& aStream) const;

Description

Use this function to externalize a CContactIdArray object to a write stream. The presence of this function means that the standard templated operator<<() (defined in s32strm.h) is available to externalize objects of this class.

Arguments

RWriteStream& aStream

Stream to which the object should be externalized

Leave considerations

This function may leave, if the write action causes the stream’s resource to be exhausted.


Indexing into the array


operator[] — Index operator []

TContactItemId& operator[](TInt aIndex);

const TContactItemId& operator[](TInt aIndex) const;

Description

Use these operators to return the indexed TContactItemId.

The compiler chooses the appropriate operator variant depending on the context of the call.

Arguments

TInt aIndex

The position of the contact ID 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 operator raises a panic.

Return value

TContactItemId&

Reference to the contact ID located at position aIndex within the array.

const TContactItemId&

A reference to a const element of the array; the element cannot be changed through this reference.


Array manipulation


AddL() — Append a contact ID

void AddL(TContactItemId aId);

Description

Append a contact ID to the array.

Arguments

TContactItemId aId

The contact ID to append to the array.


Remove() — Remove a single contact ID

void Remove(TInt aIndex);

Description

Remove the indexed contact ID from the array.

Arguments

TInt aIndex

The index of the contact ID to remove.

Notes

The index value must not be negative and must not be greater than the number of elements currently in the array, otherwise the function raises a panic.


Remove() — Remove contact IDs

void Remove(TInt aIndex,TInt aCount);

Description

Remove a block of contact IDs from the array.

Arguments

TInt aIndex

The index of the first contact ID to remove.

TInt aCount

The number of contiguous contact IDs to delete from the array. If this is not specified, a value of one is assumed.

Notes

This function raises a panic if any of the following are true: —


InsertL() — Insert a contact ID by position

void InsertL(TInt aIndex,TContactItemId aId);

Description

Insert a contact ID into the array.

Arguments

TInt aIndex

The index at which to insert the contact ID.

TContactItemId aId

The contact ID to insert.

Leave considerations

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 error codes, see error codes.

If the function leaves, the array is left in the state it was in before the call.

Notes

The index must be valid or a panic occurs.


Find() — Find a contact ID

TInt Find(TContactItemId aId) const;

Description

Find the index of the specified contact ID within the array.

Arguments

TContactItemId aId

The contact ID to find.

Return value

TInt

If the contact ID is found, its index within the array. KErrNotFound if the ID is not found.


MoveL() — Move a contact ID

void MoveL(TInt aOldIndex,TInt aNewIndex);

Description

Move a contact ID within the array.

Arguments

TInt aOldIndex

The index of the ID to move.

TInt aNewIndex

The new index for the contact ID.

Notes

Both indexes must be valid or a panic occurs.


ReverseOrder() — Reverse the order of the array

void ReverseOrder();

Description

Reverse the order of the whole array.


Reset() — Reset the array

void Reset();

Description

Remove all contact IDs from the array.


Basic information


Count() — Get array count

TInt Count() const;

Description

Return the number of contact IDs in the array.

Return value

TInt

The number of contact IDs in the array.

EPOC       SDK Home Glossary Indexes Previous Next Up