|
1 /* |
|
2 * Copyright (c) 2005-2007 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. |
|
4 * This component and the accompanying materials are made available |
|
5 * under the terms of "Eclipse Public License v1.0" |
|
6 * which accompanies this distribution, and is available |
|
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 * |
|
9 * Initial Contributors: |
|
10 * Nokia Corporation - initial contribution. |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: Phonebook 2 store contact analyzer. |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #ifndef TPBK2STORECONTACTANALYZER_H |
|
20 #define TPBK2STORECONTACTANALYZER_H |
|
21 |
|
22 // INCLUDES |
|
23 #include <e32def.h> |
|
24 |
|
25 // FORWARD DECLARATIONS |
|
26 class CVPbkContactManager; |
|
27 class MVPbkStoreContact; |
|
28 class MVPbkContactFieldSelector; |
|
29 class MVPbkFieldTypeList; |
|
30 class MVPbkBaseContactFieldCollection; |
|
31 class MVPbkBaseContactField; |
|
32 class CVPbkFieldTypeSelector; |
|
33 class MVPbkFieldTypeSelector; |
|
34 class MVPbkFieldType; |
|
35 |
|
36 // CLASS DECLARATION |
|
37 |
|
38 /** |
|
39 * Phonebook 2 store contact analyzer. |
|
40 */ |
|
41 class TPbk2StoreContactAnalyzer |
|
42 { |
|
43 public: // Constructors and destructor |
|
44 |
|
45 /** |
|
46 * Constructor. |
|
47 * |
|
48 * @param aContactManager Virtual Phonebook contact manager. |
|
49 * @param aContact Store contact. |
|
50 */ |
|
51 IMPORT_C TPbk2StoreContactAnalyzer( |
|
52 const CVPbkContactManager& aContactManager, |
|
53 const MVPbkStoreContact* aContact ); |
|
54 |
|
55 public: // Interface |
|
56 |
|
57 /** |
|
58 * Analyses if the contact has a field with type specified |
|
59 * in aResId definition. |
|
60 * |
|
61 * @param aResId A VPBK_FIELD_TYPE_SELECTOR resource id. |
|
62 * @param aStartIndex Starts looking up the specified field from |
|
63 * this field index. |
|
64 * @param aContact The contact to analyze. If NULL the contact |
|
65 * got from the constructor is used. |
|
66 * @return Field index if contact has field specified in aResId, |
|
67 * otherwise KErrNotFound. |
|
68 */ |
|
69 IMPORT_C TInt HasFieldL( |
|
70 TInt aResId, |
|
71 TInt aStartIndex = 0, |
|
72 const MVPbkStoreContact* aContact = NULL ) const; |
|
73 |
|
74 /** |
|
75 * Analyses if the contact supports field with type specified |
|
76 * in aResId definition. |
|
77 |
|
78 * @param aResId A VPBK_FIELD_TYPE_SELECTOR resource id. |
|
79 * @param aContact The contact to analyze. If NULL the |
|
80 * contact got from constructor is used. |
|
81 * @return ETrue if the field type is supported by the contact, |
|
82 * otherwise EFalse. |
|
83 */ |
|
84 IMPORT_C TBool IsFieldTypeSupportedL( |
|
85 TInt aResId, |
|
86 const MVPbkStoreContact* aContact = NULL ) const; |
|
87 |
|
88 /** |
|
89 * Checks if the aFieldType is same as specified in aResId definition. |
|
90 * Returns ETrue is same, otherwise EFalse. |
|
91 * |
|
92 * @param aFieldType The field type to check. |
|
93 * @param aResId Selector's resource id. |
|
94 * @return ETrue if the field type is included. |
|
95 */ |
|
96 IMPORT_C TBool IsFieldTypeIncludedL( |
|
97 const MVPbkFieldType& aFieldType, |
|
98 TInt aResId ) const; |
|
99 |
|
100 /** |
|
101 * Checks if the aField's field type is same as specified in |
|
102 * aResId definition. Returns ETrue is same, otherwise EFalse. |
|
103 * |
|
104 * @param aField The field whose type to check. |
|
105 * @param aResId Selector's resource id. |
|
106 * @return ETrue if the field type is included. |
|
107 */ |
|
108 IMPORT_C TBool IsFieldTypeIncludedL( |
|
109 const MVPbkBaseContactField& aField, |
|
110 TInt aResId ) const; |
|
111 |
|
112 private: // Implementation |
|
113 TPbk2StoreContactAnalyzer(); |
|
114 TInt IsFieldIncluded( |
|
115 const MVPbkBaseContactFieldCollection& aFields, |
|
116 TInt aStartIndex, |
|
117 const MVPbkContactFieldSelector& aFieldTypeSelector ) const; |
|
118 TBool IsFieldTypeIncluded( |
|
119 const MVPbkFieldTypeList& aFieldTypes, |
|
120 const MVPbkFieldTypeSelector& aFieldTypeSelector ) const; |
|
121 CVPbkFieldTypeSelector* CreateFieldTypeSelectorLC( |
|
122 TInt aResId ) const; |
|
123 |
|
124 private: // Data |
|
125 /// Ref: Virtual Phonebook contact manager |
|
126 const CVPbkContactManager& iContactManager; |
|
127 /// Ref: The contact to analyze |
|
128 const MVPbkStoreContact* iContact; |
|
129 }; |
|
130 |
|
131 #endif // TPBK2STORECONTACTANALYZER_H |
|
132 |
|
133 // End of File |