|
1 /* |
|
2 * Copyright (c) 2002-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: An index for sim phone numbers |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #ifndef VPBKSIMSTORE_CSIMPHONENUMBERINDEX_H |
|
20 #define VPBKSIMSTORE_CSIMPHONENUMBERINDEX_H |
|
21 |
|
22 // INCLUDES |
|
23 #include <e32base.h> |
|
24 #include "CContactArray.h" |
|
25 #include <VPbkPhoneNumberIndex.h> |
|
26 |
|
27 namespace VPbkSimStoreImpl { |
|
28 |
|
29 // FORWARD DECLARATIONS |
|
30 class CStoreBase; |
|
31 |
|
32 // CLASS DECLARATION |
|
33 |
|
34 /** |
|
35 * An index for sim phone numbers |
|
36 * |
|
37 */ |
|
38 NONSHARABLE_CLASS(CSimPhoneNumberIndex) : public CBase, |
|
39 public MContactArrayObserver |
|
40 { |
|
41 public: // Constructors and destructor |
|
42 |
|
43 /** |
|
44 * Two-phased constructor. |
|
45 */ |
|
46 static CSimPhoneNumberIndex* NewL( CStoreBase& aParentStore ); |
|
47 |
|
48 /** |
|
49 * Destructor. |
|
50 */ |
|
51 virtual ~CSimPhoneNumberIndex(); |
|
52 |
|
53 public: // Functions from base classes |
|
54 |
|
55 /** |
|
56 * From MContactArrayObserver |
|
57 */ |
|
58 void ContactAdded( MVPbkSimContact& aSimContact ); |
|
59 |
|
60 /** |
|
61 * From MContactArrayObserver |
|
62 */ |
|
63 void ContactRemoved( MVPbkSimContact& aSimContact ); |
|
64 |
|
65 /** |
|
66 * From MContactArrayObserver |
|
67 */ |
|
68 void ContactChanged( MVPbkSimContact& aOldContact, |
|
69 MVPbkSimContact& aNewContact ); |
|
70 |
|
71 public: // New functions |
|
72 |
|
73 /** |
|
74 * Return the actual phone number index implementation |
|
75 * @return the actual phone number index implementation |
|
76 */ |
|
77 inline VPbkEngUtils::CPhoneNumberIndex<MVPbkSimContact>& Index() const; |
|
78 |
|
79 /** |
|
80 * Resets and builds the index again |
|
81 */ |
|
82 void ReBuildL(); |
|
83 |
|
84 private: |
|
85 |
|
86 /** |
|
87 * C++ constructor. |
|
88 */ |
|
89 CSimPhoneNumberIndex( CStoreBase& aParentStore ); |
|
90 |
|
91 /** |
|
92 * By default Symbian 2nd phase constructor is private. |
|
93 */ |
|
94 void ConstructL(); |
|
95 |
|
96 private: // New functions |
|
97 /// Builds the index from the contact array |
|
98 void ResetAndBuildIndexL(); |
|
99 /// Appends phone numbers from the contact to the index |
|
100 void AppendNumbersL( MVPbkSimContact& aContact ); |
|
101 private: // Data |
|
102 /// Parent store of the index |
|
103 CStoreBase& iParentStore; |
|
104 /// Own: a phone number index for fast number matching |
|
105 VPbkEngUtils::CPhoneNumberIndex<MVPbkSimContact>* iNumberIndex; |
|
106 }; |
|
107 |
|
108 // INLINE FUNCTIONS |
|
109 |
|
110 inline VPbkEngUtils::CPhoneNumberIndex<MVPbkSimContact>& |
|
111 CSimPhoneNumberIndex::Index() const |
|
112 { |
|
113 return *iNumberIndex; |
|
114 } |
|
115 } // namespace VPbkSimStore |
|
116 #endif // VPBKSIMSTORE_CSIMPHONENUMBERINDEX_H |
|
117 |
|
118 |
|
119 // End of File |