1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/epoc32/include/app/vrecur.h Wed Mar 31 12:27:01 2010 +0100
1.3 @@ -0,0 +1,355 @@
1.4 +// Copyright (c) 1997-2009 Nokia Corporation and/or its subsidiary(-ies).
1.5 +// All rights reserved.
1.6 +// This component and the accompanying materials are made available
1.7 +// 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
1.8 +// which accompanies this distribution, and is available
1.9 +// at the URL "http://www.symbianfoundation.org/legal/licencesv10.html".
1.10 +//
1.11 +// Initial Contributors:
1.12 +// Nokia Corporation - initial contribution.
1.13 +//
1.14 +// Contributors:
1.15 +//
1.16 +// Description:
1.17 +//
1.18 +
1.19 +#ifndef __VRECUR_H__
1.20 +#define __VRECUR_H__
1.21 +
1.22 +#include <versit.h>
1.23 +
1.24 +//
1.25 +// CWeekDayArray
1.26 +//
1.27 +
1.28 +class CWeekDayArray : public CBase
1.29 +/** Defines an array of the days in the week on which a 'weekly'
1.30 +or 'monthly by position' repeat event occurs.
1.31 +@publishedAll
1.32 +@released
1.33 +*/
1.34 + {
1.35 +public:
1.36 + IMPORT_C CWeekDayArray();
1.37 + IMPORT_C ~CWeekDayArray();
1.38 + IMPORT_C void ExternalizeL(RWriteStream& aStream);
1.39 +public:
1.40 + /** The array of days in the week. */
1.41 + CArrayFix<TDay>* iArray;
1.42 + };
1.43 +
1.44 +//
1.45 +// CVersitRecurrence
1.46 +//
1.47 +class CVersitRecurrence : public CBase
1.48 +/** Abstract base class for all recurrence property value classes.
1.49 +
1.50 +A pointer to a derived recurrence property value class instance is owned by
1.51 +the CParserPropertyValueRecurrence class.
1.52 +
1.53 +Implementations of this class define when an event is to repeat.
1.54 +@publishedAll
1.55 +@released
1.56 +*/
1.57 + {
1.58 +public:
1.59 + IMPORT_C CVersitRecurrence(TInt aInterval,TInt aDuration,TVersitDateTime* aEndDate);
1.60 + IMPORT_C ~CVersitRecurrence();
1.61 + /** Externalises an occurrence list to aStream.
1.62 +
1.63 + @param aStream The stream to which the occurrence list is to be externalised. */
1.64 + virtual void ExternalizeOccurrenceListsL(RWriteStream& aStream) const=0;
1.65 + /** Repeat type.
1.66 + @publishedAll
1.67 + @released */
1.68 + enum TType
1.69 + {
1.70 + /** Daily repeat. */
1.71 + EDaily=1,
1.72 + /** Weekly repeat. */
1.73 + EWeekly,
1.74 + /** Monthly repeat, by relative position within the month. */
1.75 + EMonthlyByPos,
1.76 + /** Monthly repeat, by day number within the month. */
1.77 + EMonthlyByDay,
1.78 + /** Yearly repeat, by specific months within the year. */
1.79 + EYearlyByMonth,
1.80 + /** Yearly repeat, by specific days within the year. */
1.81 + EYearlyByDay
1.82 + };
1.83 +public:
1.84 + /** The type of repeat (daily, weekly etc.). */
1.85 + TType iRepeatType;
1.86 + /** The interval between repeats: a number of days, weeks, months or years, depending
1.87 + on the repeat type. */
1.88 + TInt iInterval;
1.89 + /** The duration in days, weeks, months or years (depending on the repeat type)
1.90 + for the repeat.
1.91 +
1.92 + A value of zero indicates the repeat should continue forever. */
1.93 + TInt iDuration;
1.94 + /** Specification for the date at which the repeat will end. If a duration and
1.95 + an end date are both specified, the end date takes precedence. */
1.96 + TVersitDateTime* iEndDate;
1.97 + };
1.98 +
1.99 +//
1.100 +// CVersitRecurrenceDaily
1.101 +//
1.102 +class CVersitRecurrenceDaily : public CVersitRecurrence
1.103 +/** Defines when a 'daily' recurrence is to be repeated.
1.104 +
1.105 +Used by a repeating event (a vCalendar event or to-do) to define when it is
1.106 +to occur. The days on which the event occurs are identified by the number
1.107 +of days between repeats, e.g. every third day.
1.108 +
1.109 +A pointer to this object may be owned by a CParserPropertyValueRecurrence
1.110 +object.
1.111 +@publishedAll
1.112 +@released
1.113 +*/
1.114 + {
1.115 +public:
1.116 + IMPORT_C CVersitRecurrenceDaily(TInt aInterval,TInt aDuration,TVersitDateTime* aEndDate);
1.117 +public: //from CVersitRecurrence
1.118 + IMPORT_C void ExternalizeOccurrenceListsL(RWriteStream& /*aStream*/) const;
1.119 + };
1.120 +
1.121 +//
1.122 +// CVersitRecurrenceWeekly
1.123 +//
1.124 +class CVersitRecurrenceWeekly : public CVersitRecurrence
1.125 +/** Defines a list of days when a 'weekly' recurrence is to be
1.126 +repeated.
1.127 +
1.128 +Used by a repeating event (a vCalendar event or to-do) to define when it is
1.129 +to occur. The days on which the event occurs are identified by the number
1.130 +of weeks between repeats and the day(s) of the week on which the event occurs,
1.131 +e.g. on Monday every other week.
1.132 +
1.133 +A pointer to this object may be owned by a CParserPropertyValueRecurrence
1.134 +object.
1.135 +@publishedAll
1.136 +@released
1.137 +*/
1.138 + {
1.139 +public:
1.140 + IMPORT_C CVersitRecurrenceWeekly(TInt aInterval,TInt aDuration,TVersitDateTime* aEndDate,CWeekDayArray* aArrayOfWeekDayOccurrences);
1.141 + IMPORT_C ~CVersitRecurrenceWeekly();
1.142 +public: //from CVersitRecurrence
1.143 + IMPORT_C void ExternalizeOccurrenceListsL(RWriteStream& aStream) const;
1.144 +public:
1.145 + CWeekDayArray* iArrayOfWeekDayOccurrences; //Mon-Sun
1.146 + };
1.147 +
1.148 +//
1.149 +// CVersitRecurrenceMonthlyByPos
1.150 +//
1.151 +class CVersitRecurrenceMonthlyByPos : public CVersitRecurrence
1.152 +/** Defines a list of days when a 'monthly by position' recurrence
1.153 +is to be repeated.
1.154 +
1.155 +Used by a repeating event (a vCalendar event or to-do) to define when it is
1.156 +to occur.
1.157 +
1.158 +The days on which the event occurs are identified by their relative position
1.159 +within the month, for example the second Monday or the last Friday.
1.160 +
1.161 +A pointer to this object may be owned by a CParserPropertyValueRecurrence
1.162 +object
1.163 +
1.164 +Note: The CMonthPosition class, defined within this class, is used to
1.165 +define the positions of days within the month.
1.166 +@publishedAll
1.167 +@released
1.168 +*/
1.169 + {
1.170 +public:
1.171 + class CMonthPosition : public CBase
1.172 + /** Defines a week within the month, using the numeric occurrence of the week
1.173 + (between 1 and 5 inclusive) counting from either the start or end of the month,
1.174 + and defines an array of days within this week.
1.175 + @publishedAll
1.176 + @released
1.177 + */
1.178 + {
1.179 + public:
1.180 + IMPORT_C ~CMonthPosition();
1.181 + public:
1.182 + /** Flags that define whether the week number is counted from the start or end of the month.
1.183 + @publishedAll
1.184 + @released */
1.185 + enum TSign
1.186 + {
1.187 + /** Indicates that the iWeekNo member specifies a number counting forwards
1.188 + from the start of the month. */
1.189 + EWeeksFromStartOfMonth,
1.190 + /** Indicates that the iWeekNo member specifies a number counting backwards from
1.191 + the end of the month. */
1.192 + EWeeksFromEndOfMonth
1.193 + };
1.194 + public:
1.195 + /** Indicates whether the week number iWeekNo is counted from the start or the
1.196 + end of the month. A plus sign denotes from the start of the month and a minus
1.197 + sign denotes from the end. */
1.198 + TSign iSign;
1.199 + /** A week number within the month, between 1 and 5 inclusive. */
1.200 + TInt iWeekNo;
1.201 + /** Pointer to an array of week days. */
1.202 + CWeekDayArray* iArrayOfWeekDays;
1.203 + };
1.204 + IMPORT_C CVersitRecurrenceMonthlyByPos(TInt aInterval,TInt aDuration,TVersitDateTime* aEndDate,CArrayPtrFlat<CMonthPosition>* aMonthPositions);
1.205 + IMPORT_C ~CVersitRecurrenceMonthlyByPos();
1.206 +public: //framework
1.207 + IMPORT_C void ExternalizeOccurrenceListsL(RWriteStream& aStream) const;
1.208 +public:
1.209 + /** Array of 'month positions' which define the days on which the event occurs. */
1.210 + CArrayPtrFlat<CMonthPosition>* iMonthPositions;
1.211 + };
1.212 +
1.213 +//
1.214 +// CVersitRecurrenceMonthlyByDay
1.215 +//
1.216 +class CVersitRecurrenceMonthlyByDay : public CVersitRecurrence
1.217 +/** Defines a list of days when a 'monthly by day' recurrence
1.218 +is to repeat.
1.219 +
1.220 +Used by a repeating event (a vCalendar event or to-do) to define when it is
1.221 +to occur.
1.222 +
1.223 +The days on which the event occurs are identified by a number, counting
1.224 +either from the start or the end of the month.
1.225 +
1.226 +A pointer to this object may be owned by a CParserPropertyValueRecurrence
1.227 +object.
1.228 +@publishedAll
1.229 +@released
1.230 +*/
1.231 + {
1.232 +public:
1.233 + IMPORT_C CVersitRecurrenceMonthlyByDay(TInt aInterval,TInt aDuration,TVersitDateTime* aEndDate, CArrayFix<TInt>* aArrayOfOccurrencesInDaysFromStartOfMonth
1.234 + ,CArrayFix<TInt>* aArrayOfOccurrencesInDaysFromEndOfMonth,TBool aLastDay);
1.235 + IMPORT_C ~CVersitRecurrenceMonthlyByDay();
1.236 +public: //framework
1.237 + IMPORT_C void ExternalizeOccurrenceListsL(RWriteStream& aStream) const;
1.238 +public:
1.239 + /** Array of days, counting from the start of the month, on which the event occurs. */
1.240 + CArrayFix<TInt>* iArrayOfOccurrencesInDaysFromStartOfMonth; //1-31
1.241 + /** Array of days, counting from the end of the month, on which the event occurs. */
1.242 + CArrayFix<TInt>* iArrayOfOccurrencesInDaysFromEndOfMonth; //1-31
1.243 + /** Identifies whether the event occurs on the last day of the month. */
1.244 + TBool iLastDay;
1.245 + };
1.246 +
1.247 +//
1.248 +// CVersitRecurrenceYearlyByMonth
1.249 +//
1.250 +class CVersitRecurrenceYearlyByMonth : public CVersitRecurrence
1.251 +/** Defines a list of months when a 'yearly by month' recurrence
1.252 +is to repeat.
1.253 +
1.254 +Used by a repeating event (a vCalendar event or to-do) to define the months
1.255 +in which it is to occur. The months on which the event occurs are identified
1.256 +by their number in the year (between 1 and 12 inclusive).
1.257 +
1.258 +A pointer to this object may be owned by a CParserPropertyValueRecurrence
1.259 +object.
1.260 +@publishedAll
1.261 +@released
1.262 +*/
1.263 + {
1.264 +public:
1.265 + IMPORT_C CVersitRecurrenceYearlyByMonth(TInt aInterval,TInt aDuration,TVersitDateTime* aEndDate,CArrayFix<TMonth>* aArrayOfMonthsInYearOccurrences);
1.266 + IMPORT_C ~CVersitRecurrenceYearlyByMonth();
1.267 +public: //framework
1.268 + IMPORT_C void ExternalizeOccurrenceListsL(RWriteStream& aStream) const;
1.269 +public:
1.270 + /** Pointer to an array of month values. */
1.271 + CArrayFix<TMonth>* iArrayOfMonthsInYearOccurrences; //Jan-Dec
1.272 + };
1.273 +
1.274 +//
1.275 +// CVersitRecurrenceYearlyByDay
1.276 +//
1.277 +class CVersitRecurrenceYearlyByDay : public CVersitRecurrence
1.278 +/** Defines a list of days when a 'yearly by day' recurrence is
1.279 +to be repeated.
1.280 +
1.281 +Used by a repeating event (a vCalendar event or to-do) to define when it is
1.282 +to occur.
1.283 +
1.284 +The days on which the repeat occurs are identified by their day number in
1.285 +the year (between 1 and 366 inclusive).
1.286 +
1.287 +A pointer to this object may be owned by a CParserPropertyValueRecurrence
1.288 +object.
1.289 +@publishedAll
1.290 +@released
1.291 +*/
1.292 + {
1.293 +public:
1.294 + IMPORT_C CVersitRecurrenceYearlyByDay(TInt aInterval,TInt aDuration,TVersitDateTime* aEndDate,CArrayFix<TInt>* aArrayOfDaysInYearOccurrences);
1.295 + IMPORT_C ~CVersitRecurrenceYearlyByDay();
1.296 +public: //framework
1.297 + IMPORT_C void ExternalizeOccurrenceListsL(RWriteStream& aStream) const;
1.298 +public:
1.299 + /** Pointer to an array of integers between 1 and 366 inclusive.
1.300 +
1.301 + Each integer represents a day on which the repeat event occurs. */
1.302 + CArrayFix<TInt>* iArrayOfDaysInYearOccurrences;
1.303 + };
1.304 +
1.305 +//
1.306 +// CParserPropertyValueRecurrence
1.307 +//
1.308 +class CParserPropertyValueRecurrence : public CParserTimePropertyValue
1.309 +/** A recurrence property value parser.
1.310 +
1.311 +This is used to store and retrieve the recurrence information for a repeating
1.312 +vEvent or vTodo. This information is stored as a CVersitRecurrence object.
1.313 +
1.314 +The UID for a recurrence property value is KVCalPropertyRecurrenceUid.
1.315 +@publishedAll
1.316 +@released
1.317 +*/
1.318 + {
1.319 +public:
1.320 + IMPORT_C CParserPropertyValueRecurrence(CVersitRecurrence* aValue);
1.321 + IMPORT_C ~CParserPropertyValueRecurrence();
1.322 + inline CVersitRecurrence* Value() const;
1.323 +public: // from CParserTimePropertyValue
1.324 + IMPORT_C void ConvertAllDateTimesToUTCL(const TTimeIntervalSeconds& aIncrement,const CVersitDaylight* aDaylight);
1.325 + IMPORT_C void ConvertAllUTCDateTimesToMachineLocalL(const TTimeIntervalSeconds& aIncrement);
1.326 +public: // from CParserPropertyValue
1.327 + IMPORT_C void ExternalizeL(RWriteStream& aStream,const Versit::TEncodingAndCharset& /*aEncodingCharset*/,TInt /*aLengthOutput*/);
1.328 +protected:
1.329 + CVersitRecurrence* iValue;
1.330 + };
1.331 +
1.332 +//
1.333 +// CRecurrenceParser
1.334 +//
1.335 +class CRecurrenceParser : public CVersitParser
1.336 +/** Base class used in the derivation of CParserVCalEntity.
1.337 +
1.338 +Provides recurrence functionality for vEvents and vToDos in vCalendars.
1.339 +@publishedAll
1.340 +@released
1.341 +*/
1.342 + {
1.343 +public:
1.344 + IMPORT_C CRecurrenceParser(TBool aHasVersion);
1.345 + IMPORT_C CParserPropertyValue* MakePropertyValueRecurrenceL(TDes& aRecurringEntity);
1.346 +private:
1.347 + static void ResetAndDestroyArrayOfMonthPositions(TAny* aObject);
1.348 + void GetFrequencyAndIntervalL(CVersitRecurrence::TType& aFrequency,TInt& aInterval, const TDesC& aRecurrenceType);
1.349 + CVersitRecurrence* GetFrequencyModifiersL(const CVersitRecurrence::TType& aRepeatType,TInt aInterval, const TDesC& aListDates);
1.350 + CWeekDayArray* GetListOfWeekDayOccurrencesL(const TDesC& aListDays);
1.351 +private: // from CVersitParser
1.352 + IMPORT_C virtual void Reserved1();
1.353 + IMPORT_C virtual void Reserved2();
1.354 + };
1.355 +
1.356 +#include <vrecur.inl>
1.357 +
1.358 +#endif