Symbian Developer Library

SYMBIAN OS V6.1 EDITION FOR C++

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



Location: cntitem.h
Link against: cntmodel.lib

Class CContactItemFieldSet

CContactItemFieldSet

Support

Supported from 5.0

Description

A contact item's field set. The field set owns an array of contact item fields (CContactItemFields). The field set is owned by a contact item, and 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 when synchronising the contacts database.

Derivation

CBaseBase class for all classes to be instantiated on the heap
CContactItemFieldSetA contact item's field set

Defined in CContactItemFieldSet:
AddL(), Count(), Find(), FindNext(), InsertL(), Move(), NewL(), NewLC(), Remove(), Reset(), RestoreL(), StoreL(), UpdateFieldL(), operator[], ~CContactItemFieldSet()

Inherited from CBase:
operator new()


Construction and destruction


NewL()

static CContactItemFieldSet* NewL();

Description

Allocates and constructs a new field set.

Return value

CContactItemFieldSet*

Pointer to the newly created field set.


NewLC()

static CContactItemFieldSet* NewLC();

Description

Allocates and constructs a new field set, leaving a pointer to it on the cleanup stack.

Return value

CContactItemFieldSet*

Pointer to the newly created field set.


~CContactItemFieldSet()

~CContactItemFieldSet();

Description

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

[Top]


Stream persistence


StoreL()

TStreamId StoreL(CStreamStore& aStore);

Support

Withdrawn in 5.1

Description

Stores the field set to a stream store.

Parameters

CStreamStore& aStore

Stream store to which the field set is written.

Return value

TStreamId

The ID of the stream store.


StoreL()

TStreamId StoreL(CStreamStore& aStore,RWriteStream& aTextStream);

Support

Withdrawn in 6.0
Supported from 5.1

Description

Stores the field set to a stream store.

Parameters

CStreamStore& aStore

Stream store to which the field set is written.

RWriteStream& aTextStream

Stream to which text field data is written.

Return value

TStreamId

The ID of the stream store.


StoreL()

TStreamId StoreL(CStreamStore& aStore,RWriteStream& aTextStream,CStreamStore& aBlobStore);

Support

Supported from 6.0

Description

Stores the field set to a stream store.

Parameters

CStreamStore& aStore

Stream store to which the field set is written.

RWriteStream& aTextStream

Stream to which data stored in text fields (with a storage type of KStorageTypeText) is written.

CStreamStore& aBlobStore

Stream store to which data stored in non-text fields is written.

Return value

TStreamId

The ID of the stream store.


RestoreL()

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

Support

Withdrawn in 5.1

Description

Restores the field set using a view definition.

Parameters

CStreamStore& aStore

Stream store from which to restore the field set.

TStreamId anId

The root stream ID of aStore.

const CContactItemViewDef& aViewDef

The view definition to use.


RestoreL()

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

Support

Withdrawn in 6.0
Supported from 5.1

Description

Restores the field set using a view definition.

Parameters

CStreamStore& aStore

Store from which to restore the field set.

TStreamId anId

The root stream ID of aStore.

const CContactItemViewDef& aViewDef

The view definition to use.

RReadStream& aReadStream

Stream from which text field data is read.


RestoreL()

void RestoreL(CStreamStore& aStore, TStreamId anId,CStreamStore* aBlobStore,const CContactItemViewDef& aViewDef,RReadStream& aReadStream);

Support

Supported from 6.0

Description

Restores the field set using a view definition.

Parameters

CStreamStore& aStore

Store from which to restore the field set.

TStreamId anId

The root stream ID of aStore.

CStreamStore* aBlobStore

If specified, the stream store from which data stored in non-text fields is read.

const CContactItemViewDef& aViewDef

The view definition to use.

RReadStream& aReadStream

Read stream from which data stored in text fields (with a storage type of KStorageTypeText) is read.

[Top]


Search for fields


Find()

TInt Find(TFieldType aFieldType) const;

Description

Finds the first field in the field set with the specified field type.

Parameters

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

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

Description

Finds the next field in the field set with the specified field type.

Parameters

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

TInt Find(TFieldType aFieldType,TUid aMapping) const;

Description

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

Parameters

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

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

Description

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

Parameters

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.

[Top]


Adding, deleting and moving fields


AddL()

CContactItemFieldSet& AddL(CContactItemField& aField);

Description

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

Parameters

CContactItemField& aField

Reference to the field to add to the field set. The field's ID is updated.

Return value

CContactItemFieldSet&

Reference to the current field set.


Remove()

void Remove(TInt aIndex);

Description

Removes a field from the field set.

Parameters

TInt aIndex

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


InsertL()

void InsertL(TInt aIndex,CContactItemField& aField);

Description

Inserts a field into the field set.

Parameters

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's ID is updated.


Reset()

void Reset();

Description

Deletes all fields in the field set.


Move()

void Move(TInt aFrom, TInt aTo);

Description

Changes 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.

Parameters

TInt aFrom

The index of the field to move.

TInt aTo

The index of the new position within the field set.


UpdateFieldL()

void UpdateFieldL(const CContactItemField &aField, TInt aMatchCount);

Support

Supported from 5.1

Description

Updates a field in the field set. The field whose content type matches aField's content type is replaced by aField. The second parameter is used to identify which matching field is updated. Specify 1 to update the first matching field, 2 for the second and so on. If there is no field in the field set which matches aField's content type, then aField is appended to the field set.

Parameters

const CContactItemField &aField

The new field information.

TInt aMatchCount

Identifies which matching field in the field set should be updated.


operator[]

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

Description

Gets the field located at a specified position within the field set. The compiler chooses the appropriate operator variant, depending on the context of the call.

Parameters

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.

[Top]


Basic information


Count()

TInt Count() const;

Description

Retrieves the number of fields in the field set.

Return value

TInt

The number of fields in the field set.