1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/epoc32/include/app/cntitem.h Wed Mar 31 12:27:01 2010 +0100
1.3 @@ -0,0 +1,559 @@
1.4 +// Copyright (c) 1997-2009 Nokia Corporation and/or its subsidiary(-ies).
1.5 +// All rights reserved.
1.6 +// This component and the accompanying materials are made available
1.7 +// under the terms of the License "Symbian Foundation License v1.0" to Symbian Foundation members and "Symbian Foundation End User License Agreement v1.0" to non-members
1.8 +// which accompanies this distribution, and is available
1.9 +// at the URL "http://www.symbianfoundation.org/legal/licencesv10.html".
1.10 +//
1.11 +// Initial Contributors:
1.12 +// Nokia Corporation - initial contribution.
1.13 +//
1.14 +// Contributors:
1.15 +//
1.16 +// Description:
1.17 +// Persistence layer exports
1.18 +//
1.19 +//
1.20 +
1.21 +#if !defined(__CNTITEM_H__)
1.22 +#define __CNTITEM_H__
1.23 +
1.24 +#if !defined(__E32BASE_H__)
1.25 +#include <e32base.h>
1.26 +#endif
1.27 +
1.28 +#if !defined(__CNTDEF_H__)
1.29 +#include <cntdef.h>
1.30 +#endif
1.31 +
1.32 +#if !defined(__CNTFIELD_H__)
1.33 +#include <cntfield.h>
1.34 +#endif
1.35 +
1.36 +#include <cntdb.h>
1.37 +
1.38 +
1.39 +const TInt KUidStringLength =244;
1.40 +#define KUidStringSeparator '-'
1.41 +class CContactItemField;
1.42 +#define KContactMaxFieldNumber 32
1.43 +class CContactItemViewDef;
1.44 +class CContactItem;
1.45 +
1.46 +const TInt KContactFieldSetSearchAll=-1;
1.47 +class CContactItemFieldSet : public CBase
1.48 +/** A contact item's field set. The field set owns an array of contact item fields
1.49 +(CContactItemFields). The field set is owned by a contact item, and can be
1.50 +retrieved using CContactItem::CardFields(). Use functions in class
1.51 +CContactItem to add and remove fields to/from the field set.
1.52 +
1.53 +A field set can contain more than one field of the same type, but this is
1.54 +not advisable as it may cause problems when synchronising the contacts database.
1.55 +@publishedAll
1.56 +@released
1.57 +*/
1.58 + {
1.59 + friend class CContactItemField;
1.60 + friend class CContactDatabase;
1.61 + friend class CContactTables;
1.62 + friend class RPplContactTable;
1.63 +#ifdef __SYMBIAN_CNTMODEL_USE_SQLITE__
1.64 + friend class TCntPersistenceUtility;
1.65 +#endif //__SYMBIAN_CNTMODEL_USE_SQLITE__
1.66 +public:
1.67 + IMPORT_C static CContactItemFieldSet* NewL();
1.68 + IMPORT_C static CContactItemFieldSet* NewLC();
1.69 + IMPORT_C ~CContactItemFieldSet();
1.70 + inline const CContactItemField& operator[](TInt aIndex) const;
1.71 + inline CContactItemField& operator[](TInt aIndex);
1.72 + inline TInt Find(TFieldType aFieldType) const; // will only find the first such occurence
1.73 + inline TInt Find(TFieldType aFieldType,TUid aMapping) const;
1.74 + IMPORT_C TInt FindNext(TFieldType aFieldType,TInt aStartPos=KContactFieldSetSearchAll) const;
1.75 + IMPORT_C TInt FindNext(TFieldType aFieldType,TUid aMapping,TInt aStartPos=KContactFieldSetSearchAll) const;
1.76 + inline TInt Count() const;
1.77 + inline void Reset();
1.78 + IMPORT_C void UpdateFieldL(const CContactItemField& aField, TInt aMatchCount);
1.79 + IMPORT_C void UpdateFieldSyncL(const CContactItemField& aField, TInt aMatchCount);
1.80 + IMPORT_C CContactItemFieldSet& AddL(CContactItemField& aField);
1.81 + IMPORT_C void Remove(TInt aIndex);
1.82 + IMPORT_C void InsertL(TInt aIndex,CContactItemField& aField);
1.83 + IMPORT_C void Move(TInt aFrom, TInt aTo);
1.84 + IMPORT_C TStreamId StoreL(CStreamStore& aStore,RWriteStream& aTextStream,CStreamStore& aBlobStore);
1.85 + TStreamId StoreL(CStreamStore& aStore,RWriteStream& aTextStream,CStreamStore& aBlobStore,CContactTables* aTables);
1.86 + IMPORT_C void RestoreL(CStreamStore& aStore, TStreamId anId,CStreamStore* aBlobStore,const CContactItemViewDef& aViewDef,RReadStream& aReadStream);
1.87 + IMPORT_C void RestoreL(CStreamStore& aStore, TStreamId anId,CStreamStore* aBlobStore,const CContactItemViewDef& aViewDef,const CContactItem* aTemplate, HBufC* aTextBuf);
1.88 + TInt FieldText(TFieldType aFieldType, TDes &aText, TInt aStartPosition) const;
1.89 + CArrayFix<TFieldHeader>* ConstructFieldHeaderArrayLC(RWriteStream& aTextStream, CStreamStore& aBlobStore);
1.90 + TInt FieldTypeCount(const CContactItemFieldSet& aSystemTemplateFields, TInt aStartIndex, const CContactItemField& aField) const;
1.91 + TBool ContainsFieldTypeMapping(const CContentType& aBaseFieldContentType, const TFieldType& aContactFieldType) const;
1.92 + void ExternalizeL(RWriteStream& aStream) const;
1.93 + void InternalizeL(RReadStream& aStream);
1.94 +private:
1.95 + CContactItemFieldSet();
1.96 + void ConstructL();
1.97 + void SetFieldId(CContactItemField& aField);
1.98 + const CContactItemField* FindById(TInt aId) const;
1.99 + IMPORT_C TStreamId StoreL(CStreamStore& aStore,const CContactItem* aTemplate,RWriteStream& aStream,CStreamStore& aBlobStore,CContactTables* aTables);
1.100 + void RestoreL(CStreamStore& aStore, TStreamId anId, CStreamStore* aBlobStore,const CContactItemViewDef& aViewDef,const CContactItem* aTemplate,RReadStream& aReadStream,CContactTables* aContactsTable, RArray<TInt>* aEmailIdArray);
1.101 + void RestoreAndAddTemplateL(CStreamStore& aStore, TStreamId aId,CStreamStore* aBlobStore,const CContactItemViewDef& aViewDef,const CContactItem* aTemplate, RReadStream& aReadStream,CContactTables* aContactsTable,RArray<TInt>* aEmailIdArray);
1.102 + TInt MatchTemplateField(const CContentType& aContentType,TUint aUserFlags,TBool &aExactMatch) const;
1.103 + static HBufC* LoadTextStreamLC(RReadStream& aStream);
1.104 + void NonZeroFieldText(TFieldType aFieldType, TDes &aText) const;
1.105 +
1.106 +private:
1.107 + CArrayPtr<CContactItemField>* iFields;
1.108 + };
1.109 +
1.110 +class CContactDatabase;
1.111 +class RCntModel;
1.112 +class CContactItem : public CBase
1.113 +/** The abstract base class for contact cards, templates and groups. All contact
1.114 +items are identified by a contact ID, (TContactItemId), have a last modified
1.115 +date/time and own one or more fields (the field set). Contact items also
1.116 +have an access count and attributes (e.g. hidden). Note that fields in a contact
1.117 +item also have attributes. Attribute values specified in the contact item
1.118 +override those in the contained fields. The access count is a record of the
1.119 +number of objects referencing a contact item. A contact item cannot be fully
1.120 +deleted until its access count is zero.
1.121 +@publishedAll
1.122 +@released
1.123 +*/
1.124 + {
1.125 + friend class CContactCardTemplate;
1.126 + friend class CContactItemPlusGroup;
1.127 + friend class CContactCard;
1.128 + friend class CContactTemplate;
1.129 + friend class CContactGroup;
1.130 + friend class CContactOwnCard;
1.131 + friend class CVCardToContactsAppConverter;
1.132 + friend class CContactICCEntry;
1.133 + friend class RPplContactTable;
1.134 + friend class RPplIdentityTable;
1.135 + friend class RPplPreferencesTable;
1.136 + friend class CPackagerTests; //Comparison test
1.137 + friend class CPackagerCntComparator;
1.138 + friend class CContactDatabase;
1.139 + friend class CPplContactItemManager;
1.140 +public:
1.141 + IMPORT_C ~CContactItem();
1.142 + /** Gets the contact item's type.
1.143 +
1.144 + @return The contact item's type. */
1.145 + virtual TUid Type() const=0;
1.146 + static CContactItem* NewLC(RReadStream& aStream);
1.147 + IMPORT_C static CContactItem* NewLC(TUid aType);
1.148 + IMPORT_C TContactItemId Id() const;
1.149 + IMPORT_C TContactItemId TemplateRefId() const;
1.150 + IMPORT_C TTime LastModified() const;
1.151 + IMPORT_C void SetLastModified(const TTime& aLastModified);
1.152 + IMPORT_C void AddFieldL(CContactItemField& aField);
1.153 + IMPORT_C void RemoveField(TInt aFieldPos);
1.154 + IMPORT_C void InsertFieldL(CContactItemField& aField,TInt aFieldPos);
1.155 + IMPORT_C CContactItemFieldSet& CardFields() const;
1.156 + IMPORT_C void SetHidden(TBool aHidden);
1.157 + IMPORT_C void SetSystem(TBool aSystem);
1.158 + IMPORT_C TBool IsHidden();
1.159 + IMPORT_C TBool IsSystem();
1.160 + IMPORT_C void UpdateFieldSet(CContactItemFieldSet* aNewFieldSet);
1.161 + IMPORT_C void SetDeleted(TBool aDeleted);
1.162 + IMPORT_C TBool IsDeleted() const;
1.163 + IMPORT_C void SetTemplateRefId(TContactItemId aUid);
1.164 + TContactItemId Agent();
1.165 + inline TBool IsDeletable();
1.166 + inline void IncAccessCount();
1.167 + inline void DecAccessCount();
1.168 + inline TInt AccessCount() const;
1.169 + IMPORT_C void SetUidStringL(TDesC& aString);
1.170 + IMPORT_C TPtrC UidStringL(TInt64 aMachineUniqueId) const;
1.171 + TStreamId PopulateStoreL(CStreamStore& aStore, CArrayFix<TFieldHeader>& aFieldHeaderArray) const;
1.172 + void AddLabelFieldL();
1.173 + IMPORT_C void RestoreTemplateFieldsL(const CContactItemFieldSet& aSystemTemplateFields, const CContactItemFieldSet& aTemplateFields, const CContactItemViewDef& aViewDef);
1.174 + void ClearFieldContent();
1.175 + inline TPtrC Guid();
1.176 + virtual void ExternalizeL(RWriteStream& aStream) const;
1.177 + virtual void InternalizeL(RReadStream& aStream);
1.178 +
1.179 +#ifdef __SYMBIAN_CNTMODEL_USE_SQLITE__
1.180 + IMPORT_C void SetId(TContactItemId aId);
1.181 + IMPORT_C TUint32 Attributes() const;
1.182 + IMPORT_C void SetAttributes(TUint32 aAttributes);
1.183 + IMPORT_C void SetAccessCount(TUint32 aAccessCount);
1.184 + IMPORT_C void SetCreationDate(const TTime& aTime);
1.185 +#endif
1.186 +
1.187 +public:
1.188 + /** Contact item's attribute flags
1.189 +
1.190 + These flags can be used to set the various attributes of a contact item. */
1.191 + enum
1.192 + {
1.193 + /** To set the contact item's system attribute. */
1.194 + ESystem=0x01,
1.195 + /** To set the contact item's hidden attribute. */
1.196 + EHidden=0x02,
1.197 + /** To set the contact item's hidden attribute. */
1.198 + ECompressedGuid=0x04,
1.199 + /** To set the contact item's Is deleted attribute. */
1.200 + EDeleted=0x08
1.201 + };
1.202 +protected:
1.203 +private:
1.204 + CContactItem();
1.205 + void ConstructL();
1.206 + void ConstructL(const CContactItem *aTemplate);
1.207 + void MakeUidStringL(TInt64 aMachineUniqueId);
1.208 + IMPORT_C void SetHasCompressedGuid(TBool aCompressed);
1.209 + TBool GuidIsCompressed() const;
1.210 + TInt NumberOfFieldsToStore() const;
1.211 +
1.212 +private:
1.213 + CContactItemFieldSet* iFieldSet;
1.214 + TUint32 iAttributes;
1.215 + TContactItemId iId;
1.216 + TContactItemId iTemplateRefId;
1.217 + TTime iLastModified;
1.218 + TTime iCreationDate;
1.219 + TUint32 iAccessCount;
1.220 + HBufC* iGuid;
1.221 + friend class CContactDatabase;
1.222 + };
1.223 +
1.224 +class CContactItemPlusGroup : public CContactItem
1.225 +/** Abstract base class for CContactGroup, CContactCard and CContactOwnCard.
1.226 +
1.227 +The purpose of this class is to avoid duplication of group functionality
1.228 +in its derived classes.
1.229 +@publishedAll
1.230 +@released
1.231 +*/
1.232 + {
1.233 +public:
1.234 + IMPORT_C const CContactIdArray* GroupsJoined() const;
1.235 + IMPORT_C CContactIdArray* GroupsJoinedLC() const;
1.236 +protected:
1.237 + CContactItemPlusGroup();
1.238 + IMPORT_C ~CContactItemPlusGroup();
1.239 +public:
1.240 + virtual void ExternalizeL(RWriteStream& aStream) const;
1.241 + virtual void InternalizeL(RReadStream& aStream);
1.242 +
1.243 +#ifdef __SYMBIAN_CNTMODEL_USE_SQLITE__
1.244 + IMPORT_C void ResetGroups();
1.245 + IMPORT_C void SetGroups(CContactIdArray* aGroups);
1.246 +#endif
1.247 +
1.248 +private:
1.249 + CContactIdArray* iGroups;
1.250 + friend class CContactDatabase;
1.251 + friend class RPplLookupGroupsTable;
1.252 + friend class RPplGroupMembershipTable;
1.253 + };
1.254 +
1.255 +class CContactGroup : public CContactItemPlusGroup
1.256 +/** A contact group.
1.257 +
1.258 +A contact group is a contact item which holds a set of associated contact
1.259 +item IDs. The members of the group may be contact cards, own cards, or even
1.260 +other groups. The group has a label which identifies the group to users, e.g.
1.261 +"family", or "colleagues". The type of a contact group is KUidContactGroup,
1.262 +as returned by Type().
1.263 +
1.264 +Objects of this class are constructed using CContactDatabase::CreateContactGroupL()
1.265 +or CreateContactGroupLC(). These functions create the group, optionally with
1.266 +a label, add it to the database, and return a pointer to it.
1.267 +
1.268 +To create an association between a card and a group, use CContactDatabase::AddContactToGroupL()
1.269 +and to remove the association, use RemoveContactFromGroupL(). To find out
1.270 +which groups a card belongs to, use CContactCard::GroupsJoinedLC() or CContactOwnCard::GroupsJoinedLC().
1.271 +
1.272 +The function CContactDatabase::GetGroupIdListL() may be used to retrieve a
1.273 +list of IDs for all groups in the database.
1.274 +@publishedAll
1.275 +@released
1.276 +*/
1.277 + {
1.278 +public:
1.279 + IMPORT_C static CContactGroup* NewL();
1.280 + IMPORT_C static CContactGroup* NewLC();
1.281 + IMPORT_C ~CContactGroup();
1.282 +public: // from CContactItem
1.283 + IMPORT_C TUid Type() const;
1.284 +public:
1.285 + // default sorted item array is ascending
1.286 + IMPORT_C CContactIdArray* ItemsContainedLC() const;
1.287 + IMPORT_C const CContactIdArray* ItemsContained() const;
1.288 + IMPORT_C TBool IsSystem() const;
1.289 + IMPORT_C void SetSystem(TBool aSystem);
1.290 + IMPORT_C TBool ContainsItem(TContactItemId aContactId);
1.291 + IMPORT_C void SetGroupLabelL(const TDesC& aLabel);
1.292 + IMPORT_C TPtrC GetGroupLabelL();
1.293 + IMPORT_C TBool HasItemLabelField();
1.294 + IMPORT_C CContactIdArray* GroupsJoinedLC() const;
1.295 +//
1.296 + //IMPORT_C void ReservedFunction1();
1.297 + IMPORT_C void AddContactL(TContactItemId aContactId);
1.298 + //IMPORT_C void ReservedFunction2();
1.299 + IMPORT_C void RemoveContactL(TContactItemId aContactId);
1.300 + virtual void ExternalizeL(RWriteStream& aStream) const;
1.301 + virtual void InternalizeL(RReadStream& aStream);
1.302 +
1.303 +#ifdef __SYMBIAN_CNTMODEL_USE_SQLITE__
1.304 + IMPORT_C void ResetItems();
1.305 + IMPORT_C void SetItems(CContactIdArray* aItems);
1.306 +#endif
1.307 +
1.308 +private:
1.309 + CContactGroup();
1.310 +private:
1.311 + CContactIdArray* iItems;
1.312 + friend class CContactDatabase;
1.313 + friend class RPplGroupMembershipTable;
1.314 + };
1.315 +
1.316 +class CContactCardTemplate : public CContactItem
1.317 +/** A contact card template.
1.318 +
1.319 +This is a contact item containing a set of fields on which new contact items can
1.320 +be based. Templates have a label which is a string which identifies the template
1.321 +to a user. For instance, 'work template' could indicate a template used
1.322 +to create contact cards in the style of a work colleague. Contact card templates
1.323 +have a type of KUidContactCardTemplate, as returned by Type().
1.324 +
1.325 +Objects of this class cannot be constructed directly because its constructors
1.326 +are protected. Instead, use either CContactDatabase::CreateContactCardTemplateL()
1.327 +or CreateContactCardTemplateLC(). These functions create a contact card template,
1.328 +add it to the database, and return a pointer to it.
1.329 +
1.330 +The function CContactDatabase::GetCardTemplateIdListL() gets a list of the
1.331 +IDs of all contact card templates in the database.
1.332 +@publishedAll
1.333 +@released
1.334 +*/
1.335 + {
1.336 + friend class CContactDatabase;
1.337 + friend class CContactTables;
1.338 + friend class RPplContactTable;
1.339 + friend class CContactItem;
1.340 +public:
1.341 + IMPORT_C void SetTemplateLabelL(const TDesC& aLabel);
1.342 + IMPORT_C TPtrC GetTemplateLabelL();
1.343 +protected:
1.344 + IMPORT_C static CContactCardTemplate* NewL();
1.345 + IMPORT_C static CContactCardTemplate* NewLC();
1.346 + IMPORT_C static CContactCardTemplate* NewL(const CContactItem *aTemplate);
1.347 + IMPORT_C static CContactCardTemplate* NewLC(const CContactItem *aTemplate);
1.348 + IMPORT_C TBool HasItemLabelField();
1.349 +//
1.350 +/**
1.351 + Intended usage: Reserved to preserve future BC */
1.352 + IMPORT_C void ReservedFunction1();
1.353 +/**
1.354 + Intended usage: Reserved to preserve future BC */
1.355 + IMPORT_C void ReservedFunction2();
1.356 +
1.357 +protected: // from CContactItem
1.358 + IMPORT_C TUid Type() const;
1.359 +private:
1.360 + CContactCardTemplate();
1.361 + };
1.362 +
1.363 +class CContactCard : public CContactItemPlusGroup
1.364 +/** A contact card.
1.365 +
1.366 +Implements the Type() function declared in class CContactItem.
1.367 +Contact cards may optionally be constructed from a template.
1.368 +@publishedAll
1.369 +@released
1.370 +*/
1.371 + {
1.372 +public:
1.373 + IMPORT_C ~CContactCard();
1.374 + IMPORT_C static CContactCard* NewL();
1.375 + IMPORT_C static CContactCard* NewLC();
1.376 + IMPORT_C static CContactCard* NewL(const CContactItem *aTemplate);
1.377 + IMPORT_C static CContactCard* NewLC(const CContactItem *aTemplate);
1.378 +public: // from CContactItem
1.379 + IMPORT_C TUid Type() const;
1.380 +public:
1.381 + IMPORT_C CContactIdArray* GroupsJoinedLC() const;
1.382 +private:
1.383 + CContactCard();
1.384 +private:
1.385 + friend class CContactDatabase;
1.386 + };
1.387 +
1.388 +class CContactOwnCard : public CContactItemPlusGroup
1.389 +/** Own card.
1.390 +
1.391 +An own card is a contact card which contains information about the device's
1.392 +owner. This can be sent to another compatible electronic device as a vCard.
1.393 +The contact database recognises a single own card, referred to as the
1.394 +current own card; its ID is returned by CContactDatabase::OwnCardId(). Like
1.395 +a contact card, an own card can be a member of one or more contact card groups.
1.396 +The own card type is identified by a UID of KUidContactOwnCard.
1.397 +
1.398 +Own cards can be constructed using either CContactDatabase::CreateOwnCardLC()
1.399 +or CreateOwnCardL(). These functions create an own card, based on the system
1.400 +template, add it to the database, set it as the database's current own card
1.401 +and return a pointer to it. To change the database's current own card, use
1.402 +CContactDatabase::SetOwnCardL().
1.403 +@publishedAll
1.404 +@released
1.405 +*/
1.406 + {
1.407 +public:
1.408 + IMPORT_C ~CContactOwnCard();
1.409 + IMPORT_C static CContactOwnCard* NewL();
1.410 + IMPORT_C static CContactOwnCard* NewLC();
1.411 + IMPORT_C static CContactOwnCard* NewL(const CContactItem *aTemplate);
1.412 + IMPORT_C static CContactOwnCard* NewLC(const CContactItem *aTemplate);
1.413 +public: // from CContactItem
1.414 + IMPORT_C TUid Type() const;
1.415 +public:
1.416 + IMPORT_C CContactIdArray* GroupsJoinedLC() const;
1.417 +private:
1.418 + CContactOwnCard();
1.419 +private:
1.420 + friend class CContactDatabase;
1.421 + };
1.422 +
1.423 +class CContactTemplate : public CContactItem
1.424 +/** A contact item template.
1.425 +
1.426 +This is a contact item which is used to seed the initial field set for
1.427 +other contact items.
1.428 +
1.429 +Non-system (i.e. user-defined) templates are implemented
1.430 +by the CContactCardTemplate class. CContactCardTemplate should be
1.431 +used in preference to CContactTemplate.
1.432 +@publishedAll
1.433 +@released
1.434 +*/
1.435 + {
1.436 +public:
1.437 + IMPORT_C static CContactTemplate* NewL();
1.438 + IMPORT_C static CContactTemplate* NewLC();
1.439 + IMPORT_C static CContactTemplate* NewL(const CContactItem *aTemplate);
1.440 + IMPORT_C static CContactTemplate* NewLC(const CContactItem *aTemplate);
1.441 +public: // from CContactItem
1.442 + IMPORT_C TUid Type() const;
1.443 +private:
1.444 + CContactTemplate();
1.445 + };
1.446 +
1.447 +
1.448 +class CContactICCEntry : public CContactItemPlusGroup
1.449 +/** A contact ICC entry.
1.450 +@publishedAll
1.451 +@released
1.452 +*/
1.453 + {
1.454 +public:
1.455 + IMPORT_C ~CContactICCEntry();
1.456 + IMPORT_C static CContactICCEntry* NewL(const CContactItem& aTemplate);
1.457 + static CContactICCEntry* NewL();
1.458 +public: //from CContactItem
1.459 + TUid Type() const;
1.460 +private:
1.461 + CContactICCEntry();
1.462 + };
1.463 +
1.464 +
1.465 +class ContactGuid
1.466 +/** A globally unique identifier enquiry utility.
1.467 +
1.468 +Each contact item has a unique identifier, stored as a descriptor. It is
1.469 +referred to as the 'UID string'. This is a combination of the unique
1.470 +identifier of the database in which the contact item was created, the
1.471 +contact item ID and the date/time of the contact item's creation. ContactGuid
1.472 +provides a single static exported function to enquire whether an item was
1.473 +created in a specified database.
1.474 +@publishedAll
1.475 +@released
1.476 +*/
1.477 + {
1.478 +public:
1.479 + IMPORT_C static TContactItemId IsLocalContactUidString(const TDesC& aString, TInt64 aMachineUniqueId);
1.480 + IMPORT_C static TBool GetCreationDate(TDes& aString, TInt64 aMachineUniqueId);
1.481 + static HBufC* CreateGuidLC(const TDesC& aCreationDate,TContactItemId aId, TInt64 aMachineUniqueId);
1.482 + static HBufC* CreateGuidLC(const TTime& aCreationDate,TContactItemId aId, TInt64 aMachineUniqueId);
1.483 + static HBufC* CreateGuidLC(TContactItemId aId, TInt64 aMachineUniqueId);
1.484 + };
1.485 +
1.486 +inline const CContactItemField& CContactItemFieldSet::operator[](TInt aIndex) const
1.487 +/** Gets the field located at a specified position in the field set.
1.488 +
1.489 +@param aIndex The position of the field in the field set. This is relative to zero.
1.490 +It must be non-negative and less than the number of objects in the array, otherwise
1.491 +the operator raises a panic.
1.492 +
1.493 +@return A const reference to an element in the array. */
1.494 + { return *(*iFields)[aIndex]; }
1.495 +
1.496 +inline CContactItemField& CContactItemFieldSet::operator[](TInt aIndex)
1.497 +/** Gets the field located at a specified position in the field set.
1.498 +
1.499 +@param aIndex The position of the field in the field set. This is relative to zero.
1.500 +It must be non-negative and less than the number of objects in the array, otherwise
1.501 +the operator raises a panic.
1.502 +
1.503 +@return A non-const reference to an element in the array. */
1.504 + { return *(*iFields)[aIndex]; }
1.505 +
1.506 +inline TInt CContactItemFieldSet::Find(TFieldType aFieldType) const
1.507 +/** Finds the first field in the field set with the specified field type.
1.508 +
1.509 +@param aFieldType The field type of interest.
1.510 +@return If found, the index of the field within the field set, or KErrNotFound
1.511 +if not found. */
1.512 + { return FindNext(aFieldType,KContactFieldSetSearchAll); }
1.513 +
1.514 +inline TInt CContactItemFieldSet::Find(TFieldType aFieldType,TUid aMapping) const
1.515 +/** Finds the first field in the field set containing both the content type mapping
1.516 +and the field type specified.
1.517 +
1.518 +@param aFieldType The field type of interest.
1.519 +@param aMapping The content type mapping of interest.
1.520 +@return If found, the index of the field within the field set, or KErrNotFound
1.521 +if not found. */
1.522 + { return FindNext(aFieldType,aMapping,KContactFieldSetSearchAll); }
1.523 +
1.524 +inline TInt CContactItemFieldSet::Count() const
1.525 +/** Gets the number of fields in the field set.
1.526 +
1.527 +@return The number of fields in the field set. */
1.528 + { return iFields->Count(); }
1.529 +
1.530 +inline void CContactItemFieldSet::Reset()
1.531 +/** Deletes all fields in the field set. */
1.532 + { iFields->ResetAndDestroy(); }
1.533 +
1.534 +inline TBool CContactItem::IsDeletable()
1.535 +/** Tests whether the contact item is deletable.
1.536 +
1.537 +This is true if the item's access count is zero.
1.538 +
1.539 +@return ETrue if deletable, EFalse if not deletable. */
1.540 + {return (iAccessCount == 0);}
1.541 +
1.542 +inline void CContactItem::IncAccessCount()
1.543 +/** Increments the contact item's access count. */
1.544 + {iAccessCount++;}
1.545 +
1.546 +inline void CContactItem::DecAccessCount()
1.547 +/** Decrements the contact item's access count. */
1.548 + {if(iAccessCount) iAccessCount--;}
1.549 +
1.550 +inline TInt CContactItem::AccessCount() const
1.551 +/** Gets the contact item's access count.
1.552 +
1.553 +@return The item's access count. */
1.554 + {return(iAccessCount);}
1.555 +
1.556 +inline TPtrC CContactItem::Guid()
1.557 +/** Accessor function for Contact Guid.
1.558 + * This is used to cache contact items that are added during a sync.
1.559 + @return Guid */
1.560 + { return iGuid ? *iGuid : TPtrC(KNullDesC); }
1.561 +
1.562 +#endif