EPOC   SDK Home Glossary Indexes Previous Next Up

CContactItemFieldSet class


Contents


CContactItemFieldSet class — Contact item field set

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

cntitem.h

Link against

cntmodel.lib

Description

This class represents a field set. It owns an array of contact item fields (CContactItemFields). An instance of this class is owned by a contact item, and this can be retrieved using CContactItem::CardFields(). Use functions provided by class CContactItem to add and remove fields to/from the field set.

A field set can contain more than one field of the same type, but this is not advisable as it may cause problems, for example if the contacts database is synchronized with a PC scheduler.


Allocation and construction


NewL() — Allocate and construct

static CContactItemFieldSet* NewL();

static CContactItemFieldSet* NewLC();

Description

Use these functions to allocate and construct a new field set.

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

Return value

CContactItemFieldSet*

Pointer to the newly created field set.


Stream persistence


StoreL() — Store field set

TStreamId StoreL(CStreamStore& aStore);

Description

Store the field set to a stream store.

Arguments

CStreamStore& aStore

Stream store to which the field set is written.

Return value

TStreamId

The ID of the stream store.


RestoreL() — Restore field set

void RestoreL(CStreamStore& aStore, TStreamId anId,const CContactItemViewDef& aViewDef);

Description

Restore the field set using a view definition.

Arguments

CStreamStore& aStore

Store from which to restore the field set.

TStreamId anId

ID of the stream store containing the field set.

const CContactItemViewDef& aViewDef

The view definition to use.


Search for fields


Find() — Find first field containing field type

TInt Find(TFieldType aFieldType) const;

Description

Find the first field in the field set containing the specified field type.

Arguments

TFieldType aFieldType

The field type of interest.

Return value

TInt

If found, the index of the field within the field set, or KErrNotFound if not found.


FindNext() — Find next field containing field type

TInt FindNext(TFieldType aFieldType,TInt aStartPos=KContactFieldSetSearchAll) const;

Description

Find the next field in the field set containing the specified field type.

Arguments

TFieldType aFieldType

The field type of interest.

TInt aStartPos=KContactFieldSetSearchAll

The index within the field set array at which to start the search. By default set to KContactFieldSetSearchAll, to find the first field.

Must be a valid array index, or the function raises a panic.

Return value

TInt

If found, the index of the field within the field set, or KErrNotFound if not found.


Find() — Find first field containing field type and mapping

TInt Find(TFieldType aFieldType,TUid aMapping) const;

Description

Find the first field in the field set containing both the content type mapping and the field type specified.

Arguments

TFieldType aFieldType

The field type of interest.

TUid aMapping

The content type mapping of interest.

Return value

TInt

If found, the index of the field within the field set, or KErrNotFound if not found.


FindNext() — Find next field containing field type and mapping

TInt FindNext(TFieldType aFieldType,TUid aMapping,TInt aStartPos=KContactFieldSetSearchAll) const;

Description

Find the next field in the field set containing both the content type mapping and the field type specified.

Arguments

TFieldType aFieldType

The field type of interest.

TUid aMapping

The content type mapping of interest.

TInt aStartPos=KContactFieldSetSearchAll

The index within the array at which to start the search. By default set to KContactFieldSetSearchAll, to find the first field.

Must be a valid array index, or the function raises a panic.

Return value

TInt

If found, the index of the field within the field set, or KErrNotFound if not found.


Adding, deleting and moving fields


AddL() — Append a field

CContactItemFieldSet& AddL(CContactItemField& aField);

Description

Append a field to the field set. The field set takes ownership of the field.

Arguments

CContactItemField& aField

Reference to the field to add to the field set. The field ID is updated by this function.

Return value

CContactItemFieldSet&

Reference to the current field set.


Remove() — Remove a field

void Remove(TInt aIndex);

Description

Remove a field from the field set.

Arguments

TInt aIndex

The index of the field to delete. Must be a valid index within the field set, or a panic occurs.


InsertL() — Insert a field

void InsertL(TInt aIndex,CContactItemField& aField);

Description

Insert a field into the field set.

Arguments

TInt aIndex

The position in the field set at which to insert the field. If equal to or greater than the number of elements in the field set, the field is appended to the field set.

CContactItemField& aField

Reference to the field to add to the field set. The field ID is updated by this function.


Reset() — Delete all fields

void Reset();

Description

Delete all fields in the field set.


Move() — Move a field

void Move(TInt aFrom, TInt aTo);

Description

Change a field's position within the field set.

Both indexes specified must be valid (i.e. between zero and Count()–1 inclusive), or the function raises a panic.

Arguments

TInt aFrom

The index of the field to move.

TInt aTo

The index of the new position within the field set.


operator[] — Index operator [ ]

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

CContactItemField& operator[](TInt aIndex);

Description

Use these operators to retrieve the field located at position aIndex within the field set.

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

Arguments

TInt aIndex

The position of the field within the field set.

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

CContactItemField&

Reference to the field located at position aIndex within the array.

const CContactItemField&

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


Basic information


Count() — Get number of fields

TInt Count() const;

Description

Retrieve the number of fields in the field set.

Return value

TInt

The number of fields in the field set.

EPOC       SDK Home Glossary Indexes Previous Next Up