epoc32/include/app/vrecur.h
author William Roberts <williamr@symbian.org>
Wed, 31 Mar 2010 12:33:34 +0100
branchSymbian3
changeset 4 837f303aceeb
parent 3 e1b950c65cb4
permissions -rw-r--r--
Current Symbian^3 public API header files (from PDK 3.0.h)
This is the epoc32/include tree with the "platform" subtrees removed, and
all but a selected few mbg and rsg files removed.
     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 __VRECUR_H__
    17 #define __VRECUR_H__
    18 
    19 #include <versit.h>
    20 
    21 //
    22 // CWeekDayArray
    23 //
    24 
    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. 
    28 @publishedAll
    29 @released
    30 */
    31 	{
    32 public:
    33 	IMPORT_C CWeekDayArray();
    34 	IMPORT_C ~CWeekDayArray();
    35 	IMPORT_C void ExternalizeL(RWriteStream& aStream);
    36 public:	
    37 	/** The array of days in the week. */
    38 	CArrayFix<TDay>* iArray;
    39 	};
    40 
    41 //
    42 // CVersitRecurrence
    43 //
    44 class CVersitRecurrence : public CBase
    45 /** Abstract base class for all recurrence property value classes.
    46 
    47 A pointer to a derived recurrence property value class instance is owned by 
    48 the CParserPropertyValueRecurrence class.
    49 
    50 Implementations of this class define when an event is to repeat. 
    51 @publishedAll
    52 @released
    53 */
    54 	{
    55 public:
    56 	IMPORT_C CVersitRecurrence(TInt aInterval,TInt aDuration,TVersitDateTime* aEndDate);
    57 	IMPORT_C ~CVersitRecurrence();
    58 	/** Externalises an occurrence list to aStream.
    59 	
    60 	@param aStream The stream to which the occurrence list is to be externalised. */
    61 	virtual void ExternalizeOccurrenceListsL(RWriteStream& aStream) const=0;
    62 	/** Repeat type. 
    63 	@publishedAll
    64 	@released */
    65 	enum TType
    66 		{
    67 		/** Daily repeat. */
    68 		EDaily=1,
    69 		/** Weekly repeat. */
    70 		EWeekly,
    71 		/** Monthly repeat, by relative position within the month. */
    72 		EMonthlyByPos,
    73 		/** Monthly repeat, by day number within the month. */
    74 		EMonthlyByDay,
    75 		/** Yearly repeat, by specific months within the year. */
    76 		EYearlyByMonth,
    77 		/** Yearly repeat, by specific days within the year. */
    78 		EYearlyByDay
    79 		};
    80 public:
    81 	/** The type of repeat (daily, weekly etc.). */
    82 	TType iRepeatType;
    83 	/** The interval between repeats: a number of days, weeks, months or years, depending 
    84 	on the repeat type. */
    85 	TInt iInterval;
    86 	/** The duration in days, weeks, months or years (depending on the repeat type) 
    87 	for the repeat.
    88 	
    89 	A value of zero indicates the repeat should continue forever. */
    90 	TInt iDuration;
    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;
    94 	};
    95 
    96 //
    97 // CVersitRecurrenceDaily
    98 //
    99 class CVersitRecurrenceDaily : public CVersitRecurrence
   100 /** Defines when a 'daily' recurrence is to be repeated.
   101 
   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.
   105 
   106 A pointer to this object may be owned by a CParserPropertyValueRecurrence 
   107 object. 
   108 @publishedAll
   109 @released
   110 */
   111 	{
   112 public:
   113 	IMPORT_C CVersitRecurrenceDaily(TInt aInterval,TInt aDuration,TVersitDateTime* aEndDate);
   114 public: //from CVersitRecurrence
   115 	IMPORT_C void ExternalizeOccurrenceListsL(RWriteStream& /*aStream*/) const;
   116 	};
   117 
   118 //
   119 //	CVersitRecurrenceWeekly
   120 //
   121 class CVersitRecurrenceWeekly : public CVersitRecurrence
   122 /** Defines a list of days when a 'weekly' recurrence is to be 
   123 repeated.
   124 
   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.
   129 
   130 A pointer to this object may be owned by a CParserPropertyValueRecurrence 
   131 object. 
   132 @publishedAll
   133 @released
   134 */
   135 	{
   136 public:
   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;
   141 public:
   142 	CWeekDayArray* iArrayOfWeekDayOccurrences;		//Mon-Sun
   143 	};
   144 
   145 //
   146 // CVersitRecurrenceMonthlyByPos
   147 //
   148 class CVersitRecurrenceMonthlyByPos : public CVersitRecurrence
   149 /** Defines a list of days when a 'monthly by position' recurrence 
   150 is to be repeated.
   151 
   152 Used by a repeating event (a vCalendar event or to-do) to define when it is 
   153 to occur.
   154 
   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.
   157 
   158 A pointer to this object may be owned by a CParserPropertyValueRecurrence 
   159 object
   160 
   161 Note: The CMonthPosition class, defined within this class, is used to 
   162 define the positions of days within the month. 
   163 @publishedAll
   164 @released
   165 */
   166 	{
   167 public:
   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. 
   172 	@publishedAll
   173 	@released
   174 	*/
   175 		{
   176 	public:
   177 		IMPORT_C ~CMonthPosition();
   178 	public:
   179 		/** Flags that define whether the week number is counted from the start or end of the month. 
   180 		@publishedAll
   181 		@released */
   182 		enum TSign 
   183 				{
   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. */
   189 				EWeeksFromEndOfMonth
   190 				};
   191 	public:
   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. */
   195 		TSign iSign;
   196 		/** A week number within the month, between 1 and 5 inclusive. */
   197 		TInt iWeekNo;
   198 		/** Pointer to an array of week days. */
   199 		CWeekDayArray* iArrayOfWeekDays;
   200 		};
   201 	IMPORT_C CVersitRecurrenceMonthlyByPos(TInt aInterval,TInt aDuration,TVersitDateTime* aEndDate,CArrayPtrFlat<CMonthPosition>* aMonthPositions);
   202 	IMPORT_C ~CVersitRecurrenceMonthlyByPos();
   203 public: //framework
   204 	IMPORT_C void ExternalizeOccurrenceListsL(RWriteStream& aStream) const;
   205 public:
   206 	/** Array of 'month positions' which define the days on which the event occurs. */
   207 	CArrayPtrFlat<CMonthPosition>* iMonthPositions;
   208 	};
   209 
   210 //
   211 // CVersitRecurrenceMonthlyByDay
   212 //
   213 class CVersitRecurrenceMonthlyByDay : public CVersitRecurrence
   214 /** Defines a list of days when a 'monthly by day' recurrence 
   215 is to repeat.
   216 
   217 Used by a repeating event (a vCalendar event or to-do) to define when it is 
   218 to occur.
   219 
   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.
   222 
   223 A pointer to this object may be owned by a CParserPropertyValueRecurrence 
   224 object. 
   225 @publishedAll
   226 @released
   227 */
   228 	{
   229 public:
   230 	IMPORT_C CVersitRecurrenceMonthlyByDay(TInt aInterval,TInt aDuration,TVersitDateTime* aEndDate,	CArrayFix<TInt>* aArrayOfOccurrencesInDaysFromStartOfMonth
   231 		,CArrayFix<TInt>* aArrayOfOccurrencesInDaysFromEndOfMonth,TBool aLastDay);
   232 	IMPORT_C ~CVersitRecurrenceMonthlyByDay();
   233 public: //framework
   234 	IMPORT_C void ExternalizeOccurrenceListsL(RWriteStream& aStream) const;
   235 public:
   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. */
   241 	TBool iLastDay;
   242 	};
   243 
   244 //
   245 // CVersitRecurrenceYearlyByMonth
   246 //
   247 class CVersitRecurrenceYearlyByMonth : public CVersitRecurrence
   248 /** Defines a list of months when a 'yearly by month' recurrence 
   249 is to repeat.
   250 
   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).
   254 
   255 A pointer to this object may be owned by a CParserPropertyValueRecurrence 
   256 object. 
   257 @publishedAll
   258 @released
   259 */
   260 	{
   261 public:
   262 	IMPORT_C CVersitRecurrenceYearlyByMonth(TInt aInterval,TInt aDuration,TVersitDateTime* aEndDate,CArrayFix<TMonth>* aArrayOfMonthsInYearOccurrences);
   263 	IMPORT_C ~CVersitRecurrenceYearlyByMonth();
   264 public: //framework
   265 	IMPORT_C void ExternalizeOccurrenceListsL(RWriteStream& aStream) const;
   266 public:
   267 	/** Pointer to an array of month values. */
   268 	CArrayFix<TMonth>* iArrayOfMonthsInYearOccurrences; //Jan-Dec
   269 	};
   270 
   271 //
   272 // CVersitRecurrenceYearlyByDay
   273 //
   274 class CVersitRecurrenceYearlyByDay : public CVersitRecurrence
   275 /** Defines a list of days when a 'yearly by day' recurrence is 
   276 to be repeated.
   277 
   278 Used by a repeating event (a vCalendar event or to-do) to define when it is 
   279 to occur.
   280 
   281 The days on which the repeat occurs are identified by their day number in 
   282 the year (between 1 and 366 inclusive).
   283 
   284 A pointer to this object may be owned by a CParserPropertyValueRecurrence 
   285 object. 
   286 @publishedAll
   287 @released
   288 */
   289 	{
   290 public:
   291 	IMPORT_C CVersitRecurrenceYearlyByDay(TInt aInterval,TInt aDuration,TVersitDateTime* aEndDate,CArrayFix<TInt>* aArrayOfDaysInYearOccurrences);
   292 	IMPORT_C ~CVersitRecurrenceYearlyByDay();
   293 public: //framework
   294 	IMPORT_C void ExternalizeOccurrenceListsL(RWriteStream& aStream) const;
   295 public:
   296 	/** Pointer to an array of integers between 1 and 366 inclusive. 
   297 	
   298 	Each integer represents a day on which the repeat event occurs. */
   299 	CArrayFix<TInt>* iArrayOfDaysInYearOccurrences; 
   300 	};
   301 
   302 //
   303 // CParserPropertyValueRecurrence
   304 //
   305 class CParserPropertyValueRecurrence : public CParserTimePropertyValue
   306 /** A recurrence property value parser.
   307 
   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.
   310 
   311 The UID for a recurrence property value is KVCalPropertyRecurrenceUid. 
   312 @publishedAll
   313 @released
   314 */
   315 	{
   316 public:
   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*/);
   325 protected:
   326 	CVersitRecurrence* iValue;
   327 	};
   328 
   329 //
   330 // CRecurrenceParser
   331 //
   332 class CRecurrenceParser : public CVersitParser
   333 /** Base class used in the derivation of CParserVCalEntity.
   334 
   335 Provides recurrence functionality for vEvents and vToDos in vCalendars. 
   336 @publishedAll
   337 @released
   338 */
   339 	{
   340 public:
   341 	IMPORT_C CRecurrenceParser(TBool aHasVersion);
   342 	IMPORT_C CParserPropertyValue* MakePropertyValueRecurrenceL(TDes& aRecurringEntity);
   343 private:	
   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();
   351 	};
   352 
   353 #include <vrecur.inl>
   354 
   355 #endif