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 void AddFieldL (const TDesC &)
IMPORT_C void ChangeToLightweightObject ()
IMPORT_C TInt ContactHint ()
IMPORT_C TBool ContactMatchesFilter ( TInt )
TViewContactType ContactType ()
IMPORT_C TUid ContactTypeUid ()
void CopyL (const CViewContact &)
IMPORT_C void ExternalizeL ( RWriteStream &)
IMPORT_C TInt ExternalizedSize ()
IMPORT_C TPtrC Field ( TInt )
IMPORT_C TInt FieldCount ()
TPtrC FindFirstPopulatedField ( TInt , TInt &)
TBool HintFieldMatchesFilter ( TInt , TInt )
TContactItemId Id ()
IMPORT_C void InternalizeL ( RReadStream &)
TBool IsLightweightObject ()
IMPORT_C TBool IsSortable ()
IMPORT_C CViewContact * NewL (const CViewContact &)
IMPORT_C CViewContact * NewL ( TContactItemId , TInt )
IMPORT_C CViewContact * NewLC ( TContactItemId )
CViewContact * NewLC ( RReadStream &)
IMPORT_C void Reset ()
IMPORT_C void SetContactHint ( TInt )
void SetContactType ( CViewContact::TViewContactType )
IMPORT_C void SetContactTypeUid ( TUid )
IMPORT_C void SetFirstFieldForBlankContactL (const TDesC &)
void SetId ( TContactItemId )
Private Member Functions
void ConstructL ( TInt )
void ConstructL (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
enum TViewContactType { EContactItem , EGroup }
Private Attributes
TViewContactType iContactType
CViewContactExtension * iExtension
TContactItemId iId
RArray < TInt > iTextIndexes

Constructor & Destructor Documentation

CViewContact(TContactItemId)

IMPORT_C CViewContact ( TContactItemId aId )

Constructs a CViewContact object.

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

Parameters

TContactItemId aId The contact ID to assign to the object.

~CViewContact()

IMPORT_C ~CViewContact ( )

Destructor.

Member Functions Documentation

AddFieldL(const TDesC &)

IMPORT_C void AddFieldL ( const TDesC & aField )

Parameters

const TDesC & aField

ChangeToLightweightObject()

IMPORT_C void ChangeToLightweightObject ( )

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

ConstructL(TInt)

void ConstructL ( TInt aLength = 0 ) [private]

Parameters

TInt aLength = 0

ConstructL(const CViewContact &)

void ConstructL ( const CViewContact & aContact ) [private]

Parameters

const CViewContact & aContact

ContactHint()

IMPORT_C TInt ContactHint ( ) const

Get this contact's hint field value

ContactMatchesFilter(TInt)

IMPORT_C TBool ContactMatchesFilter ( TInt aFilter ) 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 TUid ContactTypeUid ( ) const

CopyL(const CViewContact &)

void CopyL ( const CViewContact & aContact )

Copy the given view contact object to this instance.

leave
KErrNoMemory

Parameters

const CViewContact & aContact the view contact to be copied.

ExternalizeL(RWriteStream &)

IMPORT_C void ExternalizeL ( RWriteStream & aStream ) const

Externalises a CViewContact object to a write stream.

Parameters

RWriteStream & aStream Stream to which the object is externalised.

ExternalizedSize()

IMPORT_C TInt ExternalizedSize ( ) const

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

Field(TInt)

IMPORT_C TPtrC Field ( TInt aPosition ) 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 aPosition A field index.

FieldCount()

IMPORT_C TInt FieldCount ( ) const

Gets the number of fields in the contact view item.

FindFirstPopulatedField(TInt, TInt &)

TPtrC FindFirstPopulatedField ( TInt aOffset,
TInt & aFoundPosition
) const

Parameters

TInt aOffset
TInt & aFoundPosition

HintFieldMatchesFilter(TInt, TInt)

TBool HintFieldMatchesFilter ( TInt aHintField,
TInt aFilter
) [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 aHintField the hint bit flag field
TInt aFilter the filter to compare against

Id()

TContactItemId Id ( ) const [inline]

Gets the view item's ID.

InternalizeL(RReadStream &)

IMPORT_C void InternalizeL ( RReadStream & aStream )

Internalises a CViewContact object from a read stream.

Parameters

RReadStream & aStream Stream from which the object is internalised.

IsLightweightObject()

TBool IsLightweightObject ( ) const

Check if the view contact object is a lightweight object.

IsSortable()

IMPORT_C TBool IsSortable ( ) 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 & aContact An existing CViewContact object whose values are used to initialise the new one.

NewL(TContactItemId, TInt)

IMPORT_C CViewContact * NewL ( TContactItemId aId,
TInt aLength
) [static]

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

Parameters

TContactItemId aId ID of the existing CViewContact object whose values are used to initialise the new one.
TInt aLength initial MaxLenght of a contact buffer

NewLC(TContactItemId)

IMPORT_C CViewContact * NewLC ( TContactItemId aId ) [static]

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

Parameters

TContactItemId aId ID 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 void Reset ( )

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 void SetContactHint ( TInt aHint )

Set this contact's hint field value

Parameters

TInt aHint The new contact hint value

SetContactType(CViewContact::TViewContactType)

void SetContactType ( CViewContact::TViewContactType aContactType ) [inline]

Sets the view item's type.

Parameters

CViewContact::TViewContactType aContactType The view item's type.

SetContactTypeUid(TUid)

IMPORT_C void SetContactTypeUid ( TUid aUid )

Note: This method can leave.

leave
KErrNoMemory The CViewContactExtension cannot be allocated.

Parameters

TUid aUid

SetFirstFieldForBlankContactL(const TDesC &)

IMPORT_C void SetFirstFieldForBlankContactL ( 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)

void SetId ( TContactItemId aId ) [inline]

Sets the view item's ID.

Parameters

TContactItemId aId The 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]