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 the License "Symbian Foundation License v1.0" to Symbian Foundation members and "Symbian Foundation End User License Agreement v1.0" to non-members
5 // which accompanies this distribution, and is available
6 // at the URL "http://www.symbianfoundation.org/legal/licencesv10.html".
8 // Initial Contributors:
9 // Nokia Corporation - initial contribution.
16 #if !defined(__VCAL_H__)
19 #if !defined(__VERSIT_H__)
23 #if !defined(__VRECUR_H__)
27 _LIT(KVersitTokenVCalVersionNo, "1.0");
32 class CParserVCal : public CVersitParser
33 /** A vCalendar parser.
35 Adds support for parsing vToDos and vEvents, and associated alarms
36 (see CParserPropertyValueAlarm) to the functionality of CVersitParser.
38 Adds a constructor and overrides CVersitParser::InternalizeL() for streams,
39 ExternalizeL() for streams, RecognizeToken(), RecognizeEntityName() and MakeEntityL().
41 The vCalendar data is read from or written to a stream or file, using the
42 InternalizeL() and ExternalizeL() functions. Most users of this class will
43 only need to use these functions.
45 Note: if you are sequentially creating and destroying multiple
46 parsers, a major performance improvement may be achieved by using thread local
47 storage to store an instance of CVersitUnicodeUtils which persists and can be
48 used by all of the parsers.
50 See CVersitTlsData for more information.
57 IMPORT_C static CParserVCal* NewL();
58 public: // from CVersitParser
59 IMPORT_C void InternalizeL(RReadStream& aStream);
60 IMPORT_C void ExternalizeL(RWriteStream& aStream);
61 protected: // from CVersitParser
62 IMPORT_C CVersitParser* MakeEntityL(TInt aEntityUid,HBufC* aEntityName);
63 public: // from CVersitParser
64 IMPORT_C TUid RecognizeToken(const TDesC8& aToken) const;
65 IMPORT_C TInt RecognizeEntityName() const;
68 private: // from CVersitParser
69 IMPORT_C virtual void Reserved1();
70 IMPORT_C virtual void Reserved2();
76 class CVersitAlarm : public CBase
77 /** An alarm for a vEvent or a vTodo.
79 Specifies the date/time for the alarm, the amount of time the alarm will be
80 snoozed (optional), the number of times that the alarm will repeat, the binary
81 data of the sound to be played when the alarm runs (optional), and some text
82 to associate with the alarm (optional).
84 An object of this class is owned by the CParserPropertyValueAlarm class.
86 This class supports the following types of alarm:
90 - Display Alarm (displays message on the screen)
92 - Procedure Alarm (calls a procedure)
94 - Mail Alarm (sends an email).
101 IMPORT_C static CVersitAlarm* NewL(TVersitDateTime* aRunTime, TTime* aSnoozeTime, TInt aRepeatCount, const TDesC& aAudioContent, const TDesC& aNote);
102 IMPORT_C ~CVersitAlarm();
104 CVersitAlarm(TVersitDateTime* aRunTime, TTime* aSnoozeTime, TInt aRepeatCount);
105 void ConstructL(const TDesC& aAudioContent, const TDesC& aNote);
107 /** The date/time for the alarm. */
108 TVersitDateTime* iRunTime;
109 /** The amount of time the alarm will be snoozed (optional). */
111 /** The number of times that the alarm will repeat. */
113 /** The binary data describing the sound to play for an AALARM (optional), or
114 the string which specifies the address to send the e-mail to, for an MALARM. */
115 HBufC* iAudioContent;
116 /** The mesage to display on the screen for a DALARM (optional), or
117 the body of the e-mail to be sent for an MALARM, or the name of the procedure
118 to call for a PALARM. */
119 HBufC* iNote;//Empty except for MAlarm
122 class CVersitExtendedAlarm : public CBase
123 /** An extended alarm for a vEvent or a vTodo.
125 Specifies the date/time for the alarm, the amount of time the alarm will be
126 snoozed (optional), the number of times that the alarm will repeat, and the
127 action for the alarm.
128 An object of this class is owned by the CParserPropertyValueAlarm class.
130 This class supports the following types of alarm:
139 /** Extended Alarm's disposition types.
146 /** Inline disposition
148 EDispositionInline = 1,
149 /** Unknown disposition
151 EDispositionUnknown = 15
154 IMPORT_C static CVersitExtendedAlarm* NewL(const TDesC8& aContent,const TDesC8& aContentMimeType, CVersitExtendedAlarm::TDisposition aDisposition);
155 IMPORT_C ~CVersitExtendedAlarm();
157 CVersitExtendedAlarm();
158 void ConstructL(const TDesC8& aContent, const TDesC8& aContentMimeType, CVersitExtendedAlarm::TDisposition aContentDisposition);
160 /** The data describing the action for the alarm.*/
162 /** The MIME type of the data describing the action for the alarm.*/
164 /** The disposition of the data for the alarm action (i.e whether it is inline or an URI).*/
165 CVersitExtendedAlarm::TDisposition iDisposition;
171 class CParserVCalEntity : public CRecurrenceParser
172 /** A parser for vCalendar sub-entities.
174 A vCalendar sub-entity is a vEvent or vToDo contained in a vCalendar. vEvents
175 and vToDos are derived from CRecurrenceParser, which provides recurrence functionality.
177 vEvents and vTodos may have alarm properties (see CParserPropertyValueAlarm).
184 IMPORT_C static CParserVCalEntity* NewL();
185 IMPORT_C ~CParserVCalEntity();
186 public: // from CVersitParser
187 IMPORT_C void ExternalizeL(RWriteStream& aStream);
188 protected: // from CVersitParser
189 IMPORT_C CParserPropertyValue* MakePropertyValueL(const TUid& aPropertyUid,HBufC16*& aValue);
190 IMPORT_C CVersitAlarm* MakePropertyValueAlarmL(TPtr16 aAlarmValue);
191 IMPORT_C CVersitExtendedAlarm* MakePropertyValueExtendedAlarmL(TPtr16 aAlarmValue);
192 IMPORT_C CVersitExtendedAlarm* MakePropertyValueExtendedAlarmL(CBufSeg& aAlarmValue);
193 IMPORT_C CVersitExtendedAlarm::TDisposition DecodeDisposition(const TDesC8& aContentDispositionToken) const;
194 IMPORT_C TUid RecognizeToken(const TDesC8& aToken) const;
197 private: // from CVersitParser
198 IMPORT_C virtual void Reserved1();
199 IMPORT_C virtual void Reserved2();
204 // CParserPropertyValueAlarm
206 class CParserPropertyValueAlarm : public CParserTimePropertyValue
207 /** An alarm property value parser for a vCalendar entity.
209 An alarm can be associated with a vEvent or a vTodo. The value for the alarm
210 is stored as a CVersitAlarm.
212 Note: The UID for an alarm property value is KVCalPropertyAlarmUid.
219 IMPORT_C CParserPropertyValueAlarm(CVersitAlarm* aValue);
220 IMPORT_C CParserPropertyValueAlarm();
221 IMPORT_C ~CParserPropertyValueAlarm();
222 inline CVersitAlarm* Value() const;
223 public: // from CParserTimePropertyValue
224 IMPORT_C void ConvertAllDateTimesToUTCL(const TTimeIntervalSeconds& aIncrement,const CVersitDaylight* aDaylight);
225 IMPORT_C void ConvertAllUTCDateTimesToMachineLocalL(const TTimeIntervalSeconds& aIncrement);
226 public: // from CParserPropertyValue
227 IMPORT_C void ExternalizeL(RWriteStream& aStream,const Versit::TEncodingAndCharset& aEncodingCharset,TInt aLengthOutput);
228 IMPORT_C TBool IsAsciiCharacterSetSufficient();
230 CVersitAlarm* iValue;
235 // CParserPropertyValueExtendedAlarm
237 class CParserPropertyValueExtendedAlarm : public CParserTimePropertyValue
238 /** An extended alarm property value parser for a vCalendar entity.
240 An alarm action can be attached with a vEvent or a vTodo. The value for the alarm
241 action is stored as a CVersitExtendedAlarm object.
243 Note: The UID for an extended alarm property value is KVCalPropertyExtendedAlarmUid.
250 IMPORT_C CParserPropertyValueExtendedAlarm(CVersitExtendedAlarm* aValue);
251 IMPORT_C ~CParserPropertyValueExtendedAlarm();
252 inline CVersitExtendedAlarm* Value() const;
253 public: // from CParserTimePropertyValue
254 IMPORT_C void ConvertAllDateTimesToUTCL(const TTimeIntervalSeconds& aIncrement,const CVersitDaylight* aDaylight);
255 IMPORT_C void ConvertAllUTCDateTimesToMachineLocalL(const TTimeIntervalSeconds& aIncrement);
256 public: // from CParserPropertyValue
257 IMPORT_C void ExternalizeL(RWriteStream& aStream, const Versit::TEncodingAndCharset& aEncodingCharset, TInt aLengthOutput);
258 IMPORT_C TBool IsAsciiCharacterSetSufficient();
260 void ExternalizeUrlL(RWriteStream& aStream, const Versit::TEncodingAndCharset& aEncodingCharset, TInt aLengthOutput);
261 void ExternalizeInlineL(RWriteStream& aStream, const Versit::TEncodingAndCharset& aEncodingCharset, TInt aLengthOutput);
264 CVersitExtendedAlarm* iValue;