|
1 /* |
|
2 * Copyright (c) 2008 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: Class used by session to handle asynchronous requests |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #ifndef C_CPACTIONDATACACHE_H |
|
20 #define C_CPACTIONDATACACHE_H |
|
21 |
|
22 #include <e32base.h> |
|
23 #include <e32hashtab.h> |
|
24 |
|
25 class CLiwDefaultList; |
|
26 |
|
27 /** |
|
28 * Action Data Cache holds a list containing data needed to |
|
29 * lauch an action fetched from SQL database |
|
30 * @since S60 v5.0 |
|
31 */ |
|
32 class CCPActionDataCache:public CBase |
|
33 { |
|
34 public: |
|
35 |
|
36 /** |
|
37 * Creates new instance of CCPActionDataCache. |
|
38 * |
|
39 * @return new instance of CCPActionDataCache |
|
40 */ |
|
41 static CCPActionDataCache* NewL( ); |
|
42 |
|
43 /** |
|
44 * Creates new instance of CCPActionDataCache. |
|
45 * |
|
46 * @return new instance of CCPActionDataCache |
|
47 */ |
|
48 static CCPActionDataCache* NewLC( ); |
|
49 |
|
50 /** |
|
51 * Destructor. |
|
52 */ |
|
53 virtual ~CCPActionDataCache(); |
|
54 |
|
55 /** |
|
56 * Removes an item from the cache |
|
57 * |
|
58 * @param aMap a map containing item identifiers |
|
59 */ |
|
60 void HandleCacheRemoveL( const CLiwMap* aMap ); |
|
61 |
|
62 /** |
|
63 * Appends an item to the cache |
|
64 * |
|
65 * @param aParamList a list to be added to the cache |
|
66 */ |
|
67 void AppendL( const CLiwGenericParamList* aParamList); |
|
68 |
|
69 /** |
|
70 * Checks if it is possible to cache the item. |
|
71 * Only items that are specified, which means that id or |
|
72 * all parameters ( publisher, content_type, content_id ) are provided |
|
73 * |
|
74 * @param aMap a map containing item identifiers |
|
75 * @return ETrue if it is possible to cache an item, EFalse if not |
|
76 */ |
|
77 TBool IsCacheableL( const CLiwMap* aMap ); |
|
78 |
|
79 /** |
|
80 * Checks if it item exists in the cache. |
|
81 * |
|
82 * @param aMap a map containing item identifiers |
|
83 * @return ETrue if the item exists in the cache, EFalse if not |
|
84 */ |
|
85 TBool ExistL( const CLiwMap* aMap ); |
|
86 |
|
87 /** |
|
88 * Gets an item from the cache |
|
89 * |
|
90 * @param aMap a map containing item identifiers |
|
91 * @return aParamList item returned from the cache |
|
92 */ |
|
93 void GetL( const CLiwMap* aMap, |
|
94 CLiwGenericParamList* aParamList ); |
|
95 |
|
96 private: |
|
97 |
|
98 /* |
|
99 * Constructor |
|
100 */ |
|
101 CCPActionDataCache(); |
|
102 |
|
103 /** |
|
104 * 2nd phase constructor. |
|
105 */ |
|
106 void ConstructL( ); |
|
107 |
|
108 /** |
|
109 * Checks if two items match |
|
110 * |
|
111 * @param aCachedMap a map from the cache containing item identifiers |
|
112 * @param aInputMap an input map containing item identifiers |
|
113 * @return ETrue if items match , EFalse if not |
|
114 */ |
|
115 TBool MatchL(const CLiwMap* aCachedMap, const CLiwMap* aInputMap); |
|
116 |
|
117 /** |
|
118 * Checks if two strings contained in both maps match |
|
119 * |
|
120 * @param aLeft first map |
|
121 * @param aRight second map |
|
122 * @param aKey key |
|
123 * @return ETrue if items match , EFalse if not |
|
124 */ |
|
125 TBool MatchL(const CLiwMap* aLeft, |
|
126 const CLiwMap* aRight, const TDesC8& aKey ); |
|
127 |
|
128 /** |
|
129 * Checks if a string contained in map is specified |
|
130 * (it has value different than "all") |
|
131 * |
|
132 * @param aMap map |
|
133 * @param aKey key |
|
134 * @return ETrue if item is specified , EFalse if not |
|
135 */ |
|
136 TBool IsSpecifiedL(const CLiwMap* aMap, |
|
137 const TDesC8& aKey ); |
|
138 |
|
139 /** |
|
140 * Finds the item in the cache |
|
141 * |
|
142 * @param aKey map containing identifiers |
|
143 * @return id of the item in a cache, KErrNotFound if does not |
|
144 * exist in the cache |
|
145 */ |
|
146 TInt FindL( const CLiwMap* aKey ); |
|
147 |
|
148 /** |
|
149 * Copies variant from one map to another |
|
150 * |
|
151 * @param aKey key |
|
152 * @param aInMap input map |
|
153 * @param aOutMap output map |
|
154 */ |
|
155 void CopyVariantL(const TDesC8& aKey, |
|
156 const CLiwMap* aInMap, CLiwDefaultMap* aOutMap ); |
|
157 |
|
158 private: |
|
159 |
|
160 /* |
|
161 * Internal list. Own |
|
162 */ |
|
163 CLiwDefaultList* iInternalList; |
|
164 }; |
|
165 |
|
166 #endif // C_CPACTIONDATACACHE_H |