epoc32/include/app/vcal.h
author William Roberts <williamr@symbian.org>
Wed, 31 Mar 2010 12:27:01 +0100
branchSymbian2
changeset 3 e1b950c65cb4
parent 2 epoc32/include/vcal.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
#if !defined(__VCAL_H__)
williamr@2
    17
#define __VCAL_H__
williamr@2
    18
williamr@2
    19
#if !defined(__VERSIT_H__)
williamr@2
    20
#include <versit.h>
williamr@2
    21
#endif
williamr@2
    22
williamr@2
    23
#if !defined(__VRECUR_H__)
williamr@2
    24
#include <vrecur.h>
williamr@2
    25
#endif
williamr@2
    26
williamr@2
    27
_LIT(KVersitTokenVCalVersionNo, "1.0");
williamr@2
    28
williamr@2
    29
//
williamr@2
    30
// CParserVCal
williamr@2
    31
//
williamr@2
    32
class CParserVCal : public CVersitParser
williamr@2
    33
/** A vCalendar parser.
williamr@2
    34
williamr@2
    35
Adds support for parsing vToDos and vEvents, and associated alarms 
williamr@2
    36
(see CParserPropertyValueAlarm) to the functionality of CVersitParser.
williamr@2
    37
williamr@2
    38
Adds a constructor and overrides CVersitParser::InternalizeL() for streams, 
williamr@2
    39
ExternalizeL() for streams, RecognizeToken(), RecognizeEntityName() and MakeEntityL().
williamr@2
    40
williamr@2
    41
The vCalendar data is read from or written to a stream or file, using the 
williamr@2
    42
InternalizeL() and ExternalizeL() functions. Most users of this class will 
williamr@2
    43
only need to use these functions.
williamr@2
    44
williamr@2
    45
Note: if you are sequentially creating and destroying multiple 
williamr@2
    46
parsers, a major performance improvement may be achieved by using thread local 
williamr@2
    47
storage to store an instance of CVersitUnicodeUtils which persists and can be 
williamr@2
    48
used by all of the parsers.
williamr@2
    49
williamr@2
    50
See CVersitTlsData for more information. 
williamr@2
    51
williamr@2
    52
@publishedAll
williamr@2
    53
@released
williamr@2
    54
*/
williamr@2
    55
	{
williamr@2
    56
public:
williamr@2
    57
	IMPORT_C static CParserVCal* NewL();
williamr@2
    58
public: // from CVersitParser
williamr@2
    59
	IMPORT_C void InternalizeL(RReadStream& aStream);
williamr@2
    60
	IMPORT_C void ExternalizeL(RWriteStream& aStream);
williamr@2
    61
protected: // from CVersitParser
williamr@2
    62
	IMPORT_C CVersitParser* MakeEntityL(TInt aEntityUid,HBufC* aEntityName);
williamr@2
    63
public: // from CVersitParser
williamr@2
    64
	IMPORT_C TUid RecognizeToken(const TDesC8& aToken) const;
williamr@2
    65
	IMPORT_C TInt RecognizeEntityName() const;
williamr@2
    66
private:
williamr@2
    67
	CParserVCal();
williamr@2
    68
private: // from CVersitParser
williamr@2
    69
	IMPORT_C virtual void Reserved1();
williamr@2
    70
	IMPORT_C virtual void Reserved2();
williamr@2
    71
	};
williamr@2
    72
williamr@2
    73
//
williamr@2
    74
// CVersitAlarm
williamr@2
    75
//
williamr@2
    76
class CVersitAlarm : public CBase
williamr@2
    77
/** An alarm for a vEvent or a vTodo. 
williamr@2
    78
williamr@2
    79
Specifies the date/time for the alarm, the amount of time the alarm will be 
williamr@2
    80
snoozed (optional), the number of times that the alarm will repeat, the binary 
williamr@2
    81
data of the sound to be played when the alarm runs (optional), and some text 
williamr@2
    82
to associate with the alarm (optional).
williamr@2
    83
williamr@2
    84
An object of this class is owned by the CParserPropertyValueAlarm class.
williamr@2
    85
williamr@2
    86
This class supports the following types of alarm:
williamr@2
    87
williamr@2
    88
- Audible Alarm
williamr@2
    89
williamr@2
    90
- Display Alarm (displays message on the screen) 
williamr@2
    91
williamr@2
    92
- Procedure Alarm (calls a procedure)
williamr@2
    93
williamr@2
    94
- Mail Alarm (sends an email). 
williamr@2
    95
williamr@2
    96
@publishedAll
williamr@2
    97
@released
williamr@2
    98
*/
williamr@2
    99
	{
williamr@2
   100
public:
williamr@2
   101
	IMPORT_C static CVersitAlarm* NewL(TVersitDateTime* aRunTime, TTime* aSnoozeTime, TInt aRepeatCount, const TDesC& aAudioContent, const TDesC& aNote);
williamr@2
   102
	IMPORT_C ~CVersitAlarm();
williamr@2
   103
private:
williamr@2
   104
	CVersitAlarm(TVersitDateTime* aRunTime, TTime* aSnoozeTime, TInt aRepeatCount);
williamr@2
   105
	void ConstructL(const TDesC& aAudioContent, const TDesC& aNote);
williamr@2
   106
public:	
williamr@2
   107
	/** The date/time for the alarm. */
williamr@2
   108
	TVersitDateTime* iRunTime;
williamr@2
   109
	/** The amount of time the alarm will be snoozed (optional). */
williamr@2
   110
	TTime* iSnoozeTime;
williamr@2
   111
	/** The number of times that the alarm will repeat. */
williamr@2
   112
	TInt iRepeatCount;
williamr@2
   113
	/** The binary data describing the sound to play for an AALARM (optional), or 
williamr@2
   114
	the string which specifies the address to send the e-mail to, for an MALARM. */
williamr@2
   115
	HBufC* iAudioContent;
williamr@2
   116
	/** The mesage to display on the screen for a DALARM (optional), or 
williamr@2
   117
	the body of the e-mail to be sent for an MALARM, or the name of the procedure 
williamr@2
   118
	to call for a PALARM. */
williamr@2
   119
	HBufC* iNote;//Empty except for MAlarm
williamr@2
   120
	};
williamr@2
   121
	
williamr@2
   122
class CVersitExtendedAlarm : public CBase
williamr@2
   123
/** An extended alarm for a vEvent or a vTodo. 
williamr@2
   124
williamr@2
   125
Specifies the date/time for the alarm, the amount of time the alarm will be 
williamr@2
   126
snoozed (optional), the number of times that the alarm will repeat, and the 
williamr@2
   127
action for the alarm.
williamr@2
   128
An object of this class is owned by the CParserPropertyValueAlarm class.
williamr@2
   129
williamr@2
   130
This class supports the following types of alarm:
williamr@2
   131
- X-EPOCALARM 
williamr@2
   132
williamr@2
   133
@publishedPartner
williamr@2
   134
@released
williamr@2
   135
*/
williamr@2
   136
	{
williamr@2
   137
public:
williamr@2
   138
williamr@2
   139
	/** Extended Alarm's disposition types.
williamr@2
   140
	*/
williamr@2
   141
	enum TDisposition
williamr@2
   142
		{
williamr@2
   143
		/** URL disposition
williamr@2
   144
		*/
williamr@2
   145
		EDispositionUrl = 0,
williamr@2
   146
		/** Inline disposition
williamr@2
   147
		*/
williamr@2
   148
		EDispositionInline = 1,
williamr@2
   149
		/** Unknown disposition
williamr@2
   150
		*/
williamr@2
   151
		EDispositionUnknown = 15
williamr@2
   152
		};
williamr@2
   153
	
williamr@2
   154
	IMPORT_C static CVersitExtendedAlarm* NewL(const TDesC8& aContent,const TDesC8& aContentMimeType, CVersitExtendedAlarm::TDisposition aDisposition);
williamr@2
   155
	IMPORT_C ~CVersitExtendedAlarm();
williamr@2
   156
private:
williamr@2
   157
	CVersitExtendedAlarm();
williamr@2
   158
	void ConstructL(const TDesC8& aContent, const TDesC8& aContentMimeType, CVersitExtendedAlarm::TDisposition aContentDisposition);
williamr@2
   159
public:	
williamr@2
   160
	/** The data describing the action for the alarm.*/
williamr@2
   161
	HBufC8* iContent;
williamr@2
   162
	/** The MIME type of the data describing the action for the alarm.*/
williamr@2
   163
	HBufC8* iMimeType;
williamr@2
   164
	/** The disposition of the data for the alarm action (i.e whether it is inline or an URI).*/
williamr@2
   165
	CVersitExtendedAlarm::TDisposition iDisposition;
williamr@2
   166
	};
williamr@2
   167
williamr@2
   168
//
williamr@2
   169
// CParserVCalEntity
williamr@2
   170
//
williamr@2
   171
class CParserVCalEntity : public CRecurrenceParser
williamr@2
   172
/** A parser for vCalendar sub-entities.
williamr@2
   173
williamr@2
   174
A vCalendar sub-entity is a vEvent or vToDo contained in a vCalendar. vEvents 
williamr@2
   175
and vToDos are derived from CRecurrenceParser, which provides recurrence functionality. 
williamr@2
   176
williamr@2
   177
vEvents and vTodos may have alarm properties (see CParserPropertyValueAlarm). 
williamr@2
   178
williamr@2
   179
@publishedAll
williamr@2
   180
@released
williamr@2
   181
*/
williamr@2
   182
	{
williamr@2
   183
public:
williamr@2
   184
	IMPORT_C static CParserVCalEntity* NewL();
williamr@2
   185
	IMPORT_C ~CParserVCalEntity();
williamr@2
   186
public: // from CVersitParser
williamr@2
   187
	IMPORT_C void ExternalizeL(RWriteStream& aStream);
williamr@2
   188
protected: // from CVersitParser
williamr@2
   189
	IMPORT_C CParserPropertyValue* MakePropertyValueL(const TUid& aPropertyUid,HBufC16*& aValue);
williamr@2
   190
	IMPORT_C CVersitAlarm* MakePropertyValueAlarmL(TPtr16 aAlarmValue);
williamr@2
   191
	IMPORT_C CVersitExtendedAlarm* MakePropertyValueExtendedAlarmL(TPtr16 aAlarmValue);
williamr@2
   192
	IMPORT_C CVersitExtendedAlarm* MakePropertyValueExtendedAlarmL(CBufSeg& aAlarmValue);
williamr@2
   193
	IMPORT_C CVersitExtendedAlarm::TDisposition DecodeDisposition(const TDesC8& aContentDispositionToken) const;
williamr@2
   194
	IMPORT_C TUid RecognizeToken(const TDesC8& aToken) const;
williamr@2
   195
private:
williamr@2
   196
	CParserVCalEntity();
williamr@2
   197
private: // from CVersitParser
williamr@2
   198
	IMPORT_C virtual void Reserved1();
williamr@2
   199
	IMPORT_C virtual void Reserved2();
williamr@2
   200
	};
williamr@2
   201
williamr@2
   202
williamr@2
   203
//
williamr@2
   204
// CParserPropertyValueAlarm
williamr@2
   205
//
williamr@2
   206
class CParserPropertyValueAlarm : public CParserTimePropertyValue
williamr@2
   207
/** An alarm property value parser for a vCalendar entity.
williamr@2
   208
williamr@2
   209
An alarm can be associated with a vEvent or a vTodo. The value for the alarm 
williamr@2
   210
is stored as a CVersitAlarm.
williamr@2
   211
williamr@2
   212
Note: The UID for an alarm property value is KVCalPropertyAlarmUid. 
williamr@2
   213
williamr@2
   214
@publishedAll
williamr@2
   215
@released
williamr@2
   216
*/
williamr@2
   217
	{
williamr@2
   218
public:
williamr@2
   219
	IMPORT_C CParserPropertyValueAlarm(CVersitAlarm* aValue);
williamr@2
   220
	IMPORT_C CParserPropertyValueAlarm();
williamr@2
   221
	IMPORT_C ~CParserPropertyValueAlarm();
williamr@2
   222
	inline CVersitAlarm* Value() const;
williamr@2
   223
public: // from CParserTimePropertyValue
williamr@2
   224
	IMPORT_C void ConvertAllDateTimesToUTCL(const TTimeIntervalSeconds& aIncrement,const CVersitDaylight* aDaylight);
williamr@2
   225
	IMPORT_C void ConvertAllUTCDateTimesToMachineLocalL(const TTimeIntervalSeconds& aIncrement);
williamr@2
   226
public: // from CParserPropertyValue
williamr@2
   227
	IMPORT_C void ExternalizeL(RWriteStream& aStream,const Versit::TEncodingAndCharset& aEncodingCharset,TInt aLengthOutput);
williamr@2
   228
	IMPORT_C TBool IsAsciiCharacterSetSufficient();
williamr@2
   229
private:
williamr@2
   230
	CVersitAlarm* iValue;
williamr@2
   231
	};
williamr@2
   232
williamr@2
   233
williamr@2
   234
//
williamr@2
   235
// CParserPropertyValueExtendedAlarm
williamr@2
   236
//
williamr@2
   237
class CParserPropertyValueExtendedAlarm : public CParserTimePropertyValue
williamr@2
   238
/** An extended alarm property value parser for a vCalendar entity.
williamr@2
   239
williamr@2
   240
An alarm action can be attached with a vEvent or a vTodo. The value for the alarm 
williamr@2
   241
action is stored as a CVersitExtendedAlarm object. 
williamr@2
   242
williamr@2
   243
Note: The UID for an extended alarm property value is KVCalPropertyExtendedAlarmUid. 
williamr@2
   244
williamr@2
   245
@publishedAll
williamr@2
   246
@released
williamr@2
   247
*/
williamr@2
   248
	{
williamr@2
   249
public:
williamr@2
   250
	IMPORT_C CParserPropertyValueExtendedAlarm(CVersitExtendedAlarm* aValue);
williamr@2
   251
	IMPORT_C ~CParserPropertyValueExtendedAlarm();
williamr@2
   252
	inline CVersitExtendedAlarm* Value() const;
williamr@2
   253
public: // from CParserTimePropertyValue
williamr@2
   254
	IMPORT_C void ConvertAllDateTimesToUTCL(const TTimeIntervalSeconds& aIncrement,const CVersitDaylight* aDaylight);
williamr@2
   255
	IMPORT_C void ConvertAllUTCDateTimesToMachineLocalL(const TTimeIntervalSeconds& aIncrement);
williamr@2
   256
public: // from CParserPropertyValue
williamr@2
   257
	IMPORT_C void ExternalizeL(RWriteStream& aStream, const Versit::TEncodingAndCharset& aEncodingCharset, TInt aLengthOutput);
williamr@2
   258
	IMPORT_C TBool IsAsciiCharacterSetSufficient();
williamr@2
   259
private:
williamr@2
   260
	void ExternalizeUrlL(RWriteStream& aStream, const Versit::TEncodingAndCharset& aEncodingCharset, TInt aLengthOutput);
williamr@2
   261
	void ExternalizeInlineL(RWriteStream& aStream, const Versit::TEncodingAndCharset& aEncodingCharset, TInt aLengthOutput);
williamr@2
   262
	
williamr@2
   263
private:
williamr@2
   264
	CVersitExtendedAlarm* iValue;
williamr@2
   265
	};
williamr@2
   266
williamr@2
   267
#include <vcal.inl>
williamr@2
   268
williamr@2
   269
#endif