CContactIdArray Class Reference

#include <app/cntdef.h>

class CContactIdArray : public CBase, public CBase

Inherits from

Detailed Description

Array of contact item IDs (TContactItemIds).

Instances of this class are used in several contact database functions, for instance CContactDatabase::DeleteContactsL().

Constructor & Destructor Documentation

~CContactIdArray ( )

IMPORT_C~CContactIdArray()

The destructor frees all resources owned by the array, prior to its destruction.

Member Function Documentation

AddL ( TContactItemId )

IMPORT_C voidAddL(TContactItemIdaId)

Appends a contact ID to the array.

Parameters
aIdThe contact ID to append to the array.

Count ( )

TInt Count()const [inline]

Gets the number of contact IDs in the array.

Return Value
The number of contact IDs in the array.

ExternalizeL ( RWriteStream & )

IMPORT_C voidExternalizeL(RWriteStream &aStream)const

Externalises 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 externalise objects of this class.

Parameters
aStreamStream to which the object should be externalised.

Find ( TContactItemId )

IMPORT_C TIntFind(TContactItemIdaId)const

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

Parameters
aIdThe contact ID to find.
Return Value
If the contact ID is found, its index within the array. KErrNotFound if the ID is not found.

InsertL ( TInt, TContactItemId )

voidInsertL(TIntaIndex,
TContactItemIdaId
)[inline]

Inserts a contact ID into the array.

The index must be valid or a panic occurs.

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. If the function leaves, the array is left in the state it was in before the call.

Parameters
aIndexThe index at which to insert the contact ID.
aIdThe contact ID to insert.

InternalizeL ( RReadStream & )

IMPORT_C voidInternalizeL(RReadStream &aStream)

Internalises 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 internalise objects of this class.

Parameters
aStreamStream from which the object should be internalised.

MoveL ( TInt, TInt )

IMPORT_C voidMoveL(TIntaOldIndex,
TIntaNewIndex
)

Moves a contact ID within the array.

Note: both indexes must be valid or a panic occurs.

Parameters
aOldIndexThe index of the ID to move.
aNewIndexThe new index for the contact ID.

NewL ( )

IMPORT_C CContactIdArray *NewL()[static]

Allocates and constructs a new contact ID array.

Return Value
Pointer to the newly created contact ID array.

NewL ( const CContactIdArray * )

IMPORT_C CContactIdArray *NewL(const CContactIdArray *aArray)[static]

Allocates and constructs a new contact ID array and then copies the contents of aArray into it.

Parameters
aArrayPointer to the contact ID array to copy.
Return Value
Pointer to the newly created contact ID array.

NewLC ( )

IMPORT_C CContactIdArray *NewLC()[static]

Allocates and constructs a new contact ID array.

The pointer to the object is left on the cleanup stack.

Return Value
Pointer to the newly created contact ID array.

NewLC ( const CContactIdArray * )

IMPORT_C CContactIdArray *NewLC(const CContactIdArray *aArray)[static]

Allocates and constructs a new contact ID array and then copies the contents of aArray into it.

The pointer to the object is left on the cleanup stack.

Parameters
aArrayPointer to the contact ID array to copy.
Return Value
Pointer to the newly created contact ID array.

NewLC ( RReadStream & )

CContactIdArray *NewLC(RReadStream &aStream)[static]

Allocates and constructs a new contact ID array based on a RReadStream.

The pointer to the object is left on the cleanup stack.

Parameters
aStreamRReadStream containing object to internalize.
Return Value
Pointer to the newly created contact ID array

Remove ( TInt )

voidRemove(TIntaIndex)[inline]

Removes the indexed contact ID from the array.

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

Parameters
aIndexThe index of the contact ID to remove.

Remove ( TInt, TInt )

voidRemove(TIntaIndex,
TIntaCount
)[inline]

Removes a block of contact IDs from the array.

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

  • aCount is negative

  • aIndex is negative or is greater than the number of elements currently in the array

  • the sum of aIndex and aCount is greater than the number of elements currently in the array

Parameters
aIndexThe index of the first contact ID to remove.
aCountThe number of contiguous contact IDs to delete from the array. If this is not specified, a value of one is assumed.

Reset ( )

voidReset()[inline]

Removes all contact IDs from the array.

ReverseOrder ( )

IMPORT_C voidReverseOrder()

Reverses the order of the whole array.

Sort ( )

voidSort()

operator[] ( TInt )

const TContactItemId &operator[](TIntaIndex)const [inline]

Gets the indexed TContactItemId.

Parameters
aIndexThe position of the contact ID within the array, relative to zero. This must be non-negative and less than the number of objects in the array otherwise the operator raises a panic.
Return Value
A reference to a const element of the array.

operator[] ( TInt )

TContactItemId &operator[](TIntaIndex)[inline]

Gets the indexed TContactItemId.

Parameters
aIndexThe position of the contact ID within the array, relative to zero. This must be non-negative and less than the number of objects in the array otherwise the operator raises a panic.
Return Value
A reference to a non-const element of the array.