|
1 // Copyright (c) 2007-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 __MSVCACHEENTRY_H__ |
|
17 #define __MSVCACHEENTRY_H__ |
|
18 |
|
19 #include "MSVTIME.H" |
|
20 #include "MSVPANIC.H" |
|
21 |
|
22 #include <e32base.h> |
|
23 #include <msvstd.h> |
|
24 |
|
25 /** |
|
26 CMsvCacheEntry corresponds to a TMsvEntry object that has been loaded into memory. |
|
27 @internalComponent |
|
28 @prototype |
|
29 */ |
|
30 |
|
31 NONSHARABLE_CLASS (CMsvCacheEntry): public CBase |
|
32 { |
|
33 public: |
|
34 inline TMsvEntry& Entry(); |
|
35 inline TMsvId GetId() const; |
|
36 |
|
37 TInt LockEntry(); |
|
38 inline TBool IsEntryLocked() const; |
|
39 inline void ReleaseEntry(); |
|
40 |
|
41 TInt LockStore(); |
|
42 inline TBool IsStoreLocked() const; |
|
43 inline void ReleaseStore(); |
|
44 |
|
45 inline TBool IsStoreReadingLocked() const; |
|
46 inline void IncStoreReaderCount(); |
|
47 inline void DecStoreReaderCount(); |
|
48 |
|
49 TInt LockEntryAndStore(); |
|
50 inline TBool IsEntryOrStoreLocked() const; |
|
51 inline TBool IsEntryAndStoreLocked() const; |
|
52 inline void ReleaseEntryAndStore(); |
|
53 |
|
54 inline const TMsvTime& CreatedDate() const; |
|
55 inline void SetCreatedDate(const TMsvTime& aTime); |
|
56 inline const TMsvTime& LastChangeDate() const; |
|
57 inline void SetLastChangeDate(const TMsvTime& aTime); |
|
58 |
|
59 void CopyEntryL(const TMsvEntry& aEntry, TBool& aChangedPrivateInfo); |
|
60 void RollBackCopyEntry(const TMsvEntry& aEntry); |
|
61 |
|
62 inline TSecureId EntryOwnerId() const; |
|
63 inline void SetEntryOwnerId(TSecureId aOwnerId); |
|
64 |
|
65 inline RArray<TMsvId>* ChildIdArray(); |
|
66 inline void SetChildIdArray(RArray<TMsvId>* aChildArray); |
|
67 |
|
68 inline TBool IsEntrySwappable() const; |
|
69 |
|
70 void DupNDestroyL(CMsvCacheEntry*& aEntry); |
|
71 void SetEntryL(TMsvEntry& aEntry); |
|
72 void ResetEntry(); |
|
73 |
|
74 private: |
|
75 static CMsvCacheEntry* NewLC(); |
|
76 static CMsvCacheEntry* NewL(); |
|
77 void ConstructL(); |
|
78 CMsvCacheEntry(); |
|
79 CMsvCacheEntry(const CMsvCacheEntry&); |
|
80 virtual ~CMsvCacheEntry(); |
|
81 |
|
82 private: |
|
83 enum |
|
84 { |
|
85 EMsvServerEntryClearFlag = 0x00, |
|
86 EMsvServerEntryLockFlag = 0x01, |
|
87 EMsvServerEntryStoreLockFlag = 0x02 |
|
88 }; |
|
89 |
|
90 // Only CMsvEntryFreePool class should |
|
91 // create an instance of CMsvCacheEntry. |
|
92 friend class CMsvEntryFreePool; |
|
93 // This class is made friend because |
|
94 // we need to destroy entry through ResetAndDestroy(). |
|
95 friend class RPointerArray<CMsvCacheEntry>; |
|
96 |
|
97 #ifdef SYMBIAN_MESSAGESTORE_UNIT_TESTCODE |
|
98 friend class CTestCacheEntry; |
|
99 #endif |
|
100 |
|
101 public: |
|
102 HBufC* iDescriptionBuffer; |
|
103 HBufC* iDetailsBuffer; |
|
104 |
|
105 private: |
|
106 TMsvEntry iEntry; |
|
107 TUint32 iFlags; |
|
108 TInt32 iStoreReaderCount; |
|
109 TMsvTime iLastChange; |
|
110 TMsvTime iCreated; |
|
111 TSecureId iOwnerId; |
|
112 RArray<TMsvId>* iChildIdArray; |
|
113 }; |
|
114 |
|
115 #include "msvcacheentry.inl" |
|
116 |
|
117 #endif // #ifndef __MSVCACHEENTRY_H__ |