|
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 __VPROP_H__ |
|
17 #define __VPROP_H__ |
|
18 |
|
19 #ifndef __E32BASE_H__ |
|
20 #include <e32base.h> |
|
21 #endif |
|
22 |
|
23 #ifndef __BADESCA_H__ |
|
24 #include <badesca.h> |
|
25 #endif |
|
26 |
|
27 #ifndef __S32STRM_H__ |
|
28 #include <s32strm.h> |
|
29 #endif |
|
30 |
|
31 #ifndef __E32MATH_H__ |
|
32 #include <e32math.h> |
|
33 #endif |
|
34 |
|
35 |
|
36 #ifndef __VUID_H__ |
|
37 #include <vuid.h> |
|
38 #endif |
|
39 |
|
40 #ifndef __VTOKEN_H__ |
|
41 #include <vtoken.h> |
|
42 #endif |
|
43 |
|
44 #ifndef __VUTIL_H__ |
|
45 #include <vutil.h> |
|
46 #endif |
|
47 |
|
48 #ifndef __S32FILE_H__ |
|
49 #include <s32file.h> |
|
50 #endif |
|
51 // |
|
52 |
|
53 class CParserProperty; |
|
54 class CVersitParser; |
|
55 class MVersitPlugIn; |
|
56 class CParserPropertyValueCDesCArray; |
|
57 |
|
58 #ifndef SYMBIAN_ENABLE_SPLIT_HEADERS |
|
59 const TInt KRandomnumberlen = 5; |
|
60 const TInt KMaxGeneratedfilenamelen =16; |
|
61 #endif |
|
62 // |
|
63 // CParserParam |
|
64 // |
|
65 |
|
66 class CParserParam : public CBase |
|
67 /** A Versit property parameter. |
|
68 |
|
69 A property parameter consists of a name and optionally a value, both in descriptor |
|
70 form. Parser properties (class CParserProperty) may own one or more property |
|
71 parameters. |
|
72 |
|
73 Note: |
|
74 |
|
75 The private parameter name and value members are stored as narrow (8-bit) |
|
76 rather than 16-bit Unicode descriptors. |
|
77 |
|
78 However, certain member functions take or return a Unicode value, |
|
79 for the purpose of backwards compatibility. In this case a simple conversion |
|
80 takes place: this ignores the top 8 bits (for Unicode -> Narrow) or adds zero |
|
81 for the top 8-bits (for Narrow->Unicode). |
|
82 @publishedAll |
|
83 @released |
|
84 */ |
|
85 { |
|
86 public: |
|
87 IMPORT_C static CParserParam* NewL(const TDesC8& aName, const TDesC8& aValue); |
|
88 IMPORT_C static CParserParam* NewL(const TDesC8& aName, const TDesC& aValue); |
|
89 IMPORT_C ~CParserParam(); |
|
90 IMPORT_C void SetValueL(const TDesC8& aValue); |
|
91 IMPORT_C void SetValueL(HBufC8* aValue); |
|
92 IMPORT_C TInt ExternalizeL(RWriteStream& aStream) const; |
|
93 IMPORT_C TPtrC8 Name() const; |
|
94 IMPORT_C TPtrC8 Value() const; |
|
95 IMPORT_C HBufC* ValueL() const; |
|
96 IMPORT_C TInt ExternalizeL(RWriteStream& aStream, TInt& aLengthOutput, CVersitParser* aVersitParser) const; |
|
97 private: |
|
98 CParserParam(HBufC8* aName, HBufC8* aValue); |
|
99 private: |
|
100 HBufC8* iParamName; |
|
101 HBufC8* iValue; |
|
102 }; |
|
103 |
|
104 // |
|
105 // TVersitDateTime |
|
106 // |
|
107 |
|
108 class TVersitDateTime |
|
109 /** Defines a Versit date and time. |
|
110 |
|
111 This class is used throughout Versit to represent the date and time. It uses |
|
112 a TDateTime object to store the date/time value and records whether this value |
|
113 is local to the machine which originated the vCard, local to the machine on |
|
114 which the code is running, or universal time (UTC). |
|
115 |
|
116 The Year(), Month() and Day() member functions of class TDateTime may be used |
|
117 to extract the date and time components from the TVersitDateTime::iDateTime. |
|
118 @publishedAll |
|
119 @released */ |
|
120 { |
|
121 public: |
|
122 /** Relative time flags. */ |
|
123 enum TRelativeTime |
|
124 { |
|
125 /** Time is stored in UTC. */ |
|
126 EIsUTC, |
|
127 /** Time is local to the machine which originated the vCard. */ |
|
128 EIsVCardLocal, |
|
129 /** Time is local to the machine on which the code is running. */ |
|
130 EIsMachineLocal, |
|
131 /** Unused. */ |
|
132 EIsCorrect |
|
133 }; |
|
134 IMPORT_C TVersitDateTime(const TDateTime& aDateTime,TRelativeTime aRelativeTime); |
|
135 |
|
136 /** Date/time flags. |
|
137 @publishedAll |
|
138 @deprecated since 9.1*/ |
|
139 enum TVersitDateTimeFlags |
|
140 { |
|
141 EExportNullFlag=0, |
|
142 /** Indicates whether the relative time is to be externalized along with the date/time |
|
143 value. |
|
144 |
|
145 The flag is set to 'EExportNullFlag' by default. |
|
146 |
|
147 This is only implemented (by CParserTimePropertyValue::EncodeVersitDateTimeL()) |
|
148 if the date/time is universal. When the flag is set, the externalised value |
|
149 is followed by the token, KVersitTokenUniversalTime. */ |
|
150 EExportTimeZoneDesignator=0x01, |
|
151 EExportLeaveAsLocalTime=0x02 |
|
152 }; |
|
153 /** |
|
154 @deprecated since 9.1 |
|
155 */ |
|
156 inline void SetFlag(TVersitDateTimeFlags aFlag) { iFlags |= aFlag; } |
|
157 /** |
|
158 @deprecated since 9.1 |
|
159 */ |
|
160 inline TBool IsFlagSet(TVersitDateTimeFlags aFlag) const { return iFlags & aFlag; } |
|
161 /** |
|
162 @deprecated since 9.1 |
|
163 */ |
|
164 inline void ClearFlag(TVersitDateTimeFlags aFlag) { iFlags &= ~aFlag; } |
|
165 public: |
|
166 /** The date/time value. */ |
|
167 TDateTime iDateTime; |
|
168 /** Specifies whether the time value is local to the machine which originated the |
|
169 vCard, local to the machine on which the code is running, or universal. */ |
|
170 TRelativeTime iRelativeTime; |
|
171 private: |
|
172 TInt iFlags; |
|
173 }; |
|
174 |
|
175 // |
|
176 // CParserPropertyValue |
|
177 // |
|
178 class CParserPropertyValue : public CBase |
|
179 /** Abstract base class for all property values. |
|
180 |
|
181 Defines a pure virtual ExternalizeL() function which should write out the |
|
182 property value to a stream. |
|
183 |
|
184 The type of derived class is returned by the Uid() function; the UID value is |
|
185 specified on construction. |
|
186 |
|
187 The other functions relate to the character set, encoding format and plug-in |
|
188 used during externalising. |
|
189 @publishedAll |
|
190 @released |
|
191 */ |
|
192 { |
|
193 public: |
|
194 /** Externalises the property value to a write stream. |
|
195 |
|
196 Implementations of this function are invoked by the parser's ExternalizeL() |
|
197 function. |
|
198 |
|
199 @param aStream Stream to which the property value is externalised. |
|
200 @param aEncodingCharset The character set and encoding information. |
|
201 @param aLengthOutput The amount of text that has been outputted so far on the |
|
202 line (for the property name), which may need to be taken into account when |
|
203 calculating if and where any line break should occur. */ |
|
204 virtual void ExternalizeL(RWriteStream& aStream,const Versit::TEncodingAndCharset& aEncodingCharset,TInt aLengthOutput)=0; |
|
205 IMPORT_C virtual TBool IsAsciiCharacterSetSufficient(); |
|
206 IMPORT_C virtual void EncodeL(CBufBase* aTarget,const TDesC8& aSource,const TUid& aEncoding) const; |
|
207 IMPORT_C virtual TBool SupportsInterface(const TUid& /*aInterfaceUid*/) const; |
|
208 inline TUid Uid() const; |
|
209 inline void SetPlugIn(MVersitPlugIn* aPlugIn); |
|
210 protected: |
|
211 IMPORT_C CParserPropertyValue(const TUid& aPropertyValueUid); |
|
212 IMPORT_C void FoldEncodeAndWriteValueToStreamL(RWriteStream& aStream, const TDesC& aValue |
|
213 ,const Versit::TEncodingAndCharset& aEncodingCharset,TInt& aLengthOutput) const; |
|
214 IMPORT_C void FoldEncodeAndWriteValueToStreamL(RWriteStream& aStream, const CDesCArray* aValueArray |
|
215 ,const Versit::TEncodingAndCharset& aEncodingCharset,TInt& aLengthOutput) const; |
|
216 IMPORT_C void FoldAndWriteValueToStreamL(RWriteStream& aStream, const TDesC& aValue |
|
217 ,const Versit::TEncodingAndCharset& aEncodingCharset,TInt& aLengthOutput) const; |
|
218 IMPORT_C static void Append(TDes16& aTarget,TDesC8& aSource); |
|
219 protected: |
|
220 inline MVersitPlugIn* PlugIn(); |
|
221 |
|
222 private: |
|
223 TUid iPropertyValueTypeUid; |
|
224 MVersitPlugIn* iPlugIn; |
|
225 }; |
|
226 |
|
227 // |
|
228 // CParserTimePropertyValue |
|
229 // |
|
230 |
|
231 class CVersitDaylight; |
|
232 |
|
233 class CParserTimePropertyValue : public CParserPropertyValue |
|
234 /** Abstract base class for all of the date/time property value classes. |
|
235 |
|
236 Provides date/time conversion functions between machine-local and universal |
|
237 time. |
|
238 |
|
239 The date/time property value classes are CParserPropertyValueAlarm, |
|
240 CParserPropertyValueDate, CParserPropertyValueDateTime, |
|
241 CParserPropertyValueMultiDateTime, CParserPropertyValueDaylight and |
|
242 CParserPropertyValueRecurrence. |
|
243 @publishedAll |
|
244 @released |
|
245 */ |
|
246 { |
|
247 public: |
|
248 /** This is implemented, where applicable, to convert date/time |
|
249 values into universal time. |
|
250 |
|
251 The date/time is checked against the daylight saving information provided |
|
252 in aDaylight. If it falls inside the daylight saving period then the daylight |
|
253 saving offset is subtracted from the time to convert it to universal time. |
|
254 Otherwise aIncrement is added to the date/time of the alarm to convert it |
|
255 to universal time. |
|
256 |
|
257 Note that the daylight savings offset will adjust the time both for the daylight |
|
258 saving and for the time zone. |
|
259 |
|
260 The function has no effect if it date/times are already stored in universal |
|
261 time. |
|
262 |
|
263 If aDaylight is a NULL pointer then aIncrement is used. |
|
264 |
|
265 @param aIncrement A time interval in seconds which represents the time zone's |
|
266 offset from universal time. |
|
267 @param aDaylight Pointer to the specification for daylight saving. If the alarm's |
|
268 time value is within the period for daylight saving, the value is modified |
|
269 by the daylight saving offset (which accounts for both the time zone and daylight |
|
270 saving rule). |
|
271 @deprecated since 9.1 |
|
272 */ |
|
273 IMPORT_C virtual void ConvertAllDateTimesToUTCL(const TTimeIntervalSeconds& aIncrement,const CVersitDaylight* aDaylight)=0; |
|
274 /** Pure virtual function which is implemented, where applicable, to convert the |
|
275 date/time property value into machine-local time. |
|
276 |
|
277 This process involves adjusting the date/time value by the offset in aIncrement. |
|
278 |
|
279 The function has no effect if the value is already stored as machine-local |
|
280 time. |
|
281 |
|
282 The universal date/times are assumed to have been corrected for any daylight saving |
|
283 rule in effect. |
|
284 |
|
285 @param aIncrement A time interval which represents the number of seconds which |
|
286 is to be added to the date/time value. This should normally be the universal |
|
287 time offset for the machine's locale. |
|
288 @deprecated since 9.1 */ |
|
289 IMPORT_C virtual void ConvertAllUTCDateTimesToMachineLocalL(const TTimeIntervalSeconds& aIncrement)=0; |
|
290 static void ConvertDateTime(TDateTime& aDateTime,const TTimeIntervalSeconds& aIncrement,const CVersitDaylight* aDaylight,TBool aTo); |
|
291 public: //from CParserPropertyValue |
|
292 IMPORT_C virtual TBool SupportsInterface(const TUid& aInterfaceUid) const; |
|
293 protected: |
|
294 IMPORT_C CParserTimePropertyValue(const TUid& aPropertyValueUid); |
|
295 IMPORT_C void ConvertDateTime(TDateTime* aDateTime,const TTimeIntervalSeconds& aIncrement,const CVersitDaylight* aDaylight); |
|
296 IMPORT_C void EncodeVersitDateTimeL(TDes8& aBuf,const TVersitDateTime& aDateTime,TBool aEncodeTime=ETrue) const; |
|
297 IMPORT_C void EncodeTimePeriodL(TDes8& aBuf,const TTime& aTimePeriod) const; |
|
298 }; |
|
299 |
|
300 // |
|
301 // CParserPropertyValueHBufC |
|
302 // |
|
303 class CParserPropertyValueHBufC : public CParserPropertyValue |
|
304 /** A heap descriptor property value parser. |
|
305 |
|
306 Many properties are stored using this class. Examples are vCard e-mails and |
|
307 vCalendar locations. |
|
308 |
|
309 The UID for a heap descriptor property value is KVersitPropertyHBufCUid. |
|
310 @publishedAll |
|
311 @released |
|
312 */ |
|
313 { |
|
314 public: |
|
315 IMPORT_C static CParserPropertyValueHBufC* NewL(const TDesC& aValue); |
|
316 IMPORT_C CParserPropertyValueHBufC(HBufC16* aValue); |
|
317 IMPORT_C ~CParserPropertyValueHBufC(); |
|
318 IMPORT_C TPtrC Value() const; |
|
319 IMPORT_C HBufC* TakeValueOwnership(); |
|
320 IMPORT_C CParserPropertyValueCDesCArray* TreatAsArrayPropertyLC(const CParserProperty& aOwningProperty) const; |
|
321 public: // from CParserPropertyValue |
|
322 IMPORT_C TBool IsAsciiCharacterSetSufficient(); |
|
323 IMPORT_C void ExternalizeL(RWriteStream& aStream,const Versit::TEncodingAndCharset& aEncodingCharset,TInt aLengthOutput); |
|
324 private: |
|
325 CParserPropertyValueHBufC(); |
|
326 void ConstructL(const TDesC& aValue); |
|
327 protected: |
|
328 HBufC* iValue; |
|
329 }; |
|
330 |
|
331 // |
|
332 // CParserPropertyValueBinary |
|
333 // |
|
334 |
|
335 class CParserPropertyValueBinary : public CParserPropertyValue |
|
336 /** A binary property value parser. |
|
337 |
|
338 It is used to store logos, photos, alarm content and binary attachment as binary values. |
|
339 |
|
340 The UID for a binary property value is KVersitPropertyBinaryUid. |
|
341 @publishedAll |
|
342 @released |
|
343 */ |
|
344 { |
|
345 public: |
|
346 IMPORT_C static CParserPropertyValueBinary* NewL(const TDesC8& aValue); |
|
347 IMPORT_C static CParserPropertyValueBinary* NewLC(const TDesC8& aValue); |
|
348 |
|
349 inline CParserPropertyValueBinary(CBufSeg& aValue); |
|
350 IMPORT_C ~CParserPropertyValueBinary(); |
|
351 IMPORT_C const CBufSeg* Value() const; |
|
352 public: // from CParserPropertyValue |
|
353 IMPORT_C void ExternalizeL(RWriteStream& aStream,const Versit::TEncodingAndCharset& aEncodingCharset,TInt /*aLengthOutput*/); |
|
354 protected: |
|
355 inline CParserPropertyValueBinary(); |
|
356 void ConstructL(const TDesC8& aValue); |
|
357 void ExternalizeL(RWriteStream& aStream, const Versit::TEncodingAndCharset& aEncodingCharset, TInt aLengthOutput, RReadStream& aReadStream); |
|
358 |
|
359 protected: |
|
360 CBufSeg* iValue; |
|
361 };// |
|
362 |
|
363 #ifndef SYMBIAN_ENABLE_SPLIT_HEADERS |
|
364 NONSHARABLE_CLASS(CParserPropertyValueBinaryFile) : public CParserPropertyValueBinary |
|
365 /** A file property value parser. |
|
366 |
|
367 It is used to store a file handle so that the binary data can be read through the handle when exporting. |
|
368 It is not used when importing. |
|
369 The UID for a binary property value is KVersitPropertyBinaryUid. |
|
370 @publishedPartner |
|
371 @released |
|
372 */ |
|
373 { |
|
374 public: |
|
375 IMPORT_C static CParserPropertyValueBinaryFile* NewL(const RFile& aFileHandle); |
|
376 IMPORT_C ~CParserPropertyValueBinaryFile(); |
|
377 public: // from CParserPropertyValue |
|
378 void ExternalizeL(RWriteStream& aStream,const Versit::TEncodingAndCharset& aEncodingCharset,TInt aLengthOutput); |
|
379 |
|
380 private: |
|
381 void ConstructL(const RFile& aFileHandle); |
|
382 private: |
|
383 RFileReadStream iFileStream; |
|
384 }; |
|
385 #endif //SYMBIAN_ENABLE_SPLIT_HEADERS |
|
386 // CParserPropertyValueCDesCArray |
|
387 // |
|
388 class CParserPropertyValueCDesCArray : public CParserPropertyValue |
|
389 /** A property value parser which stores an array of descriptors. |
|
390 |
|
391 Can be used by both vCards and vCalendars, for example to store a postal address |
|
392 or information about an organisation. |
|
393 |
|
394 The UID for a descriptor array property value is KVersitPropertyCDesCArrayUid. |
|
395 @publishedAll |
|
396 @released |
|
397 */ |
|
398 { |
|
399 public: |
|
400 IMPORT_C CParserPropertyValueCDesCArray(CDesCArray* aValue); |
|
401 IMPORT_C ~CParserPropertyValueCDesCArray(); |
|
402 inline CDesCArray* Value() const; |
|
403 IMPORT_C TBool IsPresent(const TDesC& aValue) const; |
|
404 public: // from CParserPropertyValue |
|
405 IMPORT_C TBool IsAsciiCharacterSetSufficient(); |
|
406 IMPORT_C void ExternalizeL(RWriteStream& aStream,const Versit::TEncodingAndCharset& aEncodingCharset,TInt aLengthOutput); |
|
407 protected: |
|
408 CDesCArray* iValue; |
|
409 }; |
|
410 |
|
411 // |
|
412 // CParserPropertyValueTimeZone |
|
413 // |
|
414 |
|
415 class CParserPropertyValueTimeZone: public CParserPropertyValue |
|
416 /** A time zone property value parser. |
|
417 |
|
418 Stores and externalises a property value which represents the time zone information |
|
419 for a vCard or vCalendar. |
|
420 |
|
421 The time zone is specified as the universal time offset. This is a time interval |
|
422 which is a positive or negative number of seconds from universal time. Time |
|
423 zones east of universal time have positive numbers. Time zones west of universal |
|
424 time have negative numbers. |
|
425 |
|
426 The UID for a time zone property value is KVersitPropertyTimeZoneUid. |
|
427 @publishedAll |
|
428 @released |
|
429 */ |
|
430 { |
|
431 public: |
|
432 static void EncodeTimeZone(TDes8& aBuf,TTimeIntervalSeconds iValue); |
|
433 IMPORT_C CParserPropertyValueTimeZone(TTimeIntervalSeconds aValue); |
|
434 inline TTimeIntervalSeconds Value() const; |
|
435 public: // from CParserPropertyValue |
|
436 IMPORT_C void ExternalizeL(RWriteStream& aStream,const Versit::TEncodingAndCharset& aEncodingCharset,TInt /*aLengthOutput*/); |
|
437 protected: |
|
438 TTimeIntervalSeconds iValue; |
|
439 }; |
|
440 |
|
441 // |
|
442 // CVersitDaylight |
|
443 // |
|
444 class CVersitDaylight : public CBase |
|
445 /** Universal time offset information, including the daylight savings offset. |
|
446 |
|
447 This class deals with the daylight saving offset: a one hour offset that occurs |
|
448 in many countries during part of the year. This offset needs to be taken into |
|
449 account when converting Versit times (TVersitDateTimes) between universal |
|
450 and machine-local times. |
|
451 |
|
452 This class stores information about the offset, including its length in seconds, |
|
453 when it takes effect and the standard time designations. |
|
454 |
|
455 Note that the universal offset (iOffset) is the sum of the daylight saving |
|
456 offset and any time zone offset, as it is the absolute offset from GMT. |
|
457 |
|
458 An instance of this class is owned by the CParserPropertyValueDaylight class. |
|
459 @publishedAll |
|
460 @released |
|
461 */ |
|
462 { |
|
463 public: |
|
464 IMPORT_C static CVersitDaylight* NewL(TBool aSavings, TTimeIntervalSeconds aOffset, TVersitDateTime* aStartTime, TVersitDateTime* aEndTime, const TDesC& aStandardDesignation, const TDesC& aDaylightDesignation); |
|
465 IMPORT_C ~CVersitDaylight(); |
|
466 private: |
|
467 CVersitDaylight(TBool aSavings, TTimeIntervalSeconds aOffset, TVersitDateTime* aStartTime, TVersitDateTime* aEndTime); |
|
468 void ConstructL(const TDesC& aStandardDesignation, const TDesC& aDaylightDesignation); |
|
469 public: |
|
470 /** A sort key than can be used when sorting an array of properties by start date/time. */ |
|
471 TInt64 iStartTimeSortKey; |
|
472 /** The daylight savings flag: this is ETrue if daylight saving is in effect |
|
473 in the locale and EFalse if not. */ |
|
474 TBool iSavings; |
|
475 /** The absolute offset from GMT, which is the sum of the time zone and daylight |
|
476 saving offsets (in seconds). */ |
|
477 TTimeIntervalSeconds iOffset; |
|
478 /** The date/time at which the period for daylight saving begins. */ |
|
479 TVersitDateTime* iStartTime; |
|
480 /** The date/time at which the period for daylight saving ends. */ |
|
481 TVersitDateTime* iEndTime; |
|
482 /** The standard time designation, e.g. GMT, EST. */ |
|
483 HBufC* iStandardDesignation; |
|
484 /** The daylight saving time designation, e.g. BST, EDT. */ |
|
485 HBufC* iDaylightDesignation; |
|
486 }; |
|
487 |
|
488 // |
|
489 // CParserPropertyValueDaylight |
|
490 // |
|
491 class CParserPropertyValueDaylight : public CParserTimePropertyValue |
|
492 /** A property value parser which contains the daylight savings rule for a vCalendar. |
|
493 |
|
494 The property value is stored using an instance of the CVersitDaylight class. |
|
495 |
|
496 The UID for a daylight savings rule property value is KVersitPropertyDaylightUid. |
|
497 @publishedAll |
|
498 @released |
|
499 */ |
|
500 { |
|
501 public: |
|
502 IMPORT_C CParserPropertyValueDaylight(CVersitDaylight* aValue); |
|
503 IMPORT_C ~CParserPropertyValueDaylight(); |
|
504 inline CVersitDaylight* Value() const; |
|
505 public: // from CParserTimePropertyValue |
|
506 IMPORT_C void ConvertAllDateTimesToUTCL(const TTimeIntervalSeconds& aIncrement,const CVersitDaylight* aDaylight); |
|
507 IMPORT_C void ConvertAllUTCDateTimesToMachineLocalL(const TTimeIntervalSeconds& aIncrement); |
|
508 public: // from CParserPropertyValue |
|
509 IMPORT_C void ExternalizeL(RWriteStream& aStream,const Versit::TEncodingAndCharset& aEncodingCharset,TInt aLengthOutput); |
|
510 private: |
|
511 CVersitDaylight* iValue; |
|
512 }; |
|
513 |
|
514 // |
|
515 // CParserPropertyValueDateTime |
|
516 // |
|
517 class CParserPropertyValueDateTime : public CParserTimePropertyValue |
|
518 /** A date/time property value parser. |
|
519 |
|
520 The date/time value is contained in a TVersitDateTime object. |
|
521 |
|
522 The UID for a date/time property value is KVersitPropertyDateTimeUid. |
|
523 @publishedAll |
|
524 @released |
|
525 */ |
|
526 { |
|
527 public: |
|
528 IMPORT_C CParserPropertyValueDateTime(TVersitDateTime* aValue); |
|
529 IMPORT_C ~CParserPropertyValueDateTime(); |
|
530 inline TVersitDateTime* Value() const; |
|
531 public: // from CParserTimePropertyValue |
|
532 IMPORT_C void ConvertAllDateTimesToUTCL(const TTimeIntervalSeconds& aIncrement,const CVersitDaylight* aDaylight); |
|
533 IMPORT_C void ConvertAllUTCDateTimesToMachineLocalL(const TTimeIntervalSeconds& aIncrement); |
|
534 public: // from CParserPropertyValue |
|
535 IMPORT_C void ExternalizeL(RWriteStream& aStream,const Versit::TEncodingAndCharset& /*aEncodingCharset*/,TInt /*aLengthOutput*/); |
|
536 protected: |
|
537 TVersitDateTime* iValue; |
|
538 }; |
|
539 |
|
540 // |
|
541 // CParserPropertyValueDate |
|
542 // |
|
543 class CParserPropertyValueDate : public CParserTimePropertyValue |
|
544 /** A date property value parser. |
|
545 |
|
546 The date value is contained in a TVersitDateTime object. |
|
547 |
|
548 The UID for a date property value is KVersitPropertyDateUid. |
|
549 @publishedAll |
|
550 @released |
|
551 */ |
|
552 { |
|
553 public: |
|
554 IMPORT_C CParserPropertyValueDate(TVersitDateTime* aValue); |
|
555 IMPORT_C ~CParserPropertyValueDate(); |
|
556 inline TVersitDateTime* Value() const; |
|
557 public: // from CParserTimePropertyValue |
|
558 IMPORT_C void ConvertAllDateTimesToUTCL(const TTimeIntervalSeconds& /*aIncrement*/,const CVersitDaylight* /*aDaylight*/); |
|
559 IMPORT_C void ConvertAllUTCDateTimesToMachineLocalL(const TTimeIntervalSeconds& /*aIncrement*/); |
|
560 public: // from CParserPropertyValue |
|
561 IMPORT_C void ExternalizeL(RWriteStream& aStream,const Versit::TEncodingAndCharset& aEncodingCharset,TInt /*aLengthOutput*/); |
|
562 private: |
|
563 TVersitDateTime* iValue; |
|
564 }; |
|
565 |
|
566 // |
|
567 // CParserPropertyValueMultiDateTime |
|
568 // |
|
569 class CParserPropertyValueMultiDateTime : public CParserTimePropertyValue |
|
570 /** A property value parser which stores a list of date/time values using an array |
|
571 of TVersitDateTime objects. |
|
572 |
|
573 The UID for a multiple date/time property value is KVersitPropertyMultiDateTimeUid. |
|
574 @publishedAll |
|
575 @released |
|
576 */ |
|
577 { |
|
578 public: |
|
579 IMPORT_C CParserPropertyValueMultiDateTime(CArrayPtr<TVersitDateTime>* aValue); |
|
580 IMPORT_C ~CParserPropertyValueMultiDateTime(); |
|
581 inline CArrayPtr<TVersitDateTime>* Value() const; |
|
582 public: // from CParserTimePropertyValue |
|
583 IMPORT_C void ConvertAllDateTimesToUTCL(const TTimeIntervalSeconds& aIncrement,const CVersitDaylight* aDaylight); |
|
584 IMPORT_C void ConvertAllUTCDateTimesToMachineLocalL(const TTimeIntervalSeconds& aIncrement); |
|
585 public: // from CParserPropertyValue |
|
586 IMPORT_C void ExternalizeL(RWriteStream& aStream,const Versit::TEncodingAndCharset& /*aEncodingCharset*/,TInt aLengthOutput); |
|
587 protected: |
|
588 CArrayPtr<TVersitDateTime>* iValue; |
|
589 }; |
|
590 |
|
591 // |
|
592 // CParserPropertyValueInt |
|
593 // |
|
594 class CParserPropertyValueInt : public CParserPropertyValue |
|
595 /** An integer property value parser. |
|
596 |
|
597 This stores a property value as a signed integer. For example, an employee |
|
598 ID number might be stored using this class. |
|
599 |
|
600 The UID for an integer property value is KVersitPropertyIntUid. |
|
601 @publishedAll |
|
602 @released |
|
603 */ |
|
604 { |
|
605 public: |
|
606 IMPORT_C CParserPropertyValueInt(TInt aValue); |
|
607 inline TInt Value() const; |
|
608 public: // from CParserPropertyValue |
|
609 IMPORT_C void ExternalizeL(RWriteStream& aStream,const Versit::TEncodingAndCharset& aEncodingCharset,TInt /*aLengthOutput*/); |
|
610 protected: |
|
611 TInt iValue; |
|
612 }; |
|
613 |
|
614 // |
|
615 // CParserProperty |
|
616 // |
|
617 |
|
618 class CParserProperty : public CBase |
|
619 /** A vCard or vCalendar property. |
|
620 |
|
621 A property consists of a name, an optional value and one or more optional |
|
622 parameters. |
|
623 |
|
624 The name, value and parameters are initialised on construction. |
|
625 |
|
626 Versit properties have the general form: |
|
627 |
|
628 Property Name (; Property Parameter Name(=Property Parameter Value)* : Property |
|
629 Value) |
|
630 |
|
631 where items in brackets are optional and * indicates that the item may be |
|
632 repeated. |
|
633 |
|
634 For instance, TEL; HOME; ENCODING=QUOTED-PRINTABLE; CHARSET=US-ASCII : 01234 567890 |
|
635 |
|
636 Here, TEL is the property name; HOME, ENCODING and CHARSET are property parameter |
|
637 names; QUOTED-PRINTABLE and US-ASCII are property parameter values. The component |
|
638 following the colon is the property value. |
|
639 |
|
640 Properties also have a name UID, which set during internalisation of a property |
|
641 and used only during internalisation. It is set by SetNameUid() and is used |
|
642 to allow number comparisons during internalisation. This provides a faster |
|
643 alternative to string comparisons when checking a property to see if it is |
|
644 a significant one (e.g. a begin or binary property). This is the only use |
|
645 of the name UID: it is not used during externalisation of a property. |
|
646 |
|
647 Note that grouped properties are supported by the derived class, CParserGroupedProperty. |
|
648 The vCalender parser does not have property groups, and so stores all properties |
|
649 using this base class, whereas the vCard parser stores all properties using |
|
650 CParserGroupedProperty. |
|
651 @publishedAll |
|
652 @released |
|
653 */ |
|
654 { |
|
655 public: |
|
656 IMPORT_C static CParserProperty* NewL(CParserPropertyValue& aPropertyValue, const TDesC8& aName, CArrayPtr<CParserParam>* aArrayOfParams); |
|
657 IMPORT_C CParserProperty(CArrayPtr<CParserParam>* aArrayOfParams); |
|
658 IMPORT_C ~CParserProperty(); |
|
659 IMPORT_C virtual void ExternalizeL(RWriteStream& aStream, CVersitParser* aVersitParser = NULL); |
|
660 IMPORT_C CParserParam* Param(const TDesC8& aParamName) const; // note params can only appear once |
|
661 IMPORT_C void AddParamL(CParserParam* aParam); |
|
662 IMPORT_C void DeleteParam(TDesC8& aParamName); |
|
663 IMPORT_C void SetNameL(const TDesC8& aName); |
|
664 IMPORT_C virtual TBool SupportsInterface(const TUid& /*aInterfaceUid*/) const; |
|
665 IMPORT_C TPtrC8 Name() const; |
|
666 inline void SetValue(CParserPropertyValue* aPropertyValue); |
|
667 inline CParserPropertyValue* Value() const; |
|
668 inline TUid Uid() const; |
|
669 inline void SetNameUid(TUid aUid); |
|
670 inline TUid NameUid() const; |
|
671 inline void SetParamArray(CArrayPtr<CParserParam>* aArrayOfParams); |
|
672 |
|
673 |
|
674 IMPORT_C TBool LoadBinaryValuesFromFilesL(RFs& aFileSession); |
|
675 IMPORT_C TBool SaveBinaryValuesToFilesL(TInt aSizeThreshold,const TDesC& aPath,RFs& aFileSession); |
|
676 protected: |
|
677 IMPORT_C CParserProperty(CParserPropertyValue& aPropertyValue, CArrayPtr<CParserParam>* aArrayOfParams); |
|
678 IMPORT_C static void ConstructSelfL(CParserProperty& aSelf,const TDesC8& aName); |
|
679 |
|
680 public: |
|
681 IMPORT_C CArrayPtr<CParserParam>* ParamArray()const; |
|
682 |
|
683 protected: |
|
684 CParserPropertyValue* iPropertyValue; |
|
685 HBufC8* iPropertyName; |
|
686 TUid iPropertyNameUid; |
|
687 CArrayPtr<CParserParam>* iArrayOfParams; |
|
688 |
|
689 private: |
|
690 friend class CVersitParser; |
|
691 inline HBufC8*& NameBuf(); |
|
692 IMPORT_C virtual void Reserved(); |
|
693 void ReadBinaryDataL(const CBufSeg* aBufseg_ptr,HBufC8** aBuffer); |
|
694 void GenerateNameAndCreateFileL(RFs& aFileSession,TPtr8 aPropertyName,RFile& aFile,TDes& aFileName); |
|
695 |
|
696 }; |
|
697 |
|
698 #include <vprop.inl> |
|
699 |
|
700 #endif |