|
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 "Eclipse Public License v1.0" |
|
5 // which accompanies this distribution, and is available |
|
6 // at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
7 // |
|
8 // Initial Contributors: |
|
9 // Nokia Corporation - initial contribution. |
|
10 // |
|
11 // Contributors: |
|
12 // |
|
13 // Description: |
|
14 // |
|
15 |
|
16 #ifndef __CNTSERVERCURRENTITEMMAP_H__ |
|
17 #define __CNTSERVERCURRENTITEMMAP_H__ |
|
18 |
|
19 #include <e32base.h> |
|
20 #include <cntdef.h> |
|
21 |
|
22 const TUid KUidCntCurrentItemStream = { 0x10009EF8 }; |
|
23 |
|
24 class CDictionaryFileStore; |
|
25 |
|
26 /** |
|
27 * A collection of associations between database filenames and |
|
28 * current contact item id |
|
29 */ |
|
30 class CCntServerCurrentItemMap : public CBase |
|
31 { |
|
32 public: |
|
33 CCntServerCurrentItemMap(); |
|
34 ~CCntServerCurrentItemMap(); |
|
35 |
|
36 // ACCESS - GETTERS |
|
37 TContactItemId CurrentItem(const TDesC& aDatabaseFile) const; |
|
38 TBool EntryAvailable(const TDesC& aDatabaseFile, TInt& aIndex) const; |
|
39 void UpdateEntryL(TInt aIndex, TContactItemId aId); |
|
40 void AddEntryL(const TDesC& aDatabaseFile, TContactItemId aId); |
|
41 |
|
42 // INTERNALIZE / EXTERNALIZE |
|
43 void StoreL(CDictionaryFileStore& aStore) const; |
|
44 void RestoreL(CDictionaryFileStore& aStore); |
|
45 private: |
|
46 /** |
|
47 * An individual association between a database filename and |
|
48 * the current item id for that database |
|
49 */ |
|
50 class CCntCurrentItemMapEntry : public CBase |
|
51 { |
|
52 public: |
|
53 CCntCurrentItemMapEntry(); |
|
54 ~CCntCurrentItemMapEntry(); |
|
55 void ConstructL(const TDesC& aFileName, TContactItemId aContactId); |
|
56 |
|
57 inline const TDesC& DatabaseFile() const; |
|
58 inline TContactItemId ContactId() const; |
|
59 inline void SetContactId(TContactItemId aContactId); |
|
60 |
|
61 void InternalizeL(RReadStream& aStream); |
|
62 void ExternalizeL(RWriteStream& aStream) const; |
|
63 private: |
|
64 HBufC* iDatabaseFile; |
|
65 TContactItemId iContactId; |
|
66 }; |
|
67 private: |
|
68 RPointerArray<CCntCurrentItemMapEntry> iCurrentItemMap; |
|
69 }; |
|
70 |
|
71 inline const TDesC& CCntServerCurrentItemMap::CCntCurrentItemMapEntry::DatabaseFile() const { return *iDatabaseFile; } |
|
72 inline TContactItemId CCntServerCurrentItemMap::CCntCurrentItemMapEntry::ContactId() const { return iContactId; } |
|
73 inline void CCntServerCurrentItemMap::CCntCurrentItemMapEntry::SetContactId(TContactItemId aContactId) { iContactId = aContactId; } |
|
74 |
|
75 |
|
76 |
|
77 #endif |