epoc32/include/vcal.h
branchSymbian2
changeset 2 2fe1408b6811
parent 0 061f57f2323e
     1.1 --- a/epoc32/include/vcal.h	Tue Nov 24 13:55:44 2009 +0000
     1.2 +++ b/epoc32/include/vcal.h	Tue Mar 16 16:12:26 2010 +0000
     1.3 @@ -1,1 +1,269 @@
     1.4 -vcal.h
     1.5 +// Copyright (c) 1997-2009 Nokia Corporation and/or its subsidiary(-ies).
     1.6 +// All rights reserved.
     1.7 +// This component and the accompanying materials are made available
     1.8 +// 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.9 +// which accompanies this distribution, and is available
    1.10 +// at the URL "http://www.symbianfoundation.org/legal/licencesv10.html".
    1.11 +//
    1.12 +// Initial Contributors:
    1.13 +// Nokia Corporation - initial contribution.
    1.14 +//
    1.15 +// Contributors:
    1.16 +//
    1.17 +// Description:
    1.18 +//
    1.19 + 
    1.20 +#if !defined(__VCAL_H__)
    1.21 +#define __VCAL_H__
    1.22 +
    1.23 +#if !defined(__VERSIT_H__)
    1.24 +#include <versit.h>
    1.25 +#endif
    1.26 +
    1.27 +#if !defined(__VRECUR_H__)
    1.28 +#include <vrecur.h>
    1.29 +#endif
    1.30 +
    1.31 +_LIT(KVersitTokenVCalVersionNo, "1.0");
    1.32 +
    1.33 +//
    1.34 +// CParserVCal
    1.35 +//
    1.36 +class CParserVCal : public CVersitParser
    1.37 +/** A vCalendar parser.
    1.38 +
    1.39 +Adds support for parsing vToDos and vEvents, and associated alarms 
    1.40 +(see CParserPropertyValueAlarm) to the functionality of CVersitParser.
    1.41 +
    1.42 +Adds a constructor and overrides CVersitParser::InternalizeL() for streams, 
    1.43 +ExternalizeL() for streams, RecognizeToken(), RecognizeEntityName() and MakeEntityL().
    1.44 +
    1.45 +The vCalendar data is read from or written to a stream or file, using the 
    1.46 +InternalizeL() and ExternalizeL() functions. Most users of this class will 
    1.47 +only need to use these functions.
    1.48 +
    1.49 +Note: if you are sequentially creating and destroying multiple 
    1.50 +parsers, a major performance improvement may be achieved by using thread local 
    1.51 +storage to store an instance of CVersitUnicodeUtils which persists and can be 
    1.52 +used by all of the parsers.
    1.53 +
    1.54 +See CVersitTlsData for more information. 
    1.55 +
    1.56 +@publishedAll
    1.57 +@released
    1.58 +*/
    1.59 +	{
    1.60 +public:
    1.61 +	IMPORT_C static CParserVCal* NewL();
    1.62 +public: // from CVersitParser
    1.63 +	IMPORT_C void InternalizeL(RReadStream& aStream);
    1.64 +	IMPORT_C void ExternalizeL(RWriteStream& aStream);
    1.65 +protected: // from CVersitParser
    1.66 +	IMPORT_C CVersitParser* MakeEntityL(TInt aEntityUid,HBufC* aEntityName);
    1.67 +public: // from CVersitParser
    1.68 +	IMPORT_C TUid RecognizeToken(const TDesC8& aToken) const;
    1.69 +	IMPORT_C TInt RecognizeEntityName() const;
    1.70 +private:
    1.71 +	CParserVCal();
    1.72 +private: // from CVersitParser
    1.73 +	IMPORT_C virtual void Reserved1();
    1.74 +	IMPORT_C virtual void Reserved2();
    1.75 +	};
    1.76 +
    1.77 +//
    1.78 +// CVersitAlarm
    1.79 +//
    1.80 +class CVersitAlarm : public CBase
    1.81 +/** An alarm for a vEvent or a vTodo. 
    1.82 +
    1.83 +Specifies the date/time for the alarm, the amount of time the alarm will be 
    1.84 +snoozed (optional), the number of times that the alarm will repeat, the binary 
    1.85 +data of the sound to be played when the alarm runs (optional), and some text 
    1.86 +to associate with the alarm (optional).
    1.87 +
    1.88 +An object of this class is owned by the CParserPropertyValueAlarm class.
    1.89 +
    1.90 +This class supports the following types of alarm:
    1.91 +
    1.92 +- Audible Alarm
    1.93 +
    1.94 +- Display Alarm (displays message on the screen) 
    1.95 +
    1.96 +- Procedure Alarm (calls a procedure)
    1.97 +
    1.98 +- Mail Alarm (sends an email). 
    1.99 +
   1.100 +@publishedAll
   1.101 +@released
   1.102 +*/
   1.103 +	{
   1.104 +public:
   1.105 +	IMPORT_C static CVersitAlarm* NewL(TVersitDateTime* aRunTime, TTime* aSnoozeTime, TInt aRepeatCount, const TDesC& aAudioContent, const TDesC& aNote);
   1.106 +	IMPORT_C ~CVersitAlarm();
   1.107 +private:
   1.108 +	CVersitAlarm(TVersitDateTime* aRunTime, TTime* aSnoozeTime, TInt aRepeatCount);
   1.109 +	void ConstructL(const TDesC& aAudioContent, const TDesC& aNote);
   1.110 +public:	
   1.111 +	/** The date/time for the alarm. */
   1.112 +	TVersitDateTime* iRunTime;
   1.113 +	/** The amount of time the alarm will be snoozed (optional). */
   1.114 +	TTime* iSnoozeTime;
   1.115 +	/** The number of times that the alarm will repeat. */
   1.116 +	TInt iRepeatCount;
   1.117 +	/** The binary data describing the sound to play for an AALARM (optional), or 
   1.118 +	the string which specifies the address to send the e-mail to, for an MALARM. */
   1.119 +	HBufC* iAudioContent;
   1.120 +	/** The mesage to display on the screen for a DALARM (optional), or 
   1.121 +	the body of the e-mail to be sent for an MALARM, or the name of the procedure 
   1.122 +	to call for a PALARM. */
   1.123 +	HBufC* iNote;//Empty except for MAlarm
   1.124 +	};
   1.125 +	
   1.126 +class CVersitExtendedAlarm : public CBase
   1.127 +/** An extended alarm for a vEvent or a vTodo. 
   1.128 +
   1.129 +Specifies the date/time for the alarm, the amount of time the alarm will be 
   1.130 +snoozed (optional), the number of times that the alarm will repeat, and the 
   1.131 +action for the alarm.
   1.132 +An object of this class is owned by the CParserPropertyValueAlarm class.
   1.133 +
   1.134 +This class supports the following types of alarm:
   1.135 +- X-EPOCALARM 
   1.136 +
   1.137 +@publishedPartner
   1.138 +@released
   1.139 +*/
   1.140 +	{
   1.141 +public:
   1.142 +
   1.143 +	/** Extended Alarm's disposition types.
   1.144 +	*/
   1.145 +	enum TDisposition
   1.146 +		{
   1.147 +		/** URL disposition
   1.148 +		*/
   1.149 +		EDispositionUrl = 0,
   1.150 +		/** Inline disposition
   1.151 +		*/
   1.152 +		EDispositionInline = 1,
   1.153 +		/** Unknown disposition
   1.154 +		*/
   1.155 +		EDispositionUnknown = 15
   1.156 +		};
   1.157 +	
   1.158 +	IMPORT_C static CVersitExtendedAlarm* NewL(const TDesC8& aContent,const TDesC8& aContentMimeType, CVersitExtendedAlarm::TDisposition aDisposition);
   1.159 +	IMPORT_C ~CVersitExtendedAlarm();
   1.160 +private:
   1.161 +	CVersitExtendedAlarm();
   1.162 +	void ConstructL(const TDesC8& aContent, const TDesC8& aContentMimeType, CVersitExtendedAlarm::TDisposition aContentDisposition);
   1.163 +public:	
   1.164 +	/** The data describing the action for the alarm.*/
   1.165 +	HBufC8* iContent;
   1.166 +	/** The MIME type of the data describing the action for the alarm.*/
   1.167 +	HBufC8* iMimeType;
   1.168 +	/** The disposition of the data for the alarm action (i.e whether it is inline or an URI).*/
   1.169 +	CVersitExtendedAlarm::TDisposition iDisposition;
   1.170 +	};
   1.171 +
   1.172 +//
   1.173 +// CParserVCalEntity
   1.174 +//
   1.175 +class CParserVCalEntity : public CRecurrenceParser
   1.176 +/** A parser for vCalendar sub-entities.
   1.177 +
   1.178 +A vCalendar sub-entity is a vEvent or vToDo contained in a vCalendar. vEvents 
   1.179 +and vToDos are derived from CRecurrenceParser, which provides recurrence functionality. 
   1.180 +
   1.181 +vEvents and vTodos may have alarm properties (see CParserPropertyValueAlarm). 
   1.182 +
   1.183 +@publishedAll
   1.184 +@released
   1.185 +*/
   1.186 +	{
   1.187 +public:
   1.188 +	IMPORT_C static CParserVCalEntity* NewL();
   1.189 +	IMPORT_C ~CParserVCalEntity();
   1.190 +public: // from CVersitParser
   1.191 +	IMPORT_C void ExternalizeL(RWriteStream& aStream);
   1.192 +protected: // from CVersitParser
   1.193 +	IMPORT_C CParserPropertyValue* MakePropertyValueL(const TUid& aPropertyUid,HBufC16*& aValue);
   1.194 +	IMPORT_C CVersitAlarm* MakePropertyValueAlarmL(TPtr16 aAlarmValue);
   1.195 +	IMPORT_C CVersitExtendedAlarm* MakePropertyValueExtendedAlarmL(TPtr16 aAlarmValue);
   1.196 +	IMPORT_C CVersitExtendedAlarm* MakePropertyValueExtendedAlarmL(CBufSeg& aAlarmValue);
   1.197 +	IMPORT_C CVersitExtendedAlarm::TDisposition DecodeDisposition(const TDesC8& aContentDispositionToken) const;
   1.198 +	IMPORT_C TUid RecognizeToken(const TDesC8& aToken) const;
   1.199 +private:
   1.200 +	CParserVCalEntity();
   1.201 +private: // from CVersitParser
   1.202 +	IMPORT_C virtual void Reserved1();
   1.203 +	IMPORT_C virtual void Reserved2();
   1.204 +	};
   1.205 +
   1.206 +
   1.207 +//
   1.208 +// CParserPropertyValueAlarm
   1.209 +//
   1.210 +class CParserPropertyValueAlarm : public CParserTimePropertyValue
   1.211 +/** An alarm property value parser for a vCalendar entity.
   1.212 +
   1.213 +An alarm can be associated with a vEvent or a vTodo. The value for the alarm 
   1.214 +is stored as a CVersitAlarm.
   1.215 +
   1.216 +Note: The UID for an alarm property value is KVCalPropertyAlarmUid. 
   1.217 +
   1.218 +@publishedAll
   1.219 +@released
   1.220 +*/
   1.221 +	{
   1.222 +public:
   1.223 +	IMPORT_C CParserPropertyValueAlarm(CVersitAlarm* aValue);
   1.224 +	IMPORT_C CParserPropertyValueAlarm();
   1.225 +	IMPORT_C ~CParserPropertyValueAlarm();
   1.226 +	inline CVersitAlarm* Value() const;
   1.227 +public: // from CParserTimePropertyValue
   1.228 +	IMPORT_C void ConvertAllDateTimesToUTCL(const TTimeIntervalSeconds& aIncrement,const CVersitDaylight* aDaylight);
   1.229 +	IMPORT_C void ConvertAllUTCDateTimesToMachineLocalL(const TTimeIntervalSeconds& aIncrement);
   1.230 +public: // from CParserPropertyValue
   1.231 +	IMPORT_C void ExternalizeL(RWriteStream& aStream,const Versit::TEncodingAndCharset& aEncodingCharset,TInt aLengthOutput);
   1.232 +	IMPORT_C TBool IsAsciiCharacterSetSufficient();
   1.233 +private:
   1.234 +	CVersitAlarm* iValue;
   1.235 +	};
   1.236 +
   1.237 +
   1.238 +//
   1.239 +// CParserPropertyValueExtendedAlarm
   1.240 +//
   1.241 +class CParserPropertyValueExtendedAlarm : public CParserTimePropertyValue
   1.242 +/** An extended alarm property value parser for a vCalendar entity.
   1.243 +
   1.244 +An alarm action can be attached with a vEvent or a vTodo. The value for the alarm 
   1.245 +action is stored as a CVersitExtendedAlarm object. 
   1.246 +
   1.247 +Note: The UID for an extended alarm property value is KVCalPropertyExtendedAlarmUid. 
   1.248 +
   1.249 +@publishedAll
   1.250 +@released
   1.251 +*/
   1.252 +	{
   1.253 +public:
   1.254 +	IMPORT_C CParserPropertyValueExtendedAlarm(CVersitExtendedAlarm* aValue);
   1.255 +	IMPORT_C ~CParserPropertyValueExtendedAlarm();
   1.256 +	inline CVersitExtendedAlarm* Value() const;
   1.257 +public: // from CParserTimePropertyValue
   1.258 +	IMPORT_C void ConvertAllDateTimesToUTCL(const TTimeIntervalSeconds& aIncrement,const CVersitDaylight* aDaylight);
   1.259 +	IMPORT_C void ConvertAllUTCDateTimesToMachineLocalL(const TTimeIntervalSeconds& aIncrement);
   1.260 +public: // from CParserPropertyValue
   1.261 +	IMPORT_C void ExternalizeL(RWriteStream& aStream, const Versit::TEncodingAndCharset& aEncodingCharset, TInt aLengthOutput);
   1.262 +	IMPORT_C TBool IsAsciiCharacterSetSufficient();
   1.263 +private:
   1.264 +	void ExternalizeUrlL(RWriteStream& aStream, const Versit::TEncodingAndCharset& aEncodingCharset, TInt aLengthOutput);
   1.265 +	void ExternalizeInlineL(RWriteStream& aStream, const Versit::TEncodingAndCharset& aEncodingCharset, TInt aLengthOutput);
   1.266 +	
   1.267 +private:
   1.268 +	CVersitExtendedAlarm* iValue;
   1.269 +	};
   1.270 +
   1.271 +#include <vcal.inl>
   1.272 +
   1.273 +#endif