»
Symbian OS v6.1 Edition for C++ »
API Reference »
Contacts Model »
CContactItemViewDef
Location:
cntdb.h
Link against: cntmodel.lib
 
Class CContactItemViewDef
 CContactItemViewDef
Support
Supported from 5.0
Description
A view definition for a contact item. When reading or opening a
contact item using the CContactDatabase class, a view definition
may be specified to indicate which field data should be retrieved. See for
instance CContactDatabase::ReadContactL().
A view definition for a contact item contains an array of field
types, a use (CContactItemViewDef::TUse) and a mode
(CContactItemViewDef::TMode). The use indicates whether the field
types contained in the view definition should be included in or excluded from
the view. The mode indicates whether fields with the hidden attribute should be
included or excluded.
Derivation
| 
| CBase | Base class for all classes to be instantiated on the heap |  | CContactItemViewDef | A view definition for a contact item |  | 
Defined in CContactItemViewDef:
AddL(), Contains(), Count(), EIncludeFields, EIncludeHiddenFields, EMaskFields, EMaskHiddenFields, ExternalizeL(), Find(), InternalizeL(), MatchesAll(), Mode(), NewL(), NewLC(), Remove(), Reset(), SetMode(), SetUse(), TMode, TUse, Use(), operator[]
Inherited from CBase:
operator new()
Allocation and construction
static CContactItemViewDef* NewL(TUse aUse, TMode aMode);
Description
Allocates and constructs a new
CContactItemViewDef, with a use and a mode.
Parameters
| 
| TUse aUse | Indicates whether to include or exclude specified
fields. |  
| TMode aMode | Indicates whether to include or exclude hidden fields. |  | 
Return value
| 
| CContactItemViewDef* | Pointer to the newly created view definition. |  | 
static CContactItemViewDef* NewLC(TUse aUse, TMode aMode);
Description
Allocates and constructs a new CContactItemViewDef,
specifying a use and a mode, and leaving the view definition object on the
cleanup stack.
Parameters
| 
| TUse aUse | Indicates whether to include or exclude specified fields. |  
| TMode aMode | Indicates whether to include or exclude hidden fields. |  | 
Return value
| 
| CContactItemViewDef* | Pointer to the newly created view definition. |  | 
void InternalizeL(RReadStream& aStream);
Description
Internalises the item view definition 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 item view definition should be
internalised. |  | 
void ExternalizeL(RWriteStream& aStream) const;
Description
Externalises the item view definition 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 item view definition should be
externalised. |  | 
TUid operator[](TInt aIndex) const;
Description
Gets the field type located at a specified index position within the
field type array.
Parameters
| 
| TInt aIndex | The position of the field type element 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 function raises a panic. |  | 
Return value
| 
| TUid | The field type located at index aIndexwithin the array
(this is equivalent to aTFieldType). |  | 
TInt Find(const CContentType& aContentType) const;
Description
Searches the view definition for any field type contained in the
specified content type.
Parameters
| 
| const CContentType& aContentType | Content type containing the field types to search for. |  | 
Return value
| 
| TInt | The index in the view definition of the first matching field type or
KErrNotFound. |  | 
TInt Find(TFieldType aFieldType) const;
Description
Searches the view definition for the specified field
type.
Parameters
| 
| TFieldType aFieldType | The field type to search for. |  | 
Return value
| 
| TInt | The index in the view definition of the matching field type or
KErrNotFound. |  | 
TInt Count() const;
Description
Gets the number of field types in the view
definition.
Return value
| 
| TInt | The number of field types in the view definition. |  | 
TBool MatchesAll() const;
Description
Tests whether the view definition contains a field type with the value
KUidContactFieldMatchAll. If this is the case, all fields in the
contact item are retrieved, regardless of the other field types specified in
the view definition.
Return value
| 
| TBool | ETrueif all field types are matched,EFalseif
not.
 |  | 
TBool Contains(const CContactItem& aItem);
Description
Tests whether a contact item complies with the view definition, i.e.
whether or not the contact item will be included in the view.
Parameters
| 
| const CContactItem& aItem | The contact item to test. |  | 
Return value
| 
| TBool | ETrueif any of the item's fields are contained in the view
definition (so that the item will be included in the view),EFalseif none of the item's fields are contained in the view definition (so that the
item will not be included in the view).
 |  | 
void AddL(TFieldType aFieldType);
Description
Appends a field type to the view definition's array of field
types.
Parameters
| 
| TFieldType aFieldType | The field type to append to the array of field types. |  | 
void Remove(TFieldType aFieldType);
Description
Removes a field type, identified by its field type
UID.
Parameters
| 
| TFieldType aFieldType | The field type to remove from the list. This field type must be present
in the CContactItemViewDefobject, or the function raises a
panic. |  | 
void Remove(TInt aIndex);
Description
Removes a field type, identified by its index into the array of field
types.
Parameters
| 
| TInt aIndex | The index of the element to delete. The position is relative to zero.
This value must not be negative and must not be greater than the number of
elements currently in the list, or the function raises a panic. |  | 
void Reset();
Description
Deletes all field types from the view definition's field type
array.
TUse Use() const;
Description
Gets the view definition's use.
Return value
| 
| TUse | The current TUsesetting. |  | 
void SetUse(TUse aUse);
Description
Sets the view definition's use.
Parameters
| 
| TUse aUse | The new TUsesetting. |  | 
TMode Mode() const;
Description
Gets the view definition's mode.
Return value
| 
| TMode | The current TModesetting. |  | 
void SetMode(TMode aMode);
Description
Sets the view definition's mode.
Parameters
| 
| TMode aMode | The new TModesetting. |  | 
TUse
Description
Include or exclude specified fields
TMode
Description
Include or exclude hidden fields