114
|
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 |
* Appends empty item to the cache to indicate that the entry
|
|
71 |
* doesn't exist in a storage and it makes not sense to call GetList
|
|
72 |
* operation on a storage
|
|
73 |
*
|
|
74 |
* @param aIdsMap a map containing entry identifiers
|
|
75 |
*/
|
|
76 |
void AppendEmptyL( const CLiwMap* aIdsMap );
|
|
77 |
|
|
78 |
/**
|
|
79 |
* Checks if it is possible to cache the item.
|
|
80 |
* Only items that are specified, which means that id or
|
|
81 |
* all parameters ( publisher, content_type, content_id ) are provided
|
|
82 |
*
|
|
83 |
* @param aMap a map containing item identifiers
|
|
84 |
* @return ETrue if it is possible to cache an item, EFalse if not
|
|
85 |
*/
|
|
86 |
TBool IsCacheableL( const CLiwMap* aMap );
|
|
87 |
|
|
88 |
/**
|
|
89 |
* Checks if it item exists in the cache.
|
|
90 |
*
|
|
91 |
* @param aMap a map containing item identifiers
|
|
92 |
* @return ETrue if the item exists in the cache, EFalse if not
|
|
93 |
*/
|
|
94 |
TBool ExistL( const CLiwMap* aMap );
|
|
95 |
|
|
96 |
/**
|
|
97 |
* Gets an item from the cache
|
|
98 |
*
|
|
99 |
* @param aMap a map containing item identifiers
|
|
100 |
* @return aParamList item returned from the cache
|
|
101 |
*/
|
|
102 |
void GetL( const CLiwMap* aMap,
|
|
103 |
CLiwGenericParamList* aParamList );
|
|
104 |
|
|
105 |
private:
|
|
106 |
|
|
107 |
/*
|
|
108 |
* Constructor
|
|
109 |
*/
|
|
110 |
CCPActionDataCache();
|
|
111 |
|
|
112 |
/**
|
|
113 |
* 2nd phase constructor.
|
|
114 |
*/
|
|
115 |
void ConstructL( );
|
|
116 |
|
|
117 |
/**
|
|
118 |
* Checks if two items match
|
|
119 |
*
|
|
120 |
* @param aCachedMap a map from the cache containing item identifiers
|
|
121 |
* @param aInputMap an input map containing item identifiers
|
|
122 |
* @return ETrue if items match , EFalse if not
|
|
123 |
*/
|
|
124 |
TBool MatchL(const CLiwMap* aCachedMap, const CLiwMap* aInputMap);
|
|
125 |
|
|
126 |
/**
|
|
127 |
* Checks if types of two items match
|
|
128 |
*
|
|
129 |
* @param aCachedMap a map from the cache containing item identifiers
|
|
130 |
* @param aInputMap an input map containing item identifiers
|
|
131 |
* @return ETrue if types match , EFalse if not
|
|
132 |
*/
|
|
133 |
TBool TypesMatchL(const CLiwMap* aCachedMap, const CLiwMap* aInputMap);
|
|
134 |
|
|
135 |
/**
|
|
136 |
* Extracts RBuf from a variant
|
|
137 |
*
|
|
138 |
* @param aVariant a variant
|
|
139 |
* @param aBuf a result descriptor
|
|
140 |
*/
|
|
141 |
void ExtractRBufL(const TLiwVariant& aVariant, RBuf& aBuf);
|
|
142 |
|
|
143 |
/**
|
|
144 |
* Checks if two strings contained in both maps match
|
|
145 |
*
|
|
146 |
* @param aLeft first map
|
|
147 |
* @param aRight second map
|
|
148 |
* @param aKey key
|
|
149 |
* @return ETrue if items match , EFalse if not
|
|
150 |
*/
|
|
151 |
TBool MatchL(const CLiwMap* aLeft,
|
|
152 |
const CLiwMap* aRight, const TDesC8& aKey );
|
|
153 |
|
|
154 |
/**
|
|
155 |
* Checks if a string contained in map is specified
|
|
156 |
* (it has value different than "all")
|
|
157 |
*
|
|
158 |
* @param aMap map
|
|
159 |
* @param aKey key
|
|
160 |
* @return ETrue if item is specified , EFalse if not
|
|
161 |
*/
|
|
162 |
TBool IsSpecifiedL(const CLiwMap* aMap,
|
|
163 |
const TDesC8& aKey );
|
|
164 |
|
|
165 |
/**
|
|
166 |
* Finds the item in the cache
|
|
167 |
*
|
|
168 |
* @param aKey map containing identifiers
|
|
169 |
* @return id of the item in a cache, KErrNotFound if does not
|
|
170 |
* exist in the cache
|
|
171 |
*/
|
|
172 |
TInt FindL( const CLiwMap* aKey );
|
|
173 |
|
|
174 |
/**
|
|
175 |
* Copies variant from one map to another
|
|
176 |
*
|
|
177 |
* @param aKey key
|
|
178 |
* @param aInMap input map
|
|
179 |
* @param aOutMap output map
|
|
180 |
*/
|
|
181 |
void CopyVariantL(const TDesC8& aKey,
|
|
182 |
const CLiwMap* aInMap, CLiwDefaultMap* aOutMap );
|
|
183 |
|
|
184 |
private:
|
|
185 |
|
|
186 |
/*
|
|
187 |
* Internal list. Own
|
|
188 |
*/
|
|
189 |
CLiwDefaultList* iInternalList;
|
|
190 |
};
|
|
191 |
|
|
192 |
#endif // C_CPACTIONDATACACHE_H
|