EPOC   SDK Home Glossary Indexes Previous Next Up

CContentType class


Contents


CContentType class — Content type

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

cntfield.h

Link against

cntmodel.lib

Description

Each field (CContactItemField) owns a content type. The content type specifies one or more field types (defined as UIDs in cntdef.h — see the KUidContactField* values) and optionally a mapping. A mapping should be specified if the field type alone is not enough to identify which vCard property the field type maps to. The possible values for this vCard mapping are defined as UIDs in cntdef.h — see the KUidContactFieldVCardMap* values.

For instance, if the field type indicates a telephone number, the vCard mapping can be used to indicate whether it is a home (KUidContactFieldVCardMapHOME) or a work (KUidContactFieldVCardMapWORK) number.

Each field is uniquely identified by the combination of UIDs contained in the content type.

A field's content type can be retrieved using CContactItemField::ContentType().


Allocation and construction


NewL() — Allocate and construct

static CContentType* NewL();

Description

Allocate and construct a new, empty CContentType. The mapping is set to KNullUid.

Return value

CContentType*

Pointer to the newly created content type object.


NewL() — Allocate and construct with a field type and mapping

static CContentType* NewL(TFieldType aFieldType,TUid aMapping=KNullUid);

Description

Create a new CContentType, adding a single field type and optionally setting the mapping.

Arguments

TFieldType aFieldType

The field type to add to the content type.

TUid aMapping=KNullUid

The mapping. Defaults to KNullUid.

Return value

CContentType*

Pointer to the newly created content type object.


NewL() — Allocate and construct with a CContentType

static CContentType* NewL(const CContentType& aContentType);

Description

Create a new CContentType copying the contents from aContentType.

Arguments

const CContentType& aContentType

Content type object whose vCard mapping and field types are copied.

Return value

CContentType*

Pointer to the newly created content type.


Field types


AddFieldTypeL() — Append a field type

void AddFieldTypeL(TFieldType aFieldType);

Description

Append a field type to the content type's list of field types.

Arguments

TFieldType aFieldType

The field type to append to the list of field types.


RemoveFieldType() — Remove a field type

void RemoveFieldType(TFieldType aFieldType);

Description

Remove a field type from the list of field types.

Arguments

TFieldType aFieldType

The field type to remove from the list of field types.


FieldType() — Get field type

TFieldType FieldType(TInt aIndex) const;

Description

Return the indexed field type.

Arguments

TInt aIndex

Index into the list of field types.

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

TFieldType

The indexed field type.


FieldTypeCount() — Get field type count

TInt FieldTypeCount() const;

Description

Return the number of field types in the CContentType's list of field types.

Return value

TInt

The number of field types in the content type.


ContainsFieldType() — Does content type contain field type ?

TBool ContainsFieldType(TFieldType aFieldType) const;

Description

Test whether the content type object contains the specified field type UID either as the mapping value or in its list of field types.

Arguments

TFieldType aFieldType

The field type of interest.

Return value

TBool

ETrue if the CContentType contains the specified field type. EFalse if not.


vCard mapping


SetMapping() — Set the mapping

void SetMapping(TUid aMapping);

Description

Set the vCard mapping.

Arguments

TUid aMapping

The new vCard mapping for the CContentType.


Mapping() — Retrieve the mapping

TUid Mapping() const;

Description

Retrieve the vCard mapping.

Return value

TUid

The vCard mapping.


Enquiry functions


SupportsMultipleLines() — Does content type support multiple lines of text ?

TBool SupportsMultipleLines() const;

Description

Certain field types can support multiple lines of text (for example Address fields — of type KUidContactFieldAddress and Note fields — of type KUidContactFieldNote). If the content type object contains a field type which supports this, either in its list of field types, or as its mapping, the function returns ETrue.

Return value

TBool

ETrue if the CContentType supports multiple lines of text. EFalse if not.


operator==() — Comparison operator

TBool operator==(const CContentType& aType) const;

Description

Use this operator to test whether the current content type is the same as another.

Arguments

const CContentType& aType

The content type to compare with this CContentType.

Return value

TBool

ETrue if aType is an identical content type. Field types do not need to be in the same order in the list of field types for a match to be made.

EPOC       SDK Home Glossary Indexes Previous Next Up