epoc32/include/app/vrecur.h
author William Roberts <williamr@symbian.org>
Wed, 31 Mar 2010 12:27:01 +0100
branchSymbian2
changeset 3 e1b950c65cb4
parent 2 epoc32/include/vrecur.h@2fe1408b6811
child 4 837f303aceeb
permissions -rw-r--r--
Attempt to represent the S^2->S^3 header reorganisation as a series of "hg rename" operations
williamr@2
     1
// Copyright (c) 1997-2009 Nokia Corporation and/or its subsidiary(-ies).
williamr@2
     2
// All rights reserved.
williamr@2
     3
// This component and the accompanying materials are made available
williamr@2
     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
williamr@2
     5
// which accompanies this distribution, and is available
williamr@2
     6
// at the URL "http://www.symbianfoundation.org/legal/licencesv10.html".
williamr@2
     7
//
williamr@2
     8
// Initial Contributors:
williamr@2
     9
// Nokia Corporation - initial contribution.
williamr@2
    10
//
williamr@2
    11
// Contributors:
williamr@2
    12
//
williamr@2
    13
// Description:
williamr@2
    14
//
williamr@2
    15
 
williamr@2
    16
#ifndef __VRECUR_H__
williamr@2
    17
#define __VRECUR_H__
williamr@2
    18
williamr@2
    19
#include <versit.h>
williamr@2
    20
williamr@2
    21
//
williamr@2
    22
// CWeekDayArray
williamr@2
    23
//
williamr@2
    24
williamr@2
    25
class CWeekDayArray : public CBase
williamr@2
    26
/** Defines an array of the days in the week on which a 'weekly' 
williamr@2
    27
or 'monthly by position' repeat event occurs. 
williamr@2
    28
@publishedAll
williamr@2
    29
@released
williamr@2
    30
*/
williamr@2
    31
	{
williamr@2
    32
public:
williamr@2
    33
	IMPORT_C CWeekDayArray();
williamr@2
    34
	IMPORT_C ~CWeekDayArray();
williamr@2
    35
	IMPORT_C void ExternalizeL(RWriteStream& aStream);
williamr@2
    36
public:	
williamr@2
    37
	/** The array of days in the week. */
williamr@2
    38
	CArrayFix<TDay>* iArray;
williamr@2
    39
	};
williamr@2
    40
williamr@2
    41
//
williamr@2
    42
// CVersitRecurrence
williamr@2
    43
//
williamr@2
    44
class CVersitRecurrence : public CBase
williamr@2
    45
/** Abstract base class for all recurrence property value classes.
williamr@2
    46
williamr@2
    47
A pointer to a derived recurrence property value class instance is owned by 
williamr@2
    48
the CParserPropertyValueRecurrence class.
williamr@2
    49
williamr@2
    50
Implementations of this class define when an event is to repeat. 
williamr@2
    51
@publishedAll
williamr@2
    52
@released
williamr@2
    53
*/
williamr@2
    54
	{
williamr@2
    55
public:
williamr@2
    56
	IMPORT_C CVersitRecurrence(TInt aInterval,TInt aDuration,TVersitDateTime* aEndDate);
williamr@2
    57
	IMPORT_C ~CVersitRecurrence();
williamr@2
    58
	/** Externalises an occurrence list to aStream.
williamr@2
    59
	
williamr@2
    60
	@param aStream The stream to which the occurrence list is to be externalised. */
williamr@2
    61
	virtual void ExternalizeOccurrenceListsL(RWriteStream& aStream) const=0;
williamr@2
    62
	/** Repeat type. 
williamr@2
    63
	@publishedAll
williamr@2
    64
	@released */
williamr@2
    65
	enum TType
williamr@2
    66
		{
williamr@2
    67
		/** Daily repeat. */
williamr@2
    68
		EDaily=1,
williamr@2
    69
		/** Weekly repeat. */
williamr@2
    70
		EWeekly,
williamr@2
    71
		/** Monthly repeat, by relative position within the month. */
williamr@2
    72
		EMonthlyByPos,
williamr@2
    73
		/** Monthly repeat, by day number within the month. */
williamr@2
    74
		EMonthlyByDay,
williamr@2
    75
		/** Yearly repeat, by specific months within the year. */
williamr@2
    76
		EYearlyByMonth,
williamr@2
    77
		/** Yearly repeat, by specific days within the year. */
williamr@2
    78
		EYearlyByDay
williamr@2
    79
		};
williamr@2
    80
public:
williamr@2
    81
	/** The type of repeat (daily, weekly etc.). */
williamr@2
    82
	TType iRepeatType;
williamr@2
    83
	/** The interval between repeats: a number of days, weeks, months or years, depending 
williamr@2
    84
	on the repeat type. */
williamr@2
    85
	TInt iInterval;
williamr@2
    86
	/** The duration in days, weeks, months or years (depending on the repeat type) 
williamr@2
    87
	for the repeat.
williamr@2
    88
	
williamr@2
    89
	A value of zero indicates the repeat should continue forever. */
williamr@2
    90
	TInt iDuration;
williamr@2
    91
	/** Specification for the date at which the repeat will end. If a duration and 
williamr@2
    92
	an end date are both specified, the end date takes precedence. */
williamr@2
    93
	TVersitDateTime* iEndDate;
williamr@2
    94
	};
williamr@2
    95
williamr@2
    96
//
williamr@2
    97
// CVersitRecurrenceDaily
williamr@2
    98
//
williamr@2
    99
class CVersitRecurrenceDaily : public CVersitRecurrence
williamr@2
   100
/** Defines when a 'daily' recurrence is to be repeated.
williamr@2
   101
williamr@2
   102
Used by a repeating event (a vCalendar event or to-do) to define when it is 
williamr@2
   103
to occur. The days on which the event occurs are identified by the number 
williamr@2
   104
of days between repeats, e.g. every third day.
williamr@2
   105
williamr@2
   106
A pointer to this object may be owned by a CParserPropertyValueRecurrence 
williamr@2
   107
object. 
williamr@2
   108
@publishedAll
williamr@2
   109
@released
williamr@2
   110
*/
williamr@2
   111
	{
williamr@2
   112
public:
williamr@2
   113
	IMPORT_C CVersitRecurrenceDaily(TInt aInterval,TInt aDuration,TVersitDateTime* aEndDate);
williamr@2
   114
public: //from CVersitRecurrence
williamr@2
   115
	IMPORT_C void ExternalizeOccurrenceListsL(RWriteStream& /*aStream*/) const;
williamr@2
   116
	};
williamr@2
   117
williamr@2
   118
//
williamr@2
   119
//	CVersitRecurrenceWeekly
williamr@2
   120
//
williamr@2
   121
class CVersitRecurrenceWeekly : public CVersitRecurrence
williamr@2
   122
/** Defines a list of days when a 'weekly' recurrence is to be 
williamr@2
   123
repeated.
williamr@2
   124
williamr@2
   125
Used by a repeating event (a vCalendar event or to-do) to define when it is 
williamr@2
   126
to occur. The days on which the event occurs are identified by the number 
williamr@2
   127
of weeks between repeats and the day(s) of the week on which the event occurs, 
williamr@2
   128
e.g. on Monday every other week.
williamr@2
   129
williamr@2
   130
A pointer to this object may be owned by a CParserPropertyValueRecurrence 
williamr@2
   131
object. 
williamr@2
   132
@publishedAll
williamr@2
   133
@released
williamr@2
   134
*/
williamr@2
   135
	{
williamr@2
   136
public:
williamr@2
   137
	IMPORT_C CVersitRecurrenceWeekly(TInt aInterval,TInt aDuration,TVersitDateTime* aEndDate,CWeekDayArray* aArrayOfWeekDayOccurrences);
williamr@2
   138
	IMPORT_C ~CVersitRecurrenceWeekly();
williamr@2
   139
public: //from CVersitRecurrence
williamr@2
   140
	IMPORT_C void ExternalizeOccurrenceListsL(RWriteStream& aStream) const;
williamr@2
   141
public:
williamr@2
   142
	CWeekDayArray* iArrayOfWeekDayOccurrences;		//Mon-Sun
williamr@2
   143
	};
williamr@2
   144
williamr@2
   145
//
williamr@2
   146
// CVersitRecurrenceMonthlyByPos
williamr@2
   147
//
williamr@2
   148
class CVersitRecurrenceMonthlyByPos : public CVersitRecurrence
williamr@2
   149
/** Defines a list of days when a 'monthly by position' recurrence 
williamr@2
   150
is to be repeated.
williamr@2
   151
williamr@2
   152
Used by a repeating event (a vCalendar event or to-do) to define when it is 
williamr@2
   153
to occur.
williamr@2
   154
williamr@2
   155
The days on which the event occurs are identified by their relative position 
williamr@2
   156
within the month, for example the second Monday or the last Friday.
williamr@2
   157
williamr@2
   158
A pointer to this object may be owned by a CParserPropertyValueRecurrence 
williamr@2
   159
object
williamr@2
   160
williamr@2
   161
Note: The CMonthPosition class, defined within this class, is used to 
williamr@2
   162
define the positions of days within the month. 
williamr@2
   163
@publishedAll
williamr@2
   164
@released
williamr@2
   165
*/
williamr@2
   166
	{
williamr@2
   167
public:
williamr@2
   168
	class CMonthPosition : public CBase
williamr@2
   169
	/** Defines a week within the month, using the numeric occurrence of the week 
williamr@2
   170
	(between 1 and 5 inclusive) counting from either the start or end of the month, 
williamr@2
   171
	and defines an array of days within this week. 
williamr@2
   172
	@publishedAll
williamr@2
   173
	@released
williamr@2
   174
	*/
williamr@2
   175
		{
williamr@2
   176
	public:
williamr@2
   177
		IMPORT_C ~CMonthPosition();
williamr@2
   178
	public:
williamr@2
   179
		/** Flags that define whether the week number is counted from the start or end of the month. 
williamr@2
   180
		@publishedAll
williamr@2
   181
		@released */
williamr@2
   182
		enum TSign 
williamr@2
   183
				{
williamr@2
   184
				/** Indicates that the iWeekNo member specifies a number counting forwards 
williamr@2
   185
				from the start of the month. */
williamr@2
   186
				EWeeksFromStartOfMonth,
williamr@2
   187
				/** Indicates that the iWeekNo member specifies a number counting backwards from 
williamr@2
   188
				the end of the month. */
williamr@2
   189
				EWeeksFromEndOfMonth
williamr@2
   190
				};
williamr@2
   191
	public:
williamr@2
   192
		/** Indicates whether the week number iWeekNo is counted from the start or the 
williamr@2
   193
		end of the month. A plus sign denotes from the start of the month and a minus 
williamr@2
   194
		sign denotes from the end. */
williamr@2
   195
		TSign iSign;
williamr@2
   196
		/** A week number within the month, between 1 and 5 inclusive. */
williamr@2
   197
		TInt iWeekNo;
williamr@2
   198
		/** Pointer to an array of week days. */
williamr@2
   199
		CWeekDayArray* iArrayOfWeekDays;
williamr@2
   200
		};
williamr@2
   201
	IMPORT_C CVersitRecurrenceMonthlyByPos(TInt aInterval,TInt aDuration,TVersitDateTime* aEndDate,CArrayPtrFlat<CMonthPosition>* aMonthPositions);
williamr@2
   202
	IMPORT_C ~CVersitRecurrenceMonthlyByPos();
williamr@2
   203
public: //framework
williamr@2
   204
	IMPORT_C void ExternalizeOccurrenceListsL(RWriteStream& aStream) const;
williamr@2
   205
public:
williamr@2
   206
	/** Array of 'month positions' which define the days on which the event occurs. */
williamr@2
   207
	CArrayPtrFlat<CMonthPosition>* iMonthPositions;
williamr@2
   208
	};
williamr@2
   209
williamr@2
   210
//
williamr@2
   211
// CVersitRecurrenceMonthlyByDay
williamr@2
   212
//
williamr@2
   213
class CVersitRecurrenceMonthlyByDay : public CVersitRecurrence
williamr@2
   214
/** Defines a list of days when a 'monthly by day' recurrence 
williamr@2
   215
is to repeat.
williamr@2
   216
williamr@2
   217
Used by a repeating event (a vCalendar event or to-do) to define when it is 
williamr@2
   218
to occur.
williamr@2
   219
williamr@2
   220
The days on which the event occurs are identified by a number, counting 
williamr@2
   221
either from the start or the end of the month.
williamr@2
   222
williamr@2
   223
A pointer to this object may be owned by a CParserPropertyValueRecurrence 
williamr@2
   224
object. 
williamr@2
   225
@publishedAll
williamr@2
   226
@released
williamr@2
   227
*/
williamr@2
   228
	{
williamr@2
   229
public:
williamr@2
   230
	IMPORT_C CVersitRecurrenceMonthlyByDay(TInt aInterval,TInt aDuration,TVersitDateTime* aEndDate,	CArrayFix<TInt>* aArrayOfOccurrencesInDaysFromStartOfMonth
williamr@2
   231
		,CArrayFix<TInt>* aArrayOfOccurrencesInDaysFromEndOfMonth,TBool aLastDay);
williamr@2
   232
	IMPORT_C ~CVersitRecurrenceMonthlyByDay();
williamr@2
   233
public: //framework
williamr@2
   234
	IMPORT_C void ExternalizeOccurrenceListsL(RWriteStream& aStream) const;
williamr@2
   235
public:
williamr@2
   236
	/** Array of days, counting from the start of the month, on which the event occurs. */
williamr@2
   237
	CArrayFix<TInt>* iArrayOfOccurrencesInDaysFromStartOfMonth; //1-31
williamr@2
   238
	/** Array of days, counting from the end of the month, on which the event occurs. */
williamr@2
   239
	CArrayFix<TInt>* iArrayOfOccurrencesInDaysFromEndOfMonth; //1-31
williamr@2
   240
	/** Identifies whether the event occurs on the last day of the month. */
williamr@2
   241
	TBool iLastDay;
williamr@2
   242
	};
williamr@2
   243
williamr@2
   244
//
williamr@2
   245
// CVersitRecurrenceYearlyByMonth
williamr@2
   246
//
williamr@2
   247
class CVersitRecurrenceYearlyByMonth : public CVersitRecurrence
williamr@2
   248
/** Defines a list of months when a 'yearly by month' recurrence 
williamr@2
   249
is to repeat.
williamr@2
   250
williamr@2
   251
Used by a repeating event (a vCalendar event or to-do) to define the months  
williamr@2
   252
in which it is to occur. The months on which the event occurs are identified 
williamr@2
   253
by their number in the year (between 1 and 12 inclusive).
williamr@2
   254
williamr@2
   255
A pointer to this object may be owned by a CParserPropertyValueRecurrence 
williamr@2
   256
object. 
williamr@2
   257
@publishedAll
williamr@2
   258
@released
williamr@2
   259
*/
williamr@2
   260
	{
williamr@2
   261
public:
williamr@2
   262
	IMPORT_C CVersitRecurrenceYearlyByMonth(TInt aInterval,TInt aDuration,TVersitDateTime* aEndDate,CArrayFix<TMonth>* aArrayOfMonthsInYearOccurrences);
williamr@2
   263
	IMPORT_C ~CVersitRecurrenceYearlyByMonth();
williamr@2
   264
public: //framework
williamr@2
   265
	IMPORT_C void ExternalizeOccurrenceListsL(RWriteStream& aStream) const;
williamr@2
   266
public:
williamr@2
   267
	/** Pointer to an array of month values. */
williamr@2
   268
	CArrayFix<TMonth>* iArrayOfMonthsInYearOccurrences; //Jan-Dec
williamr@2
   269
	};
williamr@2
   270
williamr@2
   271
//
williamr@2
   272
// CVersitRecurrenceYearlyByDay
williamr@2
   273
//
williamr@2
   274
class CVersitRecurrenceYearlyByDay : public CVersitRecurrence
williamr@2
   275
/** Defines a list of days when a 'yearly by day' recurrence is 
williamr@2
   276
to be repeated.
williamr@2
   277
williamr@2
   278
Used by a repeating event (a vCalendar event or to-do) to define when it is 
williamr@2
   279
to occur.
williamr@2
   280
williamr@2
   281
The days on which the repeat occurs are identified by their day number in 
williamr@2
   282
the year (between 1 and 366 inclusive).
williamr@2
   283
williamr@2
   284
A pointer to this object may be owned by a CParserPropertyValueRecurrence 
williamr@2
   285
object. 
williamr@2
   286
@publishedAll
williamr@2
   287
@released
williamr@2
   288
*/
williamr@2
   289
	{
williamr@2
   290
public:
williamr@2
   291
	IMPORT_C CVersitRecurrenceYearlyByDay(TInt aInterval,TInt aDuration,TVersitDateTime* aEndDate,CArrayFix<TInt>* aArrayOfDaysInYearOccurrences);
williamr@2
   292
	IMPORT_C ~CVersitRecurrenceYearlyByDay();
williamr@2
   293
public: //framework
williamr@2
   294
	IMPORT_C void ExternalizeOccurrenceListsL(RWriteStream& aStream) const;
williamr@2
   295
public:
williamr@2
   296
	/** Pointer to an array of integers between 1 and 366 inclusive. 
williamr@2
   297
	
williamr@2
   298
	Each integer represents a day on which the repeat event occurs. */
williamr@2
   299
	CArrayFix<TInt>* iArrayOfDaysInYearOccurrences; 
williamr@2
   300
	};
williamr@2
   301
williamr@2
   302
//
williamr@2
   303
// CParserPropertyValueRecurrence
williamr@2
   304
//
williamr@2
   305
class CParserPropertyValueRecurrence : public CParserTimePropertyValue
williamr@2
   306
/** A recurrence property value parser.
williamr@2
   307
williamr@2
   308
This is used to store and retrieve the recurrence information for a repeating 
williamr@2
   309
vEvent or vTodo. This information is stored as a CVersitRecurrence object.
williamr@2
   310
williamr@2
   311
The UID for a recurrence property value is KVCalPropertyRecurrenceUid. 
williamr@2
   312
@publishedAll
williamr@2
   313
@released
williamr@2
   314
*/
williamr@2
   315
	{
williamr@2
   316
public:
williamr@2
   317
	IMPORT_C CParserPropertyValueRecurrence(CVersitRecurrence* aValue);
williamr@2
   318
	IMPORT_C ~CParserPropertyValueRecurrence();
williamr@2
   319
	inline CVersitRecurrence* Value() const;
williamr@2
   320
public: // from CParserTimePropertyValue
williamr@2
   321
	IMPORT_C void ConvertAllDateTimesToUTCL(const TTimeIntervalSeconds& aIncrement,const CVersitDaylight* aDaylight);
williamr@2
   322
	IMPORT_C void ConvertAllUTCDateTimesToMachineLocalL(const TTimeIntervalSeconds& aIncrement);
williamr@2
   323
public: // from CParserPropertyValue
williamr@2
   324
	IMPORT_C void ExternalizeL(RWriteStream& aStream,const Versit::TEncodingAndCharset& /*aEncodingCharset*/,TInt /*aLengthOutput*/);
williamr@2
   325
protected:
williamr@2
   326
	CVersitRecurrence* iValue;
williamr@2
   327
	};
williamr@2
   328
williamr@2
   329
//
williamr@2
   330
// CRecurrenceParser
williamr@2
   331
//
williamr@2
   332
class CRecurrenceParser : public CVersitParser
williamr@2
   333
/** Base class used in the derivation of CParserVCalEntity.
williamr@2
   334
williamr@2
   335
Provides recurrence functionality for vEvents and vToDos in vCalendars. 
williamr@2
   336
@publishedAll
williamr@2
   337
@released
williamr@2
   338
*/
williamr@2
   339
	{
williamr@2
   340
public:
williamr@2
   341
	IMPORT_C CRecurrenceParser(TBool aHasVersion);
williamr@2
   342
	IMPORT_C CParserPropertyValue* MakePropertyValueRecurrenceL(TDes& aRecurringEntity);
williamr@2
   343
private:	
williamr@2
   344
	static void ResetAndDestroyArrayOfMonthPositions(TAny* aObject);	
williamr@2
   345
	void GetFrequencyAndIntervalL(CVersitRecurrence::TType& aFrequency,TInt& aInterval, const TDesC& aRecurrenceType);
williamr@2
   346
	CVersitRecurrence* GetFrequencyModifiersL(const CVersitRecurrence::TType& aRepeatType,TInt aInterval, const TDesC& aListDates);
williamr@2
   347
	CWeekDayArray* GetListOfWeekDayOccurrencesL(const TDesC& aListDays);
williamr@2
   348
private: // from CVersitParser
williamr@2
   349
	IMPORT_C virtual void Reserved1();
williamr@2
   350
	IMPORT_C virtual void Reserved2();
williamr@2
   351
	};
williamr@2
   352
williamr@2
   353
#include <vrecur.inl>
williamr@2
   354
williamr@2
   355
#endif