Symbian Developer Library

SYMBIAN OS V6.1 EDITION FOR C++

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



Location: cntdef.h
Link against: cntmodel.lib

Class CContactIdArray

CContactIdArray

Support

Supported from 5.0

Description

Array of contact item IDs (TContactItemIds). Instances of this class are passed to several contact database functions, for instance CContactDatabase::DeleteContactsL().

Derivation

CBaseBase class for all classes to be instantiated on the heap
CContactIdArrayArray of contact item IDs (TContactItemIds)

Defined in CContactIdArray:
AddL(), Count(), ExternalizeL(), Find(), InsertL(), InternalizeL(), MoveL(), NewL(), NewLC(), Remove(), Reset(), ReverseOrder(), operator[], ~CContactIdArray()

Inherited from CBase:
operator new()


Construction and destruction


NewL()

static CContactIdArray* NewL();
static CContactIdArray* NewL(const CContactIdArray* aArray);

Description

Allocates and constructs a new contact ID array — overloaded function. The contents of the array may be copied from another array.

Parameters

const CContactIdArray* aArray

Pointer to the contact ID array to copy.

Return value

CContactIdArray*

Pointer to the newly created contact ID array.


NewLC()

static CContactIdArray* NewLC();
static CContactIdArray* NewLC(const CContactIdArray* aArray);

Description

Allocates and constructs a new contact ID array — overloaded function. The contents of the array may be copied from another array. The pointer to the object is left on the cleanup stack.

Parameters

const CContactIdArray* aArray

Pointer to the contact ID array to copy.

Return value

CContactIdArray*

Pointer to the newly created contact ID array.


~CContactIdArray()

~CContactIdArray();

Description

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

[Top]


Stream persistence


InternalizeL()

void InternalizeL(RReadStream& aStream);

Description

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

RReadStream& aStream

Stream from which the object should be internalised

Leave codes

 

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


ExternalizeL()

void ExternalizeL(RWriteStream& aStream) const;

Description

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

RWriteStream& aStream

Stream to which the object should be externalised

Leave codes

 

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

[Top]


Indexing into the array


operator[]

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

Description

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

Parameters

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.

[Top]


Array manipulation


AddL()

void AddL(TContactItemId aId);

Description

Appends a contact ID to the array.

Parameters

TContactItemId aId

The contact ID to append to the array.


Remove()

void Remove(TInt aIndex);

Description

Removes the indexed contact ID from the array.

Note:

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.

Parameters

TInt aIndex

The index of the contact ID to remove.


Remove()

void Remove(TInt aIndex,TInt aCount);

Description

Removes a block of contact IDs from the array.

Notes:

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

Parameters

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.


InsertL()

void InsertL(TInt aIndex,TContactItemId aId);

Description

Inserts a contact ID into the array.

Note:

The index must be valid or a panic occurs.

Parameters

TInt aIndex

The index at which to insert the contact ID.

TContactItemId aId

The contact ID to insert.

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


Find()

TInt Find(TContactItemId aId) const;

Description

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

Parameters

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()

void MoveL(TInt aOldIndex,TInt aNewIndex);

Description

Moves a contact ID within the array.

Note:

Both indexes must be valid or a panic occurs.

Parameters

TInt aOldIndex

The index of the ID to move.

TInt aNewIndex

The new index for the contact ID.


ReverseOrder()

void ReverseOrder();

Description

Reverses the order of the whole array.


Reset()

void Reset();

Description

Removes all contact IDs from the array.

[Top]


Basic information


Count()

TInt Count() const;

Description

Gets the number of contact IDs in the array.

Return value

TInt

The number of contact IDs in the array.