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