5
|
1 |
/*
|
|
2 |
* Copyright (c) 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 the License "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: Defination of class CCalendarInterface
|
|
15 |
*
|
|
16 |
*/
|
|
17 |
|
|
18 |
|
|
19 |
#ifndef __CALENDARITERABLEIMPL_H
|
|
20 |
#define __CALENDARITERABLEIMPL_H
|
|
21 |
|
|
22 |
#include <LiwCommon.h>
|
|
23 |
#include <LiwServiceIfBase.h>
|
|
24 |
#include <LiwBufferExtension.h>
|
|
25 |
|
|
26 |
#include <calentry.h>
|
|
27 |
#include <calinstance.h>
|
|
28 |
#include "calendarinterface.h"
|
|
29 |
|
|
30 |
/**
|
|
31 |
* Implemenation of abstract interface to iterate over the collection of Calendars.
|
|
32 |
*
|
|
33 |
* @see CLiwIterable
|
|
34 |
*
|
|
35 |
*/
|
|
36 |
class CIterableCalendarList : public CLiwIterable
|
|
37 |
{
|
|
38 |
public:
|
|
39 |
/**
|
|
40 |
* Two-phase Constructor
|
|
41 |
* @param aList list to be iterated
|
|
42 |
* @return new CIterableCalList object
|
|
43 |
*/
|
|
44 |
static CIterableCalendarList* NewL( CDesCArray* aList );
|
|
45 |
|
|
46 |
/**
|
|
47 |
* Resets the iterator.
|
|
48 |
*
|
|
49 |
* @return void
|
|
50 |
*/
|
|
51 |
void Reset();
|
|
52 |
|
|
53 |
/**
|
|
54 |
* Iterates over the collection entries to fetch the next data element.
|
|
55 |
*
|
|
56 |
* @param aValue contains the next data element
|
|
57 |
*
|
|
58 |
* @return false if there are no more data elements to be fetched;
|
|
59 |
* true otherwise
|
|
60 |
*
|
|
61 |
*/
|
|
62 |
TBool NextL(TLiwVariant& aValue);
|
|
63 |
|
|
64 |
/**
|
|
65 |
* Destructor.
|
|
66 |
*/
|
|
67 |
~CIterableCalendarList();
|
|
68 |
|
|
69 |
private:
|
|
70 |
|
|
71 |
/**
|
|
72 |
* Constructor
|
|
73 |
* @param aList list to be iterated
|
|
74 |
* @return void
|
|
75 |
*/
|
|
76 |
CIterableCalendarList( CDesCArray* aList );
|
|
77 |
|
|
78 |
|
|
79 |
private:
|
|
80 |
|
|
81 |
/**
|
|
82 |
* CDesCArray class pointer
|
|
83 |
*/
|
|
84 |
CDesCArray* iList;
|
|
85 |
|
|
86 |
/**
|
|
87 |
* Index on list
|
|
88 |
*/
|
|
89 |
TInt iIndex;
|
|
90 |
};
|
|
91 |
|
|
92 |
/**
|
|
93 |
* Implemenation of abstract interface to iterate over the collection of Calendar Entries.
|
|
94 |
*
|
|
95 |
* @see CLiwIterable
|
|
96 |
*
|
|
97 |
*/
|
|
98 |
class CIterableCalEntryList : public CLiwIterable
|
|
99 |
{
|
|
100 |
public:
|
|
101 |
/**
|
|
102 |
* Two-phase Constructor
|
|
103 |
* @param aInterface Calendar Interface reference
|
|
104 |
* @param aCalendarName Calendar Name
|
|
105 |
* @param aIsEntryList Flag for checking validity of EntryList
|
|
106 |
* @return new CIterableCalList object
|
|
107 |
*/
|
|
108 |
static CIterableCalEntryList* NewL( CCalendarInterface& aInterface,
|
|
109 |
const TDesC& aCalendarName,
|
|
110 |
const TBool aIsEntryList );
|
|
111 |
|
|
112 |
/**
|
|
113 |
* Resets the iterator.
|
|
114 |
*
|
|
115 |
*/
|
|
116 |
void Reset();
|
|
117 |
|
|
118 |
/**
|
|
119 |
* Iterates over the collection entries to fetch the next data element.
|
|
120 |
*
|
|
121 |
* @param aEntry contains the next data element and its corresponding data type
|
|
122 |
*
|
|
123 |
* @return false if there are no more data elements to be fetched;
|
|
124 |
* true otherwise
|
|
125 |
*
|
|
126 |
*/
|
|
127 |
TBool NextL(TLiwVariant& aEntry);
|
|
128 |
|
|
129 |
/**
|
|
130 |
* Return reference of the collection entries.
|
|
131 |
*
|
|
132 |
* @return Return reference of the collection entries
|
|
133 |
*
|
|
134 |
*/
|
|
135 |
RPointerArray<CCalEntry>& EntryArray();
|
|
136 |
|
|
137 |
/**
|
|
138 |
* Return reference of the collection instances.
|
|
139 |
*
|
|
140 |
* @return Return reference of the collection instances.
|
|
141 |
*
|
|
142 |
*/
|
|
143 |
RPointerArray<CCalInstance>& InstanceArray();
|
|
144 |
|
|
145 |
/**
|
|
146 |
* Return reference of the collection instances.
|
|
147 |
*
|
|
148 |
* @return Return reference of the collection instances.
|
|
149 |
*
|
|
150 |
*/
|
|
151 |
void SetResourceFree();
|
|
152 |
|
|
153 |
/**
|
|
154 |
* Return CalendarName.
|
|
155 |
*
|
|
156 |
* @return Return CalendarName.
|
|
157 |
*
|
|
158 |
*/
|
|
159 |
TPtrC CalendarName();
|
|
160 |
|
|
161 |
/**
|
|
162 |
* Destructor.
|
|
163 |
*/
|
|
164 |
~CIterableCalEntryList();
|
|
165 |
|
|
166 |
private:
|
|
167 |
|
|
168 |
/**
|
|
169 |
* Constructor
|
|
170 |
* @param aInterface Calendar interface reference
|
|
171 |
* @param aList list to be iterated
|
|
172 |
* @return void
|
|
173 |
*/
|
|
174 |
CIterableCalEntryList( CCalendarInterface& aInterface, const TBool aIsEntryList );
|
|
175 |
|
|
176 |
/**
|
|
177 |
* Two-phase Constructor
|
|
178 |
* @param aCalendarName CalendarName to which this resource belongs
|
|
179 |
* @return void
|
|
180 |
*/
|
|
181 |
void ConstructL( const TDesC& aCalendarName );
|
|
182 |
|
|
183 |
private:
|
|
184 |
|
|
185 |
/**
|
|
186 |
* Calendar Entry List
|
|
187 |
*/
|
|
188 |
RPointerArray<CCalEntry> iEntryList;
|
|
189 |
|
|
190 |
/**
|
|
191 |
* Calendar Instances List
|
|
192 |
*/
|
|
193 |
RPointerArray<CCalInstance> iInstanceList;
|
|
194 |
|
|
195 |
/**
|
|
196 |
* Index on list
|
|
197 |
*/
|
|
198 |
TInt iIndex;
|
|
199 |
|
|
200 |
/**
|
|
201 |
* Flag to check the validity of iEntryList;
|
|
202 |
* Only one of the iEntryList/iInstanceList can be valid
|
|
203 |
*/
|
|
204 |
TBool iIsEntryList;
|
|
205 |
|
|
206 |
/**
|
|
207 |
* Flag to check the validity of iEntryList/iInstanceList;
|
|
208 |
*/
|
|
209 |
TBool iIsResourceFree;
|
|
210 |
|
|
211 |
/**
|
|
212 |
* Calendar Interface reference
|
|
213 |
*/
|
|
214 |
CCalendarInterface& iInterface;
|
|
215 |
|
|
216 |
/**
|
|
217 |
* Calendar Name
|
|
218 |
*/
|
|
219 |
HBufC* iCalendarName;
|
|
220 |
|
|
221 |
};
|
|
222 |
|
|
223 |
/**
|
|
224 |
* An associative array or dictionary class. The collection
|
|
225 |
* key entries are of type string (Descriptor type) and their
|
|
226 |
* associated values can be an variant type.
|
|
227 |
*
|
|
228 |
* \c CLiwDefaultMap provides default map implementation to
|
|
229 |
* <ul>
|
|
230 |
* <li>insert a key-value pair</li>
|
|
231 |
* <li>find a stored value based on a key</li>
|
|
232 |
* <li>get a key based on an index</li>
|
|
233 |
* <li>remove a key-value pair based on a key</li>
|
|
234 |
* <li>get the total number of stored key-value pairs</li>
|
|
235 |
* </ul>
|
|
236 |
*
|
|
237 |
*
|
|
238 |
* @lib ServiceHandler.lib
|
|
239 |
* @since S60 5.0
|
|
240 |
*
|
|
241 |
* @see CLiwContainer
|
|
242 |
* @see TLiwVariant
|
|
243 |
* @see CLiwMap
|
|
244 |
*
|
|
245 |
*/
|
|
246 |
class CLiwCalEntryMap : public CLiwMap
|
|
247 |
{
|
|
248 |
public:
|
|
249 |
|
|
250 |
/*
|
|
251 |
* Creates an instance of CLiwCalEntryMap
|
|
252 |
*
|
|
253 |
* @param aEntry Calendar Entry
|
|
254 |
*
|
|
255 |
* @return an instance of CLiwCalEntryMap
|
|
256 |
*/
|
|
257 |
static CLiwCalEntryMap* NewL( CCalEntry* aEntry );
|
|
258 |
|
|
259 |
/*
|
|
260 |
* Creates an instance of CLiwCalEntryMap
|
|
261 |
*
|
|
262 |
* @param aEntry Calendar Entry Instance
|
|
263 |
*
|
|
264 |
* @return an instance of CLiwCalEntryMap
|
|
265 |
*/
|
|
266 |
static CLiwCalEntryMap* NewL( CCalInstance* aEntry );
|
|
267 |
|
|
268 |
/**
|
|
269 |
* Inserts a key-value pair element to the map collection. If
|
|
270 |
* the specified key already exists, it will be removed from
|
|
271 |
* the collection and the new key-value pair will be added to the
|
|
272 |
* map.
|
|
273 |
*
|
|
274 |
* @param aKey the key to be stored
|
|
275 |
* @param aValue the value associated with the key to be stored
|
|
276 |
*
|
|
277 |
* @return void
|
|
278 |
*/
|
|
279 |
void InsertL(const TDesC8& aKey, const TLiwVariant& aValue);
|
|
280 |
|
|
281 |
/**
|
|
282 |
* Finds a value stored in the map collection based on the key.
|
|
283 |
*
|
|
284 |
* @param aKey the key to be searched
|
|
285 |
* @param aFndValue the value associated with the found key
|
|
286 |
*
|
|
287 |
* @return false if there is no key stored; true otherwise
|
|
288 |
*/
|
|
289 |
TBool FindL(const TDesC8& aKey, TLiwVariant& aValue) const;
|
|
290 |
|
|
291 |
/**
|
|
292 |
* Returns the number of key-value pair stored in the map collection.
|
|
293 |
*
|
|
294 |
* @return the number of key-value pair stored in the map collection
|
|
295 |
*/
|
|
296 |
TInt Count() const;
|
|
297 |
|
|
298 |
/**
|
|
299 |
* Returns the key stored at a specified index.
|
|
300 |
*
|
|
301 |
* @param aIndex the index of the key to be found
|
|
302 |
* @param aFndKey the key found at the passed index
|
|
303 |
*
|
|
304 |
* @return true if a key-value entry is found at the passed index;
|
|
305 |
* false otherwise
|
|
306 |
*/
|
|
307 |
TBool AtL(TInt aIndex, TDes8& aFndKey) const;
|
|
308 |
|
|
309 |
/**
|
|
310 |
* Removes a key from the map collection.
|
|
311 |
*
|
|
312 |
* @param aKey the key to be removed from the map
|
|
313 |
*/
|
|
314 |
void Remove(const TDesC8& aKey);
|
|
315 |
|
|
316 |
|
|
317 |
|
|
318 |
private:
|
|
319 |
|
|
320 |
/*
|
|
321 |
* Constructor
|
|
322 |
*/
|
|
323 |
CLiwCalEntryMap( CLiwGenericParamList* aMap, CCalEntry* aEntry )
|
|
324 |
: iMap(aMap), iCalEntry(aEntry), iIsEntry(ETrue)
|
|
325 |
{}
|
|
326 |
|
|
327 |
/*
|
|
328 |
* Constructor
|
|
329 |
*/
|
|
330 |
CLiwCalEntryMap( CLiwGenericParamList* aMap, CCalInstance* aInstance )
|
|
331 |
: iMap(aMap), iCalInstance(aInstance), iIsEntry(EFalse)
|
|
332 |
{ iCalEntry = &aInstance->Entry(); }
|
|
333 |
|
|
334 |
/**
|
|
335 |
* Adds the element to the Map is it doesnot exist already
|
|
336 |
*
|
|
337 |
* @param aMap The map to be used for searching
|
|
338 |
*
|
|
339 |
* @param aKey The key to be searched
|
|
340 |
*
|
|
341 |
* @return void
|
|
342 |
*/
|
|
343 |
static void PopulateKeyL( CLiwCalEntryMap* aMap, const TDesC8& aKey );
|
|
344 |
|
|
345 |
/**
|
|
346 |
* Adds the Meeting entry element to the Map is it doesnot exist already
|
|
347 |
*
|
|
348 |
* @param aMap The map to be used for searching
|
|
349 |
*
|
|
350 |
* @param aKey The key to be searched
|
|
351 |
*
|
|
352 |
* @return void
|
|
353 |
*/
|
|
354 |
static void PopulateMeetingKeyL( CLiwCalEntryMap* aMap, const TDesC8& aKey );
|
|
355 |
|
|
356 |
|
|
357 |
/*
|
|
358 |
* Destructor
|
|
359 |
*/
|
|
360 |
virtual ~CLiwCalEntryMap();
|
|
361 |
|
|
362 |
/*
|
|
363 |
* the underlying generic parameter list
|
|
364 |
*/
|
|
365 |
CLiwGenericParamList* iMap;
|
|
366 |
|
|
367 |
/**
|
|
368 |
* CCalEntry class pointer
|
|
369 |
*/
|
|
370 |
CCalEntry* iCalEntry;
|
|
371 |
|
|
372 |
/**
|
|
373 |
* CCalInstance class pointer
|
|
374 |
*/
|
|
375 |
CCalInstance* iCalInstance;
|
|
376 |
|
|
377 |
/**
|
|
378 |
* Flag to check for the validity of iCalEntry
|
|
379 |
*/
|
|
380 |
TBool iIsEntry;
|
|
381 |
};
|
|
382 |
|
|
383 |
|
|
384 |
/**
|
|
385 |
* Implemenation of abstract interface to iterate over the collection of UIDSets
|
|
386 |
*
|
|
387 |
* @see CLiwIterable
|
|
388 |
*
|
|
389 |
*/
|
|
390 |
class CIterableUIDMapList : public CLiwIterable
|
|
391 |
{
|
|
392 |
public:
|
|
393 |
/**
|
|
394 |
* Two-phase Constructor
|
|
395 |
* @param aList list to be iterated
|
|
396 |
* @return new CIterableUIDMapList object
|
|
397 |
*/
|
|
398 |
static CIterableUIDMapList* NewL( CLiwDefaultList *aUIDMapList );
|
|
399 |
|
|
400 |
/**
|
|
401 |
* Resets the iterator.
|
|
402 |
*
|
|
403 |
*/
|
|
404 |
void Reset();
|
|
405 |
|
|
406 |
/**
|
|
407 |
* Iterates over the collection entries to fetch the next data element.
|
|
408 |
*
|
|
409 |
* @param aEntry contains the next data element and its corresponding data type
|
|
410 |
*
|
|
411 |
* @return false if there are no more data elements to be fetched;
|
|
412 |
* true otherwise
|
|
413 |
*
|
|
414 |
*/
|
|
415 |
TBool NextL(TLiwVariant&);
|
|
416 |
|
|
417 |
/**
|
|
418 |
* Destructor.
|
|
419 |
*/
|
|
420 |
~CIterableUIDMapList();
|
|
421 |
|
|
422 |
private:
|
|
423 |
|
|
424 |
/**
|
|
425 |
* Constructor
|
|
426 |
* @param aList list to be iterated
|
|
427 |
* @return void
|
|
428 |
*/
|
|
429 |
CIterableUIDMapList( CLiwDefaultList *aUIDMapList );
|
|
430 |
|
|
431 |
|
|
432 |
private:
|
|
433 |
|
|
434 |
/**
|
|
435 |
* CLiwDefaultList class pointer
|
|
436 |
*/
|
|
437 |
CLiwDefaultList *iUIDMapList;
|
|
438 |
|
|
439 |
/**
|
|
440 |
* Index on list
|
|
441 |
*/
|
|
442 |
TInt iIndex;
|
|
443 |
};
|
|
444 |
|
|
445 |
#endif __CALENDARITERABLEIMPL_H
|