epoc32/include/app/calrrule.h
author William Roberts <williamr@symbian.org>
Wed, 31 Mar 2010 12:27:01 +0100
branchSymbian2
changeset 3 e1b950c65cb4
parent 2 epoc32/include/calrrule.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) 2005-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 __CALRRULE_H__
williamr@2
    17
#define __CALRRULE_H__
williamr@2
    18
williamr@2
    19
#include <caltime.h>
williamr@2
    20
williamr@2
    21
/** Class representing iCal repeat types.
williamr@2
    22
williamr@2
    23
This supports the following standard iCal properties:
williamr@2
    24
- FREQ (rule type), 
williamr@2
    25
- DTSTART (start date), 
williamr@2
    26
- UNTIL (end date), 
williamr@2
    27
- COUNT (number of instances),
williamr@2
    28
- INTERVAL (interval between instances), 
williamr@2
    29
- BYDAY, 
williamr@2
    30
- BYMONTHDAY, 
williamr@2
    31
- BYYEARDAY, 
williamr@2
    32
- WKST (start day of week).
williamr@2
    33
williamr@2
    34
Note that the repeat rule type (FREQ) must be set before any of the following 
williamr@2
    35
properties can be set, since their behaviour is dependent on the rule type:
williamr@2
    36
BYDAY, BYMONTHDAY, BYYEARDAY
williamr@2
    37
williamr@2
    38
The WKST parameter is only significant in weekly repeat rules with an interval of 
williamr@2
    39
greater than 1.
williamr@2
    40
williamr@2
    41
The repeat rule type may not be changed once it has been set.
williamr@2
    42
williamr@2
    43
If the start date of the entry does not match an instance of its repeat rule then 
williamr@2
    44
the entry's start date will be moved forward to the first matching instance. For example,
williamr@2
    45
if the rule repeats every Wednesday but the start date of the entry is Monday, then the 
williamr@2
    46
start date will be changed to the Wednesday.
williamr@2
    47
williamr@2
    48
@publishedAll
williamr@2
    49
@released
williamr@2
    50
*/
williamr@2
    51
NONSHARABLE_CLASS(TCalRRule)
williamr@2
    52
	{
williamr@2
    53
public:
williamr@2
    54
	/** Types of repeat rule. 
williamr@2
    55
	
williamr@2
    56
	@publishedAll
williamr@2
    57
	@released
williamr@2
    58
	*/	
williamr@2
    59
	enum TType 
williamr@2
    60
		{
williamr@2
    61
		/** The type has not yet been defined. */
williamr@2
    62
		EInvalid=0,
williamr@2
    63
		/** Rule which repeats based on a number of days. */
williamr@2
    64
		EDaily,
williamr@2
    65
		/** Rule which repeats based on a number of weeks. */
williamr@2
    66
		EWeekly,
williamr@2
    67
		/** Rule which repeats based on a number of months. */
williamr@2
    68
		EMonthly,
williamr@2
    69
		/** Rule which repeats based on a number of years. */
williamr@2
    70
		EYearly,
williamr@2
    71
		};
williamr@2
    72
		
williamr@2
    73
	/** Class to represent a weekday within a month.
williamr@2
    74
	
williamr@2
    75
	Valid values of iWeekInMonth are 1, 2, 3, 4 for the 1st, 2nd, 3rd and 4th week of 
williamr@2
    76
	the month, or -1 for the last week of the month.
williamr@2
    77
williamr@2
    78
	For example:
williamr@2
    79
	The 3rd Wednesday would have iDay = EWednesday and iWeekInMonth = 3.
williamr@2
    80
	The last Sunday would have iDay = ESunday and iWeekInMonth = -1.
williamr@2
    81
	
williamr@2
    82
	@publishedAll
williamr@2
    83
	@released
williamr@2
    84
	*/
williamr@2
    85
	class TDayOfMonth
williamr@2
    86
		{
williamr@2
    87
	public:
williamr@2
    88
		IMPORT_C TDayOfMonth(TDay aDay, TInt8 aWeekInMonth);
williamr@2
    89
		IMPORT_C TDay Day() const;
williamr@2
    90
		IMPORT_C TInt8 WeekInMonth() const;
williamr@2
    91
	private:
williamr@2
    92
		TDay iDay;
williamr@2
    93
		TInt8 iWeekInMonth;
williamr@2
    94
		};
williamr@2
    95
	
williamr@2
    96
	IMPORT_C TCalRRule();
williamr@2
    97
	IMPORT_C TCalRRule(TType aType);
williamr@2
    98
	
williamr@2
    99
	IMPORT_C void SetType(TType aType);
williamr@2
   100
	IMPORT_C TType Type() const;
williamr@2
   101
	
williamr@2
   102
	IMPORT_C void SetDtStart(const TCalTime& aTime);
williamr@2
   103
	IMPORT_C TCalTime DtStart() const;
williamr@2
   104
		
williamr@2
   105
	IMPORT_C void SetUntil(const TCalTime& aTime);
williamr@2
   106
	IMPORT_C TCalTime Until() const;
williamr@2
   107
	
williamr@2
   108
	IMPORT_C void SetCount(TUint aCount);
williamr@2
   109
	IMPORT_C TUint Count() const;
williamr@2
   110
	
williamr@2
   111
	IMPORT_C void SetInterval(TInt aInterval);
williamr@2
   112
	IMPORT_C TInt Interval() const;
williamr@2
   113
	
williamr@2
   114
	IMPORT_C void SetByDay(const RArray<TDay>& aDays); 
williamr@2
   115
	IMPORT_C void GetByDayL(RArray<TDay>& aDays) const;
williamr@2
   116
	
williamr@2
   117
	IMPORT_C void SetByDay(const RArray<TDayOfMonth>& aDays); 
williamr@2
   118
	IMPORT_C void GetByDayL(RArray<TDayOfMonth>& aDays) const;
williamr@2
   119
williamr@2
   120
	IMPORT_C void SetByMonthDay(const RArray<TInt>& aMonthDays);
williamr@2
   121
	IMPORT_C void GetByMonthDayL(RArray<TInt>& aMonthDays) const;
williamr@2
   122
williamr@2
   123
	IMPORT_C void SetByMonth(const RArray<TMonth> aMonths);
williamr@2
   124
	IMPORT_C void GetByMonthL(RArray<TMonth>& aMonths) const;
williamr@2
   125
williamr@2
   126
	IMPORT_C void SetWkSt(TDay aDay);
williamr@2
   127
	IMPORT_C TDay WkSt() const;
williamr@2
   128
williamr@2
   129
	void SetUntilAndCount(const TCalTime& aTime, TUint aCount);
williamr@2
   130
williamr@2
   131
private:
williamr@2
   132
	void InitialiseData();
williamr@2
   133
williamr@2
   134
	TUint MapToBitsWeekdays(TDay aDay);
williamr@2
   135
	
williamr@2
   136
	TBool GetNthBit(TUint aNum) const;
williamr@2
   137
	void SetNthBit(TUint aNum);
williamr@2
   138
		
williamr@2
   139
private:
williamr@2
   140
	TUint64	iBuffer; 	// stores BYDAY/BYMONTHDAY
williamr@2
   141
	TCalTime iDtStart;
williamr@2
   142
	TCalTime iUntil;
williamr@2
   143
	TInt32  iReserved;
williamr@2
   144
	TInt32  iReserved2;
williamr@2
   145
	TInt	iCount;
williamr@2
   146
	TDay	iWkSt;
williamr@2
   147
	TType	iType;
williamr@2
   148
	TUint8	iInterval;
williamr@2
   149
	};
williamr@2
   150
williamr@2
   151
#endif // __CALRRULE_H__