#include <CNTITEM.H>
Link against:
cntmodel.lib
Class CContactItemFieldSet
class CContactItemFieldSet : public CBase;
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 in 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
CBase
- Base class for all classes to be instantiated on the heap
CContactItemFieldSet
- A contact item's field set
Members
Defined in CContactItemFieldSet
:
AddL()
Appends a field to the field set
Count()
Gets the number of fields in the field set
Find()
Finds the first field in the field set with the specified field type
Find()
Finds the first field in the field set containing both the content type mapping and the field type specified
FindNext()
Finds the next field in the field set with the specified field type
FindNext()
Finds the next field in the field set containing both the content type mapping and the field type specified
InsertL()
Inserts a field into the field set
Move()
Changes a field's position within the field set
NewL()
Allocates and constructs a new field set
NewLC()
Allocates and constructs a new field set
Remove()
Removes a field from the field set
Reset()
Deletes all fields in the field set
UpdateFieldL()
Updates a field in the field set
UpdateFieldSyncL()
Updates a field in the field set
operator[]()
Gets the field located at a specified position in the field set
operator[]()
Gets the field located at a specified position in the field set
~CContactItemFieldSet()
The destructor frees all resources owned by the field set, prior to its destruction
Inherited from CBase
:
Construction and destruction
static IMPORT_C CContactItemFieldSet *NewL();
Description
Allocates and constructs a new field set.
Return value
static IMPORT_C CContactItemFieldSet *NewLC();
Description
Allocates and constructs a new field set.
Return value
IMPORT_C ~CContactItemFieldSet();
Description
The destructor frees all resources owned by the field set, prior to its destruction.
inline const CContactItemField &operator[](TInt aIndex) const;
Description
Gets the field located at a specified position in the field set.
Parameters
TInt aIndex |
The position of the field in the field set. This is relative to zero. It must be non-negative and less than the number of
objects in the array, otherwise the operator raises a panic.
|
|
Return value
inline CContactItemField &operator[](TInt aIndex);
Description
Gets the field located at a specified position in the field set.
Parameters
TInt aIndex |
The position of the field in the field set. This is relative to zero. It must be non-negative and less than the number of
objects in the array, otherwise the operator raises a panic.
|
|
Return value
inline TInt Find(TFieldType aFieldType) const;
Description
Finds the first field in the field set with the specified field type.
Parameters
Return value
TInt
|
If found, the index of the field within the field set, or KErrNotFound if not found.
|
|
inline 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.
|
|
IMPORT_C 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 |
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.
|
|
IMPORT_C 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 |
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.
|
|
inline TInt Count() const;
Description
Gets the number of fields in the field set.
Return value
TInt
|
The number of fields in the field set.
|
|
inline void Reset();
Description
Deletes all fields in the field set.
IMPORT_C void UpdateFieldL(const CContactItemField &aField, TInt aMatchCount);
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.
|
|
IMPORT_C void UpdateFieldSyncL(const CContactItemField &aField, TInt aMatchCount);
Description
Updates a field in the field set. Searches the set for a matching field. Deletes the matching set's field if any. Adds the
aField to the set anyway. Uses the IsEqualForSyncUpdate() function to compare two CContentType
objects, rather than the default equals operator. Takes care to hold the PREF, VoiceDial, and SpeedDial properties in the
updated field.
Parameters
const CContactItemField &aField |
Specifies both the type of the field to update and the updated field's value.
|
TInt aMatchCount |
Gives the offset of the matching field to update in the order of the set (i.e. 1, means update the first matching field in
the set; 2, means update the second matching field in the set).
|
|
IMPORT_C 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
IMPORT_C 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.
|
|
IMPORT_C 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.
|
|
IMPORT_C 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.
|
|