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".
8 // Initial Contributors:
9 // Nokia Corporation - initial contribution.
25 class CWeekDayArray : public CBase
26 /** Defines an array of the days in the week on which a 'weekly'
27 or 'monthly by position' repeat event occurs.
33 IMPORT_C CWeekDayArray();
34 IMPORT_C ~CWeekDayArray();
35 IMPORT_C void ExternalizeL(RWriteStream& aStream);
37 /** The array of days in the week. */
38 CArrayFix<TDay>* iArray;
44 class CVersitRecurrence : public CBase
45 /** Abstract base class for all recurrence property value classes.
47 A pointer to a derived recurrence property value class instance is owned by
48 the CParserPropertyValueRecurrence class.
50 Implementations of this class define when an event is to repeat.
56 IMPORT_C CVersitRecurrence(TInt aInterval,TInt aDuration,TVersitDateTime* aEndDate);
57 IMPORT_C ~CVersitRecurrence();
58 /** Externalises an occurrence list to aStream.
60 @param aStream The stream to which the occurrence list is to be externalised. */
61 virtual void ExternalizeOccurrenceListsL(RWriteStream& aStream) const=0;
71 /** Monthly repeat, by relative position within the month. */
73 /** Monthly repeat, by day number within the month. */
75 /** Yearly repeat, by specific months within the year. */
77 /** Yearly repeat, by specific days within the year. */
81 /** The type of repeat (daily, weekly etc.). */
83 /** The interval between repeats: a number of days, weeks, months or years, depending
84 on the repeat type. */
86 /** The duration in days, weeks, months or years (depending on the repeat type)
89 A value of zero indicates the repeat should continue forever. */
91 /** Specification for the date at which the repeat will end. If a duration and
92 an end date are both specified, the end date takes precedence. */
93 TVersitDateTime* iEndDate;
97 // CVersitRecurrenceDaily
99 class CVersitRecurrenceDaily : public CVersitRecurrence
100 /** Defines when a 'daily' recurrence is to be repeated.
102 Used by a repeating event (a vCalendar event or to-do) to define when it is
103 to occur. The days on which the event occurs are identified by the number
104 of days between repeats, e.g. every third day.
106 A pointer to this object may be owned by a CParserPropertyValueRecurrence
113 IMPORT_C CVersitRecurrenceDaily(TInt aInterval,TInt aDuration,TVersitDateTime* aEndDate);
114 public: //from CVersitRecurrence
115 IMPORT_C void ExternalizeOccurrenceListsL(RWriteStream& /*aStream*/) const;
119 // CVersitRecurrenceWeekly
121 class CVersitRecurrenceWeekly : public CVersitRecurrence
122 /** Defines a list of days when a 'weekly' recurrence is to be
125 Used by a repeating event (a vCalendar event or to-do) to define when it is
126 to occur. The days on which the event occurs are identified by the number
127 of weeks between repeats and the day(s) of the week on which the event occurs,
128 e.g. on Monday every other week.
130 A pointer to this object may be owned by a CParserPropertyValueRecurrence
137 IMPORT_C CVersitRecurrenceWeekly(TInt aInterval,TInt aDuration,TVersitDateTime* aEndDate,CWeekDayArray* aArrayOfWeekDayOccurrences);
138 IMPORT_C ~CVersitRecurrenceWeekly();
139 public: //from CVersitRecurrence
140 IMPORT_C void ExternalizeOccurrenceListsL(RWriteStream& aStream) const;
142 CWeekDayArray* iArrayOfWeekDayOccurrences; //Mon-Sun
146 // CVersitRecurrenceMonthlyByPos
148 class CVersitRecurrenceMonthlyByPos : public CVersitRecurrence
149 /** Defines a list of days when a 'monthly by position' recurrence
152 Used by a repeating event (a vCalendar event or to-do) to define when it is
155 The days on which the event occurs are identified by their relative position
156 within the month, for example the second Monday or the last Friday.
158 A pointer to this object may be owned by a CParserPropertyValueRecurrence
161 Note: The CMonthPosition class, defined within this class, is used to
162 define the positions of days within the month.
168 class CMonthPosition : public CBase
169 /** Defines a week within the month, using the numeric occurrence of the week
170 (between 1 and 5 inclusive) counting from either the start or end of the month,
171 and defines an array of days within this week.
177 IMPORT_C ~CMonthPosition();
179 /** Flags that define whether the week number is counted from the start or end of the month.
184 /** Indicates that the iWeekNo member specifies a number counting forwards
185 from the start of the month. */
186 EWeeksFromStartOfMonth,
187 /** Indicates that the iWeekNo member specifies a number counting backwards from
188 the end of the month. */
192 /** Indicates whether the week number iWeekNo is counted from the start or the
193 end of the month. A plus sign denotes from the start of the month and a minus
194 sign denotes from the end. */
196 /** A week number within the month, between 1 and 5 inclusive. */
198 /** Pointer to an array of week days. */
199 CWeekDayArray* iArrayOfWeekDays;
201 IMPORT_C CVersitRecurrenceMonthlyByPos(TInt aInterval,TInt aDuration,TVersitDateTime* aEndDate,CArrayPtrFlat<CMonthPosition>* aMonthPositions);
202 IMPORT_C ~CVersitRecurrenceMonthlyByPos();
204 IMPORT_C void ExternalizeOccurrenceListsL(RWriteStream& aStream) const;
206 /** Array of 'month positions' which define the days on which the event occurs. */
207 CArrayPtrFlat<CMonthPosition>* iMonthPositions;
211 // CVersitRecurrenceMonthlyByDay
213 class CVersitRecurrenceMonthlyByDay : public CVersitRecurrence
214 /** Defines a list of days when a 'monthly by day' recurrence
217 Used by a repeating event (a vCalendar event or to-do) to define when it is
220 The days on which the event occurs are identified by a number, counting
221 either from the start or the end of the month.
223 A pointer to this object may be owned by a CParserPropertyValueRecurrence
230 IMPORT_C CVersitRecurrenceMonthlyByDay(TInt aInterval,TInt aDuration,TVersitDateTime* aEndDate, CArrayFix<TInt>* aArrayOfOccurrencesInDaysFromStartOfMonth
231 ,CArrayFix<TInt>* aArrayOfOccurrencesInDaysFromEndOfMonth,TBool aLastDay);
232 IMPORT_C ~CVersitRecurrenceMonthlyByDay();
234 IMPORT_C void ExternalizeOccurrenceListsL(RWriteStream& aStream) const;
236 /** Array of days, counting from the start of the month, on which the event occurs. */
237 CArrayFix<TInt>* iArrayOfOccurrencesInDaysFromStartOfMonth; //1-31
238 /** Array of days, counting from the end of the month, on which the event occurs. */
239 CArrayFix<TInt>* iArrayOfOccurrencesInDaysFromEndOfMonth; //1-31
240 /** Identifies whether the event occurs on the last day of the month. */
245 // CVersitRecurrenceYearlyByMonth
247 class CVersitRecurrenceYearlyByMonth : public CVersitRecurrence
248 /** Defines a list of months when a 'yearly by month' recurrence
251 Used by a repeating event (a vCalendar event or to-do) to define the months
252 in which it is to occur. The months on which the event occurs are identified
253 by their number in the year (between 1 and 12 inclusive).
255 A pointer to this object may be owned by a CParserPropertyValueRecurrence
262 IMPORT_C CVersitRecurrenceYearlyByMonth(TInt aInterval,TInt aDuration,TVersitDateTime* aEndDate,CArrayFix<TMonth>* aArrayOfMonthsInYearOccurrences);
263 IMPORT_C ~CVersitRecurrenceYearlyByMonth();
265 IMPORT_C void ExternalizeOccurrenceListsL(RWriteStream& aStream) const;
267 /** Pointer to an array of month values. */
268 CArrayFix<TMonth>* iArrayOfMonthsInYearOccurrences; //Jan-Dec
272 // CVersitRecurrenceYearlyByDay
274 class CVersitRecurrenceYearlyByDay : public CVersitRecurrence
275 /** Defines a list of days when a 'yearly by day' recurrence is
278 Used by a repeating event (a vCalendar event or to-do) to define when it is
281 The days on which the repeat occurs are identified by their day number in
282 the year (between 1 and 366 inclusive).
284 A pointer to this object may be owned by a CParserPropertyValueRecurrence
291 IMPORT_C CVersitRecurrenceYearlyByDay(TInt aInterval,TInt aDuration,TVersitDateTime* aEndDate,CArrayFix<TInt>* aArrayOfDaysInYearOccurrences);
292 IMPORT_C ~CVersitRecurrenceYearlyByDay();
294 IMPORT_C void ExternalizeOccurrenceListsL(RWriteStream& aStream) const;
296 /** Pointer to an array of integers between 1 and 366 inclusive.
298 Each integer represents a day on which the repeat event occurs. */
299 CArrayFix<TInt>* iArrayOfDaysInYearOccurrences;
303 // CParserPropertyValueRecurrence
305 class CParserPropertyValueRecurrence : public CParserTimePropertyValue
306 /** A recurrence property value parser.
308 This is used to store and retrieve the recurrence information for a repeating
309 vEvent or vTodo. This information is stored as a CVersitRecurrence object.
311 The UID for a recurrence property value is KVCalPropertyRecurrenceUid.
317 IMPORT_C CParserPropertyValueRecurrence(CVersitRecurrence* aValue);
318 IMPORT_C ~CParserPropertyValueRecurrence();
319 inline CVersitRecurrence* Value() const;
320 public: // from CParserTimePropertyValue
321 IMPORT_C void ConvertAllDateTimesToUTCL(const TTimeIntervalSeconds& aIncrement,const CVersitDaylight* aDaylight);
322 IMPORT_C void ConvertAllUTCDateTimesToMachineLocalL(const TTimeIntervalSeconds& aIncrement);
323 public: // from CParserPropertyValue
324 IMPORT_C void ExternalizeL(RWriteStream& aStream,const Versit::TEncodingAndCharset& /*aEncodingCharset*/,TInt /*aLengthOutput*/);
326 CVersitRecurrence* iValue;
332 class CRecurrenceParser : public CVersitParser
333 /** Base class used in the derivation of CParserVCalEntity.
335 Provides recurrence functionality for vEvents and vToDos in vCalendars.
341 IMPORT_C CRecurrenceParser(TBool aHasVersion);
342 IMPORT_C CParserPropertyValue* MakePropertyValueRecurrenceL(TDes& aRecurringEntity);
344 static void ResetAndDestroyArrayOfMonthPositions(TAny* aObject);
345 void GetFrequencyAndIntervalL(CVersitRecurrence::TType& aFrequency,TInt& aInterval, const TDesC& aRecurrenceType);
346 CVersitRecurrence* GetFrequencyModifiersL(const CVersitRecurrence::TType& aRepeatType,TInt aInterval, const TDesC& aListDates);
347 CWeekDayArray* GetListOfWeekDayOccurrencesL(const TDesC& aListDays);
348 private: // from CVersitParser
349 IMPORT_C virtual void Reserved1();
350 IMPORT_C virtual void Reserved2();
353 #include <vrecur.inl>