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