epoc32/include/app/cntfield.h
author William Roberts <williamr@symbian.org>
Wed, 31 Mar 2010 12:27:01 +0100
branchSymbian2
changeset 3 e1b950c65cb4
parent 2 epoc32/include/cntfield.h@2fe1408b6811
child 4 837f303aceeb
permissions -rw-r--r--
Attempt to represent the S^2->S^3 header reorganisation as a series of "hg rename" operations
     1 // Copyright (c) 1997-2009 Nokia Corporation and/or its subsidiary(-ies).
     2 // All rights reserved.
     3 // This component and the accompanying materials are made available
     4 // 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
     5 // which accompanies this distribution, and is available
     6 // at the URL "http://www.symbianfoundation.org/legal/licencesv10.html".
     7 //
     8 // Initial Contributors:
     9 // Nokia Corporation - initial contribution.
    10 //
    11 // Contributors:
    12 //
    13 // Description:
    14 // Persistence layer exports
    15 // 
    16 //
    17 
    18 
    19 
    20 #if !defined(__CNTFIELD_H__)
    21 #define __CNTFIELD_H__
    22 
    23 #include <cntdef.h>
    24 
    25 
    26 
    27 const TInt KNullFieldId=-1;
    28 
    29 //const TInt KIntContactFieldHint???=0x01;
    30 const TInt KIntContactHintIsPhone=0x02;
    31 const TInt KIntContactHintIsMsg=0x04;
    32 const TInt KIntContactHintIsCompanyName=0x08;
    33 const TInt KIntContactHintIsFamilyName=0x10;
    34 const TInt KIntContactHintIsGivenName=0x20;
    35 const TInt KIntContactHintIsAddress=0x40;
    36 const TInt KIntContactHintIsAdditionalName=0x80;
    37 const TInt KIntContactHintIsSuffixName=0x100;
    38 const TInt KIntContactHintIsPrefixName=0x200;
    39 const TInt KIntContactHintStorageInline=0x400;
    40 const TInt KIntContactHintIsEmail=0x4000;
    41 const TInt KIntContactHintIsPronunciation=0x800;
    42 const TInt KIntContactHintIsCompanyNamePronunciation=KIntContactHintIsPronunciation|KIntContactHintIsCompanyName;
    43 const TInt KIntContactHintIsGivenNamePronunciation=KIntContactHintIsPronunciation|KIntContactHintIsGivenName;
    44 const TInt KIntContactHintIsFamilyNamePronunciation=KIntContactHintIsPronunciation|KIntContactHintIsFamilyName;
    45 
    46 const TInt KHintTypeMask = 0x1FFFFF;
    47 
    48 #ifdef __SYMBIAN_CNTMODEL_USE_SQLITE__
    49 const TInt KHintAdditionalMask    = 0x7F000000; //Number of additional type ids.
    50 const TInt KHintVCardMappingMask  = 0x80000000; //bit flag to show if there is a vCard mapping uid.
    51 const TInt KHintTemplateFieldMask = 0x7FFFFFFF; //Template field mask in low hint value.
    52 
    53 const TInt KHintAdditionalMaskShift = 24;
    54 
    55 #else //_SYMBIAN_USE_SQLITE__
    56 
    57 const TInt KHintAdditionalMask = 0x200000;
    58 const TInt KHintIdMask = 0xFFC00000;
    59 
    60 #endif //_SYMBIAN_USE_SQLITE__
    61 
    62 
    63 class RWriteStream;
    64 class RReadStream;
    65 class CContactFieldStorage;
    66 class CContactTextField;
    67 class CContactStoreField;
    68 class CContactAgentField;
    69 class CContactDateField;
    70 class TFieldHeader;
    71 class CContactItemField;
    72 class CContactItemFieldDef;
    73 class CContactItemFieldSet;
    74 class CContactItem;
    75 
    76 class CContentType : public CBase
    77 /** The content type for a contact item field. 
    78 
    79 The content type identifies the field's type and the vCard property which 
    80 the field maps to. It is owned by the field. Field types are defined as UIDs 
    81 in cntdef.h.
    82 
    83 The vCard mapping is optional. It should be specified if the field type alone 
    84 is not enough to identify the mapping. The possible values for the vCard 
    85 mapping are defined as UIDs in cntdef.h.
    86 
    87 Each field is uniquely identified by the combination of UIDs contained in 
    88 the content type. 
    89 @publishedAll
    90 @released
    91 */
    92     {
    93 public:
    94     IMPORT_C ~CContentType();
    95 	IMPORT_C static CContentType* NewL();
    96 	IMPORT_C static CContentType* NewL(TFieldType aFieldType,TUid aMapping=KNullUid);
    97 	IMPORT_C static CContentType* NewL(const CContentType &aContentType);
    98 	static CContentType* NewLC(RReadStream& aStream);
    99 	IMPORT_C void SetMapping(TUid aMapping);
   100 	IMPORT_C void AddFieldTypeL(TFieldType aFieldType);
   101 	IMPORT_C void RemoveFieldType(TFieldType aFieldType);
   102     IMPORT_C TFieldType FieldType(TInt aIndex) const;
   103     IMPORT_C TInt FieldTypeCount() const;
   104     IMPORT_C TUid Mapping() const;
   105 	IMPORT_C TBool ContainsFieldType(TFieldType aFieldType) const;
   106 	IMPORT_C TBool SupportsMultipleLines() const;
   107 	IMPORT_C TBool operator==(const CContentType &aType) const;
   108 	IMPORT_C TBool IsEqualForSyncUpdate(const CContentType& aType) const;
   109 	IMPORT_C TBool IsEqual(const CContentType& aType) const;
   110 	void Reset(); 
   111 	void InternalizeAdditionalUidsL(TInt aCount,RReadStream& aStream);
   112 	void ExternalizeL(RWriteStream& aStream) const;
   113 	void InternalizeL(RReadStream& aStream);		
   114 private:
   115     CContentType();
   116 	CContentType(TUid aMapping);
   117 	void ConstructL();
   118 	void CloneL(const CContentType &aContentType);
   119 private:
   120     TUid iMapping;
   121 	CArrayFix<TUid>* iFieldTypes;
   122     };
   123 
   124 class CContactItemField : public CBase
   125 /** A field in a contact item.
   126 
   127 Fields are grouped into a field set (CContactItemFieldSet), which is owned by 
   128 the contact item.
   129 
   130 The contact item field stores the field data. The data may be text, a date/time 
   131 value, or an agent, as indicated by the storage type (TStorageType). The storage 
   132 type is also owned by the field. Note that numeric field data is not supported. 
   133 All numbers, for instance telephone or fax numbers are stored as text.
   134 
   135 Fields also have a content type, attributes and a label. The label is a string 
   136 which identifies the field to a user e.g. First name, Last name.
   137 
   138 The following attributes are supported: 
   139 
   140 - hidden: the field is not displayed if the view definition masks hidden 
   141 fields
   142 
   143 - disabled: the field cannot be deleted from the original template and thus 
   144 is marked as disabled
   145 
   146 - read only: the field cannot be written to
   147 
   148 - synchronise: used by Connectivity applications; set by default for all 
   149 contact item fields
   150 
   151 - user added: the field was added by the user and was not taken from the 
   152 template
   153 
   154 - template: indicates that the field is part of a template. Template fields 
   155 differ from other fields in that they are persisted when they do not contain 
   156 any data.
   157 
   158 - speed dial: the field contains a telephone number which maps to one of 
   159 the nine possible speed dial positions.
   160 
   161 These attributes can be set using member functions of this class, but they 
   162 are normally set automatically by other functions, for instance when 
   163 setting a speed dial field, CContactDatabase automatically sets the field's 
   164 speed dial attribute. 
   165 @publishedAll
   166 @released
   167 */
   168 	{
   169 private:
   170 	friend class TFieldHeader;
   171 	friend class CContactItemFieldSet;
   172 	friend class CContactDatabase;      
   173 	friend class CContactTables;
   174 	friend class RPplContactTable;
   175 	friend class CPackagerTests;
   176 	class THint
   177 	/**
   178 	@internalComponent
   179 	@released
   180 	*/
   181 		{
   182 	public:
   183 		THint();
   184 		THint(TInt aValue);
   185 		TBool operator==(const THint& aHint) const;
   186 		TBool operator!=(const THint& aHint) const;
   187 		TInt  HintType() const;
   188 		inline void SetIsMatchAll();
   189 		inline void SetIsPhone();
   190 		inline void SetIsMsg();
   191 		inline void SetIsCompanyName();
   192 		inline void SetIsFamilyName();
   193 		inline void SetIsGivenName();
   194 		inline void SetIsCompanyNamePronunciation();
   195 		inline void SetIsFamilyNamePronunciation();
   196 		inline void SetIsGivenNamePronunciation();
   197 		inline void SetIsAddress();
   198 		inline void SetIsAdditionalName();
   199 		inline void SetIsSuffixName();
   200 		inline void SetIsPrefixName();
   201 		inline void SetStorageIsInline();
   202 		inline void SetIsEmail();
   203 		inline TBool IsMatchAll() const;
   204 		inline TBool IsDefault() const;
   205 		inline TBool IsPhone() const;
   206 		inline TBool IsMsg() const;
   207 		inline TBool IsCompanyName() const;
   208 		inline TBool IsFamilyName() const;
   209 		inline TBool IsGivenName() const;
   210 		inline TBool IsCompanyNamePronunciation() const;
   211 		inline TBool IsFamilyNamePronunciation() const;
   212 		inline TBool IsGivenNamePronunciation() const;
   213 		inline TBool IsAddress() const;
   214 		inline TBool IsAdditionalName() const;
   215 		inline TBool IsSuffixName() const;
   216 		inline TBool IsPrefixName() const;
   217 		inline TBool IsStorageInline() const;
   218 		inline TBool IsEmail() const;
   219 		inline TBool Contains(const THint& aHint) const;
   220 		
   221 #ifndef __SYMBIAN_CNTMODEL_USE_SQLITE__
   222 		inline void SetHasAdditionalUids();
   223 		TBool HasAdditionalUids() const;
   224 		
   225 		TInt FieldId() const;
   226 		void SetFieldId(TInt aId);
   227 		
   228 #else //__SYMBIAN_CNTMODEL_USE_SQLITE__
   229         TInt  TemplateFieldId() const;
   230         void  SetTemplateFieldId(TInt aTemplateFieldId);
   231         
   232         inline void SetHasVCardMappingUid();
   233         inline TBool HasVCardMappingUid() const;
   234         
   235         inline TInt  AdditionalUidsNum() const;
   236         inline void  SetAdditionalUidsNum(TInt aNumber);
   237 #endif //__SYMBIAN_CNTMODEL_USE_SQLITE__		
   238 	public:
   239 		TInt iHintValue;
   240 
   241 		};
   242 		
   243 public:
   244 	IMPORT_C static CContactItemField* NewLC();
   245 	IMPORT_C static CContactItemField* NewL(TStorageType aType);
   246 	IMPORT_C static CContactItemField* NewLC(TStorageType aType);
   247 	IMPORT_C static CContactItemField* NewL(TStorageType aType, TFieldType aFieldType);
   248 	IMPORT_C static CContactItemField* NewLC(TStorageType aType, TFieldType aFieldType);
   249 	IMPORT_C static CContactItemField* NewL(const CContactItemField &aField);
   250 	IMPORT_C static CContactItemField* NewLC(const CContactItemField &aField);
   251 	IMPORT_C static CContactItemField* NewL(TStorageType aType, const CContentType &aContentType);
   252 	IMPORT_C static CContactItemField* NewLC(TStorageType aType, const CContentType &aContentType);
   253 	IMPORT_C ~CContactItemField();
   254 
   255 	IMPORT_C TStorageType StorageType() const;
   256 	IMPORT_C const CContentType &ContentType() const;
   257 	inline TBool IsHidden() const;
   258 	inline TBool IsReadOnly() const;
   259 	inline TBool IsDisabled() const;
   260 	inline TBool IsTemplate() const;
   261 	inline TBool IsPrivate() const;
   262 	inline TBool IsSpeedDial() const;
   263 	inline TBool DoSynchronize() const;
   264 	inline TBool OverRidesLabel() const;
   265 	inline TBool HasExtraStream() const;
   266 	inline TBool UsesTemplateTypes() const;
   267 	inline TBool LabelUnspecified() const;
   268 	inline TBool UserAddedField() const;
   269 	inline TBool IsCustomFilterable() const;
   270 	IMPORT_C void SetHintType(TInt aType);
   271 	IMPORT_C TPtrC Label() const;
   272 	IMPORT_C void ResetStore();
   273 	IMPORT_C CContactFieldStorage* Storage() const;
   274 	IMPORT_C CContactTextField * TextStorage() const;
   275 	IMPORT_C CContactStoreField * StoreStorage() const;
   276 	IMPORT_C CContactAgentField * AgentStorage() const;
   277 	IMPORT_C CContactDateField * DateTimeStorage() const;
   278 	IMPORT_C void AddFieldTypeL(TFieldType aFieldType);
   279 	IMPORT_C void RemoveFieldType(TFieldType aFieldType);
   280 	IMPORT_C void SetMapping(TUid aMapping);
   281 	IMPORT_C void SetHidden(TBool aHidden);
   282 	IMPORT_C void SetReadOnly(TBool aReadOnly);
   283 	IMPORT_C void SetSynchronize(TBool aSynchronize);
   284 	IMPORT_C void SetDisabled(TBool aDisabled);
   285 	IMPORT_C void SetLabelL(const TDesC& aLabel);
   286 	IMPORT_C void SetLabel(HBufC* aLabel);
   287 	IMPORT_C void SetUserAddedField(TBool aUserAddedField);
   288 	IMPORT_C void SetTemplateField(TBool aTemplateField);
   289 	IMPORT_C void SetPrivate(TBool aTemplateField);
   290 	IMPORT_C void SetSpeedDial(TBool aSpeedDialField);
   291 	IMPORT_C void SetId(TInt aId);
   292 	IMPORT_C TInt Id() const;
   293 	IMPORT_C TUint UserFlags() const;
   294 	IMPORT_C void SetUserFlags(TUint aFlags);
   295 	IMPORT_C static TBool IsValidLabel(const TDesC& aLabel,TInt& aInvalidPos);
   296 	IMPORT_C TBool IsTemplateLabelField() const;
   297 	IMPORT_C void GetFieldText(TDes &aText) const;
   298 	IMPORT_C void RestoreHeaderL(RReadStream& aStream, const CContactItemFieldSet *aSystemTemplateFields);
   299 	IMPORT_C TStreamId RestoreFieldTypesL(RReadStream &aRootStream, const CContactItemFieldSet *aSystemTemplateFields);
   300 	IMPORT_C void RestoreTextL(HBufC *aTextStream,TInt aTextFieldIndex);
   301 	IMPORT_C TBool RestoreIfMatchL(RReadStream& aStream,const CContactItemFieldDef *aFieldDef, const CContactItemFieldSet *aSystemTemplateFields,HBufC *aTextStream,TInt aTextIndex);
   302 
   303 public:
   304 	IMPORT_C void SetCustomFilterable(EContactFieldFlags aContactFilterType);
   305 	IMPORT_C void Reset();
   306 	void SetUsesTemplateTypes(TBool aUsesTemplateTypes);
   307 	void SetOverRidesLabel(TBool aValue);
   308 	TInt TemplateFieldId() const;
   309 	void SetDeleted(TBool aDeleted);
   310 	inline TBool IsDeleted() const;
   311 	void CopyStorageL(const CContactItemField &aField);
   312 	void UpdateFieldFlags(const CContactItemFieldSet& aTemplateFieldSet);
   313 	void PopulateStoreL(RStoreWriteStream& aRootStream, TInt aCount, CArrayFix<TFieldHeader>& aFieldHeaderArray) const;
   314 	void PrepareFieldAsTemplateL(CContactItemFieldSet& aSystemTemplateFieldSet);
   315 	IMPORT_C TBool HasCustomFilter(EContactFieldFlags& contactFieldFlag) const;
   316 	TBool RestoreIfMatchL(RReadStream& aStream,TFieldType aFieldType, const CContactItemFieldSet *aSystemTemplateFields,HBufC *aTextStream,TInt aTextIndex);
   317 	void ExternalizeL(RWriteStream& aStream) const;
   318 	void InternalizeL(RReadStream& aStream);		
   319 	
   320 protected:
   321 	void UsesTemplateData(TInt aTemplateFieldId);
   322 private:
   323 	void UsesTemplateLabel();
   324 	void SetLabelUnspecified(TBool aUnspecified);
   325 	const CContentType &TemplateContentType(const CContactItemFieldSet &aSystemTemplateFields) const;
   326 	TFieldHeader StoreL(RWriteStream& aTextStream,CStreamStore& aBlobStore,TInt aTextFieldIndex);
   327 	TStreamId StoreAdditionalUidsL(CStreamStore& aStore,TStreamId aId, CArrayFixFlat<TUid> *aAdditionalFields);
   328   	TStreamId StoreDataL(CStreamStore& aStore);
   329 
   330    	void RestoreL(CStreamStore& aStore,RReadStream& aStream);
   331     void RestoreDataL(CStreamStore& aStore,TStreamId aId);
   332 	
   333  	TStreamId RestoreHintL(CStreamStore& aStore,RReadStream& aStream);
   334 	TBool AddFieldToHint(TFieldType aFieldType, CContactItemField::THint &aHint) const;
   335 	void MapHintsToFieldTypesL(THint aHint);
   336 	CContactItemField();
   337 	CContactItemField(TStorageType aType);
   338 	void CloneL(const CContactItemField &aField);
   339 	void ConstructStorageL();
   340 private:
   341 	enum {EUserMaskShift=4};
   342 	enum // er5 hard coded enum most of which have been used but not documented ;o(
   343 		{
   344 		EHidden				=0x00000001,
   345 		EReadOnly			=0x00000002,
   346 		ESynchronize		=0x00000004,
   347 		EDisabled			=0x00000008,
   348 		/* 0x00000010,-> 0x00000080 are used for 
   349 			the user defined attribs / categories like work /
   350 			Personal / Other / None - used in er5 UI */
   351 		EUserMask			=0x000000F0,
   352 		ETemplateMask		=EUserMask|ESynchronize|EReadOnly|EHidden,
   353 		EOverRidesLabel		=0x00000100,
   354 		EUsesTemplateData	=0x00000200,
   355 		EUserAddedField		=0x00000400,
   356 		ETemplate			=0x00000800,
   357 		/* 0x00001000,-> 0x0000F000 are used for 
   358 			the storage type of the contact field */
   359 		ELabelUnspecified	=0x40000000,
   360 		EDeleted			=0x80000000
   361 		};
   362 	enum 
   363 		// new extended enum to allow cntmodel to have
   364 		// more attributes per field
   365 		{
   366 		EPrivate			=0x00000001,
   367 		ESpeedDial			=0x00000002,
   368 		EUserDefinedFilter	=0x00000004,
   369 		EUserDefinedFilter1 =0x00000008,
   370 		EUserDefinedFilter2	=0x00000010,
   371 		EUserDefinedFilter3	=0x00000020,
   372 		EUserDefinedFilter4	=0x00000040
   373 		};
   374 	
   375 private:
   376 	CContentType *iContentType;
   377 	TStorageType iStorageType;
   378 	HBufC* iLabel;
   379 	TInt iId;
   380 	TUint32 iAttributes;
   381 	TUint32 iExtendedAttributes;
   382 	CContactFieldStorage* iStorage;
   383 	TInt iTemplateFieldId;
   384 	};
   385 
   386 class CContactItemFieldDef : public CArrayFixFlat<TUid>
   387 /** A field definition. 
   388 
   389 This is an array of field types. Field definitions are used by 
   390 CContactDatabase to specify a subset of fields when searching.
   391 
   392 The CContactItemFieldDef class is derived from CArrayFixFlat<TUid> so all 
   393 relevant functions can be used, e.g. to add and remove elements. It adds no 
   394 functions other than a constructor. 
   395 @publishedAll
   396 @released
   397 */
   398 	{
   399 public:
   400 	inline CContactItemFieldDef() : CArrayFixFlat<TUid>(8) 
   401 	/** Constructs the CContactItemFieldDef object, with an array granularity of 8. */
   402 		{};
   403 	};
   404 
   405 class TContactFieldAtts
   406 /**
   407 @internalComponent
   408 @released
   409 */
   410 	{
   411 public:
   412 	inline TContactFieldAtts() : iStorage(0)
   413 		{};
   414 
   415 	void SetAttribs(TUint32 aAttribs);
   416 	void SetExtendedAttribs(TUint32 aExtendedAttribs);
   417 	void SetType(TStorageType aType);
   418 	TUint32 Attribs() const;
   419 	TUint32 ExtendedAttribs() const;
   420 	TStorageType Type() const;
   421 	void InternalizeL(RReadStream& aStream);
   422 	void ExternalizeL(RWriteStream& aStream) const;
   423 
   424 #ifndef __SYMBIAN_CNTMODEL_USE_SQLITE__	
   425 	TInt Count() const;
   426 	void SetCount(TInt aCount);
   427 	TInt TemplateFieldId() const;
   428 	void SetTemplateFieldId(TInt aId);
   429 #endif //__SYMBIAN_CNTMODEL_USE_SQLITE__
   430 
   431 		
   432 private:
   433 	TUint32 iStorage;
   434 	
   435 #ifndef __SYMBIAN_CNTMODEL_USE_SQLITE__	
   436 	TUint32 iExtendedAttribs;
   437 #endif //__SYMBIAN_CNTMODEL_USE_SQLITE__
   438 	};
   439 
   440 
   441 class TFieldHeader
   442 /**
   443 @internalComponent
   444 @released
   445 */
   446 #ifdef __SYMBIAN_CNTMODEL_USE_SQLITE__
   447 
   448 	{
   449 public:
   450     TFieldHeader();
   451 	TFieldHeader(TContactFieldAtts aAtts, TUint32 aFieldUid, TStreamId aId);
   452 	
   453 	inline TContactFieldAtts FieldAtts() const;
   454 	inline void SetFieldAtts(TContactFieldAtts aAtts);
   455 	
   456 	inline TInt FieldId() const;
   457     inline void SetFieldId(TInt aId);
   458     
   459     inline TStreamId StreamId() const;
   460     inline void SetStreamId(TStreamId aId);
   461     
   462 private:
   463 	TContactFieldAtts iAtts;
   464     TInt      iFieldUid;
   465 	TStreamId iStreamId;
   466 	};
   467 
   468 #else //__SYMBIAN_CNTMODEL_USE_SQLITE__
   469 
   470 	{
   471 public:
   472 	inline TFieldHeader(TStreamId aId,TContactFieldAtts aAtts);
   473 	
   474 public:
   475 	TStreamId iStreamId;
   476 	TContactFieldAtts iAtts;
   477 	};
   478 
   479 inline TFieldHeader::TFieldHeader(TStreamId aId,TContactFieldAtts aAtts)
   480 	{ iStreamId=aId; iAtts=aAtts; }
   481 #endif //__SYMBIAN_CNTMODEL_USE_SQLITE__
   482 
   483 inline TBool CContactItemField::IsHidden() const
   484 /** Gets the value of the field's hidden attribute.
   485 
   486 @return ETrue if hidden attribute is set, EFalse if not set. */
   487     { return iAttributes&EHidden; }
   488 
   489 inline TBool CContactItemField::IsReadOnly() const
   490 /** Gets the value of the field's read only attribute.
   491 
   492 @return ETrue if read only attribute set, EFalse if not set. */
   493     { return iAttributes&EReadOnly; }
   494 
   495 inline TBool CContactItemField::IsDisabled() const
   496 /** Gets the value of the field's disabled attribute.
   497 
   498 @return ETrue if disabled attribute set, EFalse if not set. */
   499 	{ return iAttributes&EDisabled; }
   500 
   501 inline TBool CContactItemField::IsTemplate() const
   502 /** Tests whether the field is in a template, as set by SetTemplateField().
   503 
   504 @return ETrue if field is a template field. EFalse if not. */
   505 	{ return iAttributes&ETemplate; }
   506 
   507 inline TBool CContactItemField::IsPrivate() const
   508 /** Tests whether the field's private attribute is set.
   509 
   510 @return True if the field's private attribute is set, false if not. */
   511 	{ return iExtendedAttributes&EPrivate; }
   512 
   513 inline TBool CContactItemField::IsSpeedDial() const
   514 /** Tests whether the field is a speed dial field.
   515 
   516 @return True if the field is a speed dial field, false if not. */
   517 	{ return iExtendedAttributes&ESpeedDial; }
   518 
   519 inline TBool CContactItemField::DoSynchronize() const
   520 /** Gets the value of the field's synchronise attribute.
   521 
   522 @return ETrue if synchronise attribute is set, EFalse if not set. */
   523     { return iAttributes&ESynchronize; }
   524 
   525 inline TBool CContactItemField::IsDeleted() const
   526 /** Gets the value of the field's deleted  attribute.
   527 
   528 @return ETrue if the field is deleted, otherwise EFalse.                            */
   529 	{ return iAttributes&EDeleted; }
   530 
   531 inline void CContactItemField::THint::SetIsPhone()
   532 	{iHintValue|=KIntContactHintIsPhone;}
   533 inline void CContactItemField::THint::SetIsMsg()
   534 	{iHintValue|=KIntContactHintIsMsg;}
   535 // turn off Pronunciation bit too?
   536 inline void CContactItemField::THint::SetIsCompanyName()
   537 	{iHintValue|=KIntContactHintIsCompanyName;}
   538 inline void CContactItemField::THint::SetIsFamilyName()
   539 	{iHintValue|=KIntContactHintIsFamilyName;}
   540 inline void CContactItemField::THint::SetIsGivenName()
   541 	{iHintValue|=KIntContactHintIsGivenName;}
   542 inline void CContactItemField::THint::SetIsCompanyNamePronunciation()
   543 	{iHintValue|=KIntContactHintIsCompanyName|KIntContactHintIsPronunciation;}
   544 inline void CContactItemField::THint::SetIsFamilyNamePronunciation()
   545 	{iHintValue|=KIntContactHintIsFamilyName|KIntContactHintIsPronunciation;}
   546 inline void CContactItemField::THint::SetIsGivenNamePronunciation()
   547 	{iHintValue|=KIntContactHintIsGivenName|KIntContactHintIsPronunciation;}
   548 inline void CContactItemField::THint::SetIsAddress()
   549 	{iHintValue|=KIntContactHintIsAddress;}
   550 inline void CContactItemField::THint::SetIsAdditionalName()
   551 	{iHintValue|=KIntContactHintIsAdditionalName;}
   552 inline void CContactItemField::THint::SetIsSuffixName()
   553 	{iHintValue|=KIntContactHintIsSuffixName;}
   554 inline void CContactItemField::THint::SetIsPrefixName()
   555 	{iHintValue|=KIntContactHintIsPrefixName;}
   556 inline void CContactItemField::THint::SetStorageIsInline()
   557 	{iHintValue|=KIntContactHintStorageInline;}
   558 inline void CContactItemField::THint::SetIsEmail()
   559 	{iHintValue|=KIntContactHintIsEmail;}
   560 inline TBool CContactItemField::THint::IsPhone() const
   561 	{return (iHintValue&KIntContactHintIsPhone);}
   562 inline TBool CContactItemField::THint::IsMsg() const
   563 	{return (iHintValue&KIntContactHintIsMsg);}
   564 inline TBool CContactItemField::THint::IsCompanyName() const
   565 	{return ((iHintValue&KIntContactHintIsCompanyNamePronunciation) == KIntContactHintIsCompanyName);}
   566 inline TBool CContactItemField::THint::IsFamilyName() const
   567 	{return ((iHintValue&KIntContactHintIsFamilyNamePronunciation)==KIntContactHintIsFamilyName);}
   568 inline TBool CContactItemField::THint::IsGivenName() const
   569 	{return ((iHintValue&KIntContactHintIsGivenNamePronunciation)==KIntContactHintIsGivenName);}
   570 inline TBool CContactItemField::THint::IsCompanyNamePronunciation() const
   571 	{return ((iHintValue&KIntContactHintIsCompanyNamePronunciation) == KIntContactHintIsCompanyNamePronunciation);}
   572 inline TBool CContactItemField::THint::IsFamilyNamePronunciation() const
   573 	{return ((iHintValue&KIntContactHintIsFamilyNamePronunciation)==KIntContactHintIsFamilyNamePronunciation);}
   574 inline TBool CContactItemField::THint::IsGivenNamePronunciation() const
   575 	{return ((iHintValue&KIntContactHintIsGivenNamePronunciation)==KIntContactHintIsGivenNamePronunciation);}
   576 inline TBool CContactItemField::THint::IsAddress() const
   577 	{return (iHintValue&KIntContactHintIsAddress);}
   578 inline TBool CContactItemField::THint::IsAdditionalName() const
   579 	{return (iHintValue&KIntContactHintIsAdditionalName);}
   580 inline TBool CContactItemField::THint::IsSuffixName() const
   581 	{return (iHintValue&KIntContactHintIsSuffixName);}
   582 inline TBool CContactItemField::THint::IsPrefixName() const
   583 	{return (iHintValue&KIntContactHintIsPrefixName);}
   584 inline TBool CContactItemField::THint::IsStorageInline() const
   585 	{return (iHintValue&KIntContactHintStorageInline);}
   586 inline TBool CContactItemField::THint::IsEmail() const
   587 	{return (iHintValue&KIntContactHintIsEmail);}
   588 	
   589 #ifndef __SYMBIAN_CNTMODEL_USE_SQLITE__	
   590 inline void CContactItemField::THint::SetHasAdditionalUids()
   591 	{iHintValue|=KHintAdditionalMask;}
   592 #endif //__SYMBIAN_CNTMODEL_USE_SQLITE__ 
   593 inline TBool CContactItemField::THint::Contains(const THint& aHint) const
   594 	{return (iHintValue&aHint.iHintValue);}
   595 
   596 inline TBool CContactItemField::OverRidesLabel() const
   597 /** Tests whether the field's label (as set by SetLabel()) overrides the label 
   598 specified in the field's template.
   599 
   600 @return True if the field's label overrides the label specified in the template; 
   601 false if not. */
   602 	{return iAttributes&EOverRidesLabel;}
   603 
   604 inline TBool CContactItemField::HasExtraStream() const
   605 /** Tests whether the field needs an extra stream to store information not contained 
   606 in the template. This is the case if the field's content type is not based 
   607 on a template, or if the field has a label which overrides the label specified 
   608 in the template.
   609 
   610 @return True if the field uses an extra stream; false if not. */
   611 	{return(!(iAttributes&EUsesTemplateData) || iAttributes&EOverRidesLabel);}
   612 
   613 inline TBool CContactItemField::UsesTemplateTypes() const
   614 /** Tests whether or not the field's content type is based on a template.
   615 
   616 @return True if the field's content type is based on a template; false if not. */
   617 	{return iAttributes&EUsesTemplateData;}
   618 
   619 inline TBool CContactItemField::LabelUnspecified() const
   620 /** Tests whether the field's label has been set, either by a call to SetLabel() 
   621 or by inheriting a label specified in the template.
   622 
   623 @return True if the field's label has been set, false if not. */
   624 	{return iAttributes&ELabelUnspecified;}
   625 
   626 inline TBool CContactItemField::UserAddedField() const
   627 /** Gets the value of the user added field attribute.
   628 
   629 @return ETrue if the user added attribute is set, EFalse if not. */
   630 	{return iAttributes&EUserAddedField;}
   631 
   632 inline TBool CContactItemField::IsCustomFilterable() const
   633 /** Tests the value of the user defined filter attribute.
   634 
   635 @return ETrue if the user defined filter attribute is set, EFalse if not. */
   636 	{
   637 	return (iExtendedAttributes&EUserDefinedFilter || iExtendedAttributes&EUserDefinedFilter1 ||
   638 	       iExtendedAttributes&EUserDefinedFilter2 || iExtendedAttributes&EUserDefinedFilter3 
   639 	       || iExtendedAttributes&EUserDefinedFilter4);
   640 	}
   641 	
   642 #endif