CViewContact Class Reference

class CViewContact : public CBase

The representation of a contact item used in contact views.

It stores the contact item ID and other information. This includes a buffer holding the contents of all the item's fields, an array of indexes into the buffer indicating the start position of each field and a hint bit field (a combination of CContactDatabase::TContactViewFilter values) which is used in filtered views.

The fields are defined by the view's sort order (RContactViewSortOrder).

Inherits from

Public Member Functions
CViewContact(TContactItemId)
~CViewContact()
IMPORT_C voidAddFieldL(const TDesC &)
IMPORT_C voidChangeToLightweightObject()
IMPORT_C TIntContactHint()
IMPORT_C TBoolContactMatchesFilter(TInt)
TViewContactType ContactType()
IMPORT_C TUidContactTypeUid()
voidCopyL(const CViewContact &)
IMPORT_C voidExternalizeL(RWriteStream &)
IMPORT_C TIntExternalizedSize()
IMPORT_C TPtrCField(TInt)
IMPORT_C TIntFieldCount()
TPtrC FindFirstPopulatedField(TInt, TInt &)
TBool HintFieldMatchesFilter(TInt, TInt)
TContactItemId Id()
IMPORT_C voidInternalizeL(RReadStream &)
TBool IsLightweightObject()
IMPORT_C TBoolIsSortable()
IMPORT_C CViewContact *NewL(const CViewContact &)
IMPORT_C CViewContact *NewL(TContactItemId, TInt)
IMPORT_C CViewContact *NewLC(TContactItemId)
CViewContact *NewLC(RReadStream &)
IMPORT_C voidReset()
IMPORT_C voidSetContactHint(TInt)
voidSetContactType(CViewContact::TViewContactType)
IMPORT_C voidSetContactTypeUid(TUid)
IMPORT_C voidSetFirstFieldForBlankContactL(const TDesC &)
voidSetId(TContactItemId)
Private Member Functions
voidConstructL(TInt)
voidConstructL(const CViewContact &)
Inherited Functions
CBase::CBase()
CBase::Delete(CBase *)
CBase::Extension_(TUint,TAny *&,TAny *)
CBase::operator new(TUint)
CBase::operator new(TUint,TAny *)
CBase::operator new(TUint,TLeave)
CBase::operator new(TUint,TLeave,TUint)
CBase::operator new(TUint,TUint)
CBase::~CBase()
Public Member Enumerations
enumTViewContactType { EContactItem, EGroup }
Private Attributes
TViewContactType iContactType
CViewContactExtension *iExtension
TContactItemId iId
RArray< TInt >iTextIndexes

Constructor & Destructor Documentation

CViewContact(TContactItemId)

IMPORT_CCViewContact(TContactItemIdaId)

Constructs a CViewContact object.

This should not be called by clients. CViewContact::NewLC() should be used instead.

Parameters

TContactItemId aIdThe contact ID to assign to the object.

~CViewContact()

IMPORT_C~CViewContact()

Destructor.

Member Functions Documentation

AddFieldL(const TDesC &)

IMPORT_C voidAddFieldL(const TDesC &aField)

Parameters

const TDesC & aField

ChangeToLightweightObject()

IMPORT_C voidChangeToLightweightObject()

Change the view contact object to lightweight object to save memory. It actually just delete the instance of CViewContactExtension.

ConstructL(TInt)

voidConstructL(TIntaLength = 0)[private]

Parameters

TInt aLength = 0

ConstructL(const CViewContact &)

voidConstructL(const CViewContact &aContact)[private]

Parameters

const CViewContact & aContact

ContactHint()

IMPORT_C TIntContactHint()const

Get this contact's hint field value

ContactMatchesFilter(TInt)

IMPORT_C TBoolContactMatchesFilter(TIntaFilter)const

Checks if this contact matches the supplied filter.

Parameters

TInt aFilter

ContactType()

TViewContactType ContactType()const [inline]

Gets the view item's type.

ContactTypeUid()

IMPORT_C TUidContactTypeUid()const

CopyL(const CViewContact &)

voidCopyL(const CViewContact &aContact)

Copy the given view contact object to this instance.

leave
KErrNoMemory

Parameters

const CViewContact & aContactthe view contact to be copied.

ExternalizeL(RWriteStream &)

IMPORT_C voidExternalizeL(RWriteStream &aStream)const

Externalises a CViewContact object to a write stream.

Parameters

RWriteStream & aStreamStream to which the object is externalised.

ExternalizedSize()

IMPORT_C TIntExternalizedSize()const

Retrieves the number of bytes required to store the contact view item when externalised.

Field(TInt)

IMPORT_C TPtrCField(TIntaPosition)const

Gets a pointer descriptor to the contents of the single field located at the specified field index.

panic
CNTMODEL 27 In debug builds, this indicates that aPosition is invalid. It must be less than the number of fields in the item.

Parameters

TInt aPositionA field index.

FieldCount()

IMPORT_C TIntFieldCount()const

Gets the number of fields in the contact view item.

FindFirstPopulatedField(TInt, TInt &)

TPtrC FindFirstPopulatedField(TIntaOffset,
TInt &aFoundPosition
)const

Parameters

TInt aOffset
TInt & aFoundPosition

HintFieldMatchesFilter(TInt, TInt)

TBool HintFieldMatchesFilter(TIntaHintField,
TIntaFilter
)[static]

Compares a given hint field with any given filter. static function. Used to support member function ContactMatchesFilter and exported function ContactMatchesHintFieldL, from CContactDatabase.

Parameters

TInt aHintFieldthe hint bit flag field
TInt aFilterthe filter to compare against

Id()

TContactItemId Id()const [inline]

Gets the view item's ID.

InternalizeL(RReadStream &)

IMPORT_C voidInternalizeL(RReadStream &aStream)

Internalises a CViewContact object from a read stream.

Parameters

RReadStream & aStreamStream from which the object is internalised.

IsLightweightObject()

TBool IsLightweightObject()const

Check if the view contact object is a lightweight object.

IsSortable()

IMPORT_C TBoolIsSortable()const

Test if contact is 'Sortable'

NewL(const CViewContact &)

IMPORT_C CViewContact *NewL(const CViewContact &aContact)[static]

Allocates and constructs a CViewContact object, based on an existing one.

Parameters

const CViewContact & aContactAn existing CViewContact object whose values are used to initialise the new one.

NewL(TContactItemId, TInt)

IMPORT_C CViewContact *NewL(TContactItemIdaId,
TIntaLength
)[static]

Allocates and constructs a CViewContact object, based on an existing one.

Parameters

TContactItemId aIdID of the existing CViewContact object whose values are used to initialise the new one.
TInt aLengthinitial MaxLenght of a contact buffer

NewLC(TContactItemId)

IMPORT_C CViewContact *NewLC(TContactItemIdaId)[static]

Allocates and constructs a CViewContact object, based on an existing one.

Parameters

TContactItemId aIdID of the existing CViewContact object whose values are used to initialise the new one.

NewLC(RReadStream &)

CViewContact *NewLC(RReadStream &aStream)[static]

Parameters

RReadStream & aStream

Reset()

IMPORT_C voidReset()

Used for creating a view. Allows to re-use the same contact object what reduces the number of memory re-allocations. Resets the indexes array and contact buffer. The buffer MaxLength stays the same.

SetContactHint(TInt)

IMPORT_C voidSetContactHint(TIntaHint)

Set this contact's hint field value

Parameters

TInt aHintThe new contact hint value

SetContactType(CViewContact::TViewContactType)

voidSetContactType(CViewContact::TViewContactTypeaContactType)[inline]

Sets the view item's type.

Parameters

CViewContact::TViewContactType aContactTypeThe view item's type.

SetContactTypeUid(TUid)

IMPORT_C voidSetContactTypeUid(TUidaUid)

Note: This method can leave.

leave
KErrNoMemory The CViewContactExtension cannot be allocated.

Parameters

TUid aUid

SetFirstFieldForBlankContactL(const TDesC &)

IMPORT_C voidSetFirstFieldForBlankContactL(const TDesC &aFirstField)

Set the first field text for the CViewContact. Fields are stored in one HBufC. Each field can be accessed using the indexes stored in the iTextIndexes member.

Parameters

const TDesC & aFirstField

SetId(TContactItemId)

voidSetId(TContactItemIdaId)[inline]

Sets the view item's ID.

Parameters

TContactItemId aIdThe contact item ID.

Member Enumerations Documentation

Enum TViewContactType

Defines whether the contact view item is a contact group.

Enumerators

EContactItem

The contact view item is not a contact group.

EGroup

The contact view item is a contact group (CContactGroup).

Member Data Documentation

TViewContactType iContactType

TViewContactType iContactType[private]

CViewContactExtension * iExtension

CViewContactExtension *iExtension[private]

TContactItemId iId

TContactItemId iId[private]

RArray< TInt > iTextIndexes

RArray< TInt >iTextIndexes[private]