epoc32/include/app/vprop.h
branchSymbian2
changeset 3 e1b950c65cb4
parent 2 2fe1408b6811
child 4 837f303aceeb
equal deleted inserted replaced
2:2fe1408b6811 3:e1b950c65cb4
       
     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 #ifndef __VPROP_H__
       
    17 #define __VPROP_H__
       
    18 
       
    19 #ifndef __E32BASE_H__
       
    20 #include <e32base.h>
       
    21 #endif
       
    22 
       
    23 #ifndef __BADESCA_H__
       
    24 #include <badesca.h>
       
    25 #endif
       
    26 
       
    27 #ifndef __S32STRM_H__
       
    28 #include <s32strm.h>
       
    29 #endif
       
    30 
       
    31 #ifndef __E32MATH_H__
       
    32 #include <e32math.h>
       
    33 #endif
       
    34 
       
    35 
       
    36 #ifndef __VUID_H__
       
    37 #include <vuid.h>
       
    38 #endif
       
    39 
       
    40 #ifndef __VTOKEN_H__
       
    41 #include <vtoken.h>
       
    42 #endif
       
    43 
       
    44 #ifndef __VUTIL_H__
       
    45 #include <vutil.h>
       
    46 #endif
       
    47 
       
    48 #ifndef __S32FILE_H__
       
    49 #include <s32file.h>
       
    50 #endif
       
    51 // 
       
    52 
       
    53 class CParserProperty;
       
    54 class CVersitParser;
       
    55 class MVersitPlugIn;
       
    56 class CParserPropertyValueCDesCArray;
       
    57 
       
    58 const TInt KRandomnumberlen = 5;
       
    59 const TInt KMaxGeneratedfilenamelen =16; 
       
    60 //
       
    61 // CParserParam
       
    62 //
       
    63 
       
    64 class CParserParam : public CBase
       
    65 /** A Versit property parameter. 
       
    66 
       
    67 A property parameter consists of a name and optionally a value, both in descriptor 
       
    68 form. Parser properties (class CParserProperty) may own one or more property 
       
    69 parameters.
       
    70 
       
    71 Note:
       
    72 
       
    73 The private parameter name and value members are stored as narrow (8-bit) 
       
    74 rather than 16-bit Unicode descriptors.
       
    75 
       
    76 However, certain member functions take or return a Unicode value, 
       
    77 for the purpose of backwards compatibility. In this case a simple conversion 
       
    78 takes place: this ignores the top 8 bits (for Unicode -> Narrow) or adds zero 
       
    79 for the top 8-bits (for Narrow->Unicode). 
       
    80 @publishedAll
       
    81 @released
       
    82 */
       
    83 	{
       
    84 public:
       
    85 	IMPORT_C static CParserParam* NewL(const TDesC8& aName, const TDesC8& aValue);
       
    86 	IMPORT_C static CParserParam* NewL(const TDesC8& aName, const TDesC& aValue);
       
    87 	IMPORT_C ~CParserParam();
       
    88 	IMPORT_C void SetValueL(const TDesC8& aValue);
       
    89 	IMPORT_C void SetValueL(HBufC8* aValue);
       
    90 	IMPORT_C TInt ExternalizeL(RWriteStream& aStream) const;
       
    91 	IMPORT_C TPtrC8 Name() const;
       
    92 	IMPORT_C TPtrC8 Value() const;
       
    93 	IMPORT_C HBufC* ValueL() const;
       
    94 	IMPORT_C TInt ExternalizeL(RWriteStream& aStream, TInt& aLengthOutput, CVersitParser* aVersitParser) const;
       
    95 private:
       
    96 	CParserParam(HBufC8* aName, HBufC8* aValue);
       
    97 private:
       
    98 	HBufC8* iParamName;
       
    99 	HBufC8* iValue;
       
   100 	};
       
   101 
       
   102 //
       
   103 // TVersitDateTime
       
   104 //
       
   105 
       
   106 class TVersitDateTime
       
   107 /** Defines a Versit date and time.
       
   108 
       
   109 This class is used throughout Versit to represent the date and time. It uses 
       
   110 a TDateTime object to store the date/time value and records whether this value 
       
   111 is local to the machine which originated the vCard, local to the machine on 
       
   112 which the code is running, or universal time (UTC).
       
   113 
       
   114 The Year(), Month() and Day() member functions of class TDateTime may be used 
       
   115 to extract the date and time components from the TVersitDateTime::iDateTime. 
       
   116 @publishedAll
       
   117 @released */
       
   118 	{
       
   119 public:
       
   120 	/** Relative time flags. */
       
   121 	enum TRelativeTime
       
   122 		{
       
   123 		/** Time is stored in UTC. */
       
   124 		EIsUTC,
       
   125 		/** Time is local to the machine which originated the vCard. */
       
   126 		EIsVCardLocal,
       
   127 		/** Time is local to the machine on which the code is running. */
       
   128 		EIsMachineLocal,
       
   129 		/** Unused. */
       
   130 		EIsCorrect
       
   131 		};
       
   132 	IMPORT_C TVersitDateTime(const TDateTime& aDateTime,TRelativeTime aRelativeTime);
       
   133 
       
   134 	/** Date/time flags. 
       
   135 	@publishedAll
       
   136 	@deprecated since 9.1*/
       
   137 	enum TVersitDateTimeFlags 
       
   138 		{
       
   139 		EExportNullFlag=0,
       
   140 		/** Indicates whether the relative time is to be externalized along with the date/time 
       
   141 		value.
       
   142 	
       
   143 		The flag is set to 'EExportNullFlag' by default.
       
   144 	
       
   145 		This is only implemented (by CParserTimePropertyValue::EncodeVersitDateTimeL()) 
       
   146 		if the date/time is universal. When the flag is set, the externalised value 
       
   147 		is followed by the token, KVersitTokenUniversalTime. */
       
   148 		EExportTimeZoneDesignator=0x01,
       
   149 		EExportLeaveAsLocalTime=0x02
       
   150 		};
       
   151 	/**
       
   152 	@deprecated since 9.1
       
   153 	*/
       
   154 	inline void SetFlag(TVersitDateTimeFlags aFlag) { iFlags |= aFlag; }
       
   155 	/**
       
   156 	@deprecated since 9.1
       
   157 	*/
       
   158 	inline TBool IsFlagSet(TVersitDateTimeFlags aFlag) const { return iFlags & aFlag; }
       
   159 	/**
       
   160 	@deprecated since 9.1
       
   161 	*/
       
   162 	inline void ClearFlag(TVersitDateTimeFlags aFlag) { iFlags &= ~aFlag; }
       
   163 public:
       
   164 	/** The date/time value. */
       
   165 	TDateTime iDateTime;
       
   166 	/** Specifies whether the time value is local to the machine which originated the 
       
   167 	vCard, local to the machine on which the code is running, or universal. */
       
   168 	TRelativeTime iRelativeTime;
       
   169 private:
       
   170 	TInt iFlags;
       
   171 	};
       
   172 
       
   173 //
       
   174 // CParserPropertyValue
       
   175 //
       
   176 class CParserPropertyValue : public CBase
       
   177 /** Abstract base class for all property values. 
       
   178 
       
   179 Defines a pure virtual ExternalizeL() function which should write out the 
       
   180 property value to a stream.
       
   181 
       
   182 The type of derived class is returned by the Uid() function; the UID value is 
       
   183 specified on construction.
       
   184 
       
   185 The other functions relate to the character set, encoding format and plug-in 
       
   186 used during externalising. 
       
   187 @publishedAll
       
   188 @released
       
   189 */
       
   190 	{
       
   191 public:
       
   192 	/** Externalises the property value to a write stream. 
       
   193 	
       
   194 	Implementations of this function are invoked by the parser's ExternalizeL() 
       
   195 	function.
       
   196 	
       
   197 	@param aStream Stream to which the property value is externalised.
       
   198 	@param aEncodingCharset The character set and encoding information.
       
   199 	@param aLengthOutput The amount of text that has been outputted so far on the 
       
   200 	line (for the property name), which may need to be taken into account when 
       
   201 	calculating if and where any line break should occur. */
       
   202 	virtual void ExternalizeL(RWriteStream& aStream,const Versit::TEncodingAndCharset& aEncodingCharset,TInt aLengthOutput)=0;
       
   203 	IMPORT_C virtual TBool IsAsciiCharacterSetSufficient();
       
   204 	IMPORT_C virtual void EncodeL(CBufBase* aTarget,const TDesC8& aSource,const TUid& aEncoding) const;
       
   205 	IMPORT_C virtual TBool SupportsInterface(const TUid& /*aInterfaceUid*/) const;
       
   206 	inline TUid Uid() const;
       
   207 	inline void SetPlugIn(MVersitPlugIn* aPlugIn);
       
   208 protected:
       
   209 	IMPORT_C CParserPropertyValue(const TUid& aPropertyValueUid);
       
   210 	IMPORT_C void FoldEncodeAndWriteValueToStreamL(RWriteStream& aStream, const TDesC& aValue
       
   211 														,const Versit::TEncodingAndCharset& aEncodingCharset,TInt& aLengthOutput) const;
       
   212 	IMPORT_C void FoldEncodeAndWriteValueToStreamL(RWriteStream& aStream, const CDesCArray* aValueArray
       
   213 														,const Versit::TEncodingAndCharset& aEncodingCharset,TInt& aLengthOutput) const;
       
   214 	IMPORT_C void FoldAndWriteValueToStreamL(RWriteStream& aStream, const TDesC& aValue
       
   215 														,const Versit::TEncodingAndCharset& aEncodingCharset,TInt& aLengthOutput) const;
       
   216 	IMPORT_C static void Append(TDes16& aTarget,TDesC8& aSource);
       
   217 protected:
       
   218     inline MVersitPlugIn* PlugIn();
       
   219 
       
   220 private:
       
   221 	TUid iPropertyValueTypeUid;
       
   222 	MVersitPlugIn* iPlugIn;
       
   223 	};
       
   224 
       
   225 //
       
   226 // CParserTimePropertyValue
       
   227 //
       
   228 
       
   229 class CVersitDaylight;
       
   230 
       
   231 class CParserTimePropertyValue : public CParserPropertyValue
       
   232 /** Abstract base class for all of the date/time property value classes.
       
   233 
       
   234 Provides date/time conversion functions between machine-local and universal 
       
   235 time. 
       
   236 
       
   237 The date/time property value classes are CParserPropertyValueAlarm, 
       
   238 CParserPropertyValueDate, CParserPropertyValueDateTime, 
       
   239 CParserPropertyValueMultiDateTime, CParserPropertyValueDaylight and 
       
   240 CParserPropertyValueRecurrence. 
       
   241 @publishedAll
       
   242 @released
       
   243 */
       
   244 	{
       
   245 public:
       
   246 	/** This is implemented, where applicable, to convert date/time 
       
   247 	values into universal time.
       
   248 	
       
   249 	The date/time is checked against the daylight saving information provided 
       
   250 	in aDaylight. If it falls inside the daylight saving period then the daylight 
       
   251 	saving offset is subtracted from the time to convert it to universal time. 
       
   252 	Otherwise aIncrement is added to the date/time of the alarm to convert it 
       
   253 	to universal time.
       
   254 	
       
   255 	Note that the daylight savings offset will adjust the time both for the daylight 
       
   256 	saving and for the time zone.
       
   257 	
       
   258 	The function has no effect if it date/times are already stored in universal 
       
   259 	time.
       
   260 	
       
   261 	If aDaylight is a NULL pointer then aIncrement is used.
       
   262 	
       
   263 	@param aIncrement A time interval in seconds which represents the time zone's 
       
   264 	offset from universal time. 
       
   265 	@param aDaylight Pointer to the specification for daylight saving. If the alarm's 
       
   266 	time value is within the period for daylight saving, the value is modified 
       
   267 	by the daylight saving offset (which accounts for both the time zone and daylight 
       
   268 	saving rule). 
       
   269 	@deprecated since 9.1
       
   270 	*/
       
   271 	IMPORT_C virtual void ConvertAllDateTimesToUTCL(const TTimeIntervalSeconds& aIncrement,const CVersitDaylight* aDaylight)=0;
       
   272 	/** Pure virtual function which is implemented, where applicable, to convert the 
       
   273 	date/time property value into machine-local time. 
       
   274 	
       
   275 	This process involves adjusting the date/time value by the offset in aIncrement.
       
   276 	
       
   277 	The function has no effect if the value is already stored as machine-local 
       
   278 	time.
       
   279 	
       
   280 	The universal date/times are assumed to have been corrected for any daylight saving 
       
   281 	rule in effect.
       
   282 	
       
   283 	@param aIncrement A time interval which represents the number of seconds which 
       
   284 	is to be added to the date/time value. This should normally be the universal 
       
   285 	time offset for the machine's locale. 
       
   286 	@deprecated since 9.1 */
       
   287 	IMPORT_C virtual void ConvertAllUTCDateTimesToMachineLocalL(const TTimeIntervalSeconds& aIncrement)=0;
       
   288 	static void ConvertDateTime(TDateTime& aDateTime,const TTimeIntervalSeconds& aIncrement,const CVersitDaylight* aDaylight,TBool aTo);
       
   289 public: //from CParserPropertyValue
       
   290 	IMPORT_C virtual TBool SupportsInterface(const TUid& aInterfaceUid) const;
       
   291 protected:
       
   292 	IMPORT_C CParserTimePropertyValue(const TUid& aPropertyValueUid);
       
   293 	IMPORT_C void ConvertDateTime(TDateTime* aDateTime,const TTimeIntervalSeconds& aIncrement,const CVersitDaylight* aDaylight);
       
   294 	IMPORT_C void EncodeVersitDateTimeL(TDes8& aBuf,const TVersitDateTime& aDateTime,TBool aEncodeTime=ETrue) const;
       
   295 	IMPORT_C void EncodeTimePeriodL(TDes8& aBuf,const TTime& aTimePeriod) const;
       
   296 	};
       
   297 
       
   298 //
       
   299 //  CParserPropertyValueHBufC
       
   300 //
       
   301 class CParserPropertyValueHBufC : public CParserPropertyValue
       
   302 /** A heap descriptor property value parser.
       
   303 
       
   304 Many properties are stored using this class. Examples are vCard e-mails and 
       
   305 vCalendar locations.
       
   306 
       
   307 The UID for a heap descriptor property value is KVersitPropertyHBufCUid. 
       
   308 @publishedAll
       
   309 @released
       
   310 */
       
   311 	{
       
   312 public:
       
   313 	IMPORT_C static CParserPropertyValueHBufC* NewL(const TDesC& aValue);
       
   314 	IMPORT_C CParserPropertyValueHBufC(HBufC16* aValue);
       
   315 	IMPORT_C ~CParserPropertyValueHBufC();
       
   316 	IMPORT_C TPtrC Value() const;
       
   317 	IMPORT_C HBufC* TakeValueOwnership();
       
   318     IMPORT_C CParserPropertyValueCDesCArray* TreatAsArrayPropertyLC(const CParserProperty& aOwningProperty) const;
       
   319 public: // from CParserPropertyValue
       
   320 	IMPORT_C TBool IsAsciiCharacterSetSufficient();
       
   321 	IMPORT_C void ExternalizeL(RWriteStream& aStream,const Versit::TEncodingAndCharset& aEncodingCharset,TInt aLengthOutput);
       
   322 private:
       
   323 	CParserPropertyValueHBufC();
       
   324 	void ConstructL(const TDesC& aValue);
       
   325 protected:
       
   326 	HBufC* iValue;
       
   327 	};
       
   328 
       
   329 //
       
   330 //  CParserPropertyValueBinary
       
   331 //
       
   332 
       
   333 class CParserPropertyValueBinary : public CParserPropertyValue
       
   334 /** A binary property value parser.
       
   335 
       
   336 It is used to store logos, photos, alarm content and binary attachment as binary values.
       
   337 
       
   338 The UID for a binary property value is KVersitPropertyBinaryUid. 
       
   339 @publishedAll
       
   340 @released
       
   341 */
       
   342 	{
       
   343 public:
       
   344 	IMPORT_C static CParserPropertyValueBinary* NewL(const TDesC8& aValue);
       
   345 	IMPORT_C static CParserPropertyValueBinary* NewLC(const TDesC8& aValue);
       
   346 
       
   347 	inline CParserPropertyValueBinary(CBufSeg& aValue);
       
   348 	IMPORT_C ~CParserPropertyValueBinary();
       
   349 	IMPORT_C const CBufSeg* Value() const;
       
   350 public: // from CParserPropertyValue
       
   351 	IMPORT_C void ExternalizeL(RWriteStream& aStream,const Versit::TEncodingAndCharset& aEncodingCharset,TInt /*aLengthOutput*/);
       
   352 protected:
       
   353 	inline CParserPropertyValueBinary();
       
   354 	void ConstructL(const TDesC8& aValue);
       
   355 	void ExternalizeL(RWriteStream& aStream, const Versit::TEncodingAndCharset& aEncodingCharset, TInt aLengthOutput, RReadStream& aReadStream);
       
   356 
       
   357 protected:
       
   358 	CBufSeg* iValue;
       
   359 	};//
       
   360 	
       
   361 NONSHARABLE_CLASS(CParserPropertyValueBinaryFile) : public CParserPropertyValueBinary
       
   362 /** A file property value parser.
       
   363 
       
   364 It is used to store a file handle so that the binary data can be read through the handle when exporting.
       
   365 It is not used when importing.
       
   366 The UID for a binary property value is KVersitPropertyBinaryUid. 
       
   367 @publishedPartner
       
   368 @prototype
       
   369 */
       
   370 	{
       
   371 public:
       
   372 	IMPORT_C static CParserPropertyValueBinaryFile* NewL(const RFile& aFileHandle);
       
   373 	IMPORT_C ~CParserPropertyValueBinaryFile();
       
   374 public: // from CParserPropertyValue
       
   375 	void ExternalizeL(RWriteStream& aStream,const Versit::TEncodingAndCharset& aEncodingCharset,TInt aLengthOutput);
       
   376 
       
   377 private:
       
   378 	void ConstructL(const RFile& aFileHandle);
       
   379 private:
       
   380 	RFileReadStream iFileStream;
       
   381 	};
       
   382 
       
   383 //  CParserPropertyValueCDesCArray
       
   384 //
       
   385 class CParserPropertyValueCDesCArray : public CParserPropertyValue
       
   386 /** A property value parser which stores an array of descriptors.
       
   387 
       
   388 Can be used by both vCards and vCalendars, for example to store a postal address 
       
   389 or information about an organisation.
       
   390 
       
   391 The UID for a descriptor array property value is KVersitPropertyCDesCArrayUid. 
       
   392 @publishedAll
       
   393 @released
       
   394 */
       
   395 	{
       
   396 public:
       
   397 	IMPORT_C CParserPropertyValueCDesCArray(CDesCArray* aValue);
       
   398 	IMPORT_C ~CParserPropertyValueCDesCArray();
       
   399 	inline CDesCArray* Value() const;
       
   400 	IMPORT_C TBool IsPresent(const TDesC& aValue) const;
       
   401 public: // from CParserPropertyValue
       
   402 	IMPORT_C TBool IsAsciiCharacterSetSufficient();
       
   403 	IMPORT_C void ExternalizeL(RWriteStream& aStream,const Versit::TEncodingAndCharset& aEncodingCharset,TInt aLengthOutput);
       
   404 protected:
       
   405 	CDesCArray* iValue;
       
   406 	};
       
   407 
       
   408 //
       
   409 // CParserPropertyValueTimeZone
       
   410 //
       
   411 
       
   412 class CParserPropertyValueTimeZone: public CParserPropertyValue
       
   413 /** A time zone property value parser.
       
   414 
       
   415 Stores and externalises a property value which represents the time zone information 
       
   416 for a vCard or vCalendar. 
       
   417 
       
   418 The time zone is specified as the universal time offset. This is a time interval 
       
   419 which is a positive or negative number of seconds from universal time. Time 
       
   420 zones east of universal time have positive numbers. Time zones west of universal 
       
   421 time have negative numbers.
       
   422 
       
   423 The UID for a time zone property value is KVersitPropertyTimeZoneUid. 
       
   424 @publishedAll
       
   425 @released
       
   426 */
       
   427 	{
       
   428 public:
       
   429 	static void EncodeTimeZone(TDes8& aBuf,TTimeIntervalSeconds iValue);
       
   430 	IMPORT_C CParserPropertyValueTimeZone(TTimeIntervalSeconds aValue);
       
   431 	inline TTimeIntervalSeconds Value() const;
       
   432 public: // from CParserPropertyValue
       
   433 	IMPORT_C void ExternalizeL(RWriteStream& aStream,const Versit::TEncodingAndCharset& aEncodingCharset,TInt /*aLengthOutput*/);
       
   434 protected:
       
   435 	TTimeIntervalSeconds iValue;
       
   436 	};
       
   437 
       
   438 //
       
   439 // CVersitDaylight
       
   440 //
       
   441 class CVersitDaylight : public CBase
       
   442 /** Universal time offset information, including the daylight savings offset. 
       
   443 
       
   444 This class deals with the daylight saving offset: a one hour offset that occurs 
       
   445 in many countries during part of the year. This offset needs to be taken into 
       
   446 account when converting Versit times (TVersitDateTimes) between universal 
       
   447 and machine-local times.
       
   448 
       
   449 This class stores information about the offset, including its length in seconds, 
       
   450 when it takes effect and the standard time designations.
       
   451 
       
   452 Note that the universal offset (iOffset) is the sum of the daylight saving 
       
   453 offset and any time zone offset, as it is the absolute offset from GMT.
       
   454 
       
   455 An instance of this class is owned by the CParserPropertyValueDaylight class. 
       
   456 @publishedAll
       
   457 @released
       
   458 */
       
   459 	{
       
   460 public:
       
   461 	IMPORT_C static CVersitDaylight* NewL(TBool aSavings, TTimeIntervalSeconds aOffset, TVersitDateTime* aStartTime, TVersitDateTime* aEndTime, const TDesC& aStandardDesignation, const TDesC& aDaylightDesignation);
       
   462 	IMPORT_C ~CVersitDaylight();
       
   463 private:
       
   464 	CVersitDaylight(TBool aSavings, TTimeIntervalSeconds aOffset, TVersitDateTime* aStartTime, TVersitDateTime* aEndTime);
       
   465 	void ConstructL(const TDesC& aStandardDesignation, const TDesC& aDaylightDesignation);
       
   466 public:
       
   467 	/** A sort key than can be used when sorting an array of properties by start date/time. */
       
   468 	TInt64 iStartTimeSortKey;
       
   469 	/** The daylight savings flag: this is ETrue if daylight saving is in effect 
       
   470 	in the locale and EFalse if not. */
       
   471 	TBool iSavings;
       
   472 	/** The absolute offset from GMT, which is the sum of the time zone and daylight 
       
   473 	saving offsets (in seconds). */
       
   474 	TTimeIntervalSeconds iOffset;
       
   475 	/** The date/time at which the period for daylight saving begins. */
       
   476 	TVersitDateTime* iStartTime;
       
   477 	/** The date/time at which the period for daylight saving ends. */
       
   478 	TVersitDateTime* iEndTime;
       
   479 	/** The standard time designation, e.g. GMT, EST. */
       
   480 	HBufC* iStandardDesignation;
       
   481 	/** The daylight saving time designation, e.g. BST, EDT. */
       
   482 	HBufC* iDaylightDesignation;
       
   483 	};
       
   484 
       
   485 //
       
   486 // CParserPropertyValueDaylight
       
   487 //
       
   488 class CParserPropertyValueDaylight : public CParserTimePropertyValue
       
   489 /** A property value parser which contains the daylight savings rule for a vCalendar.
       
   490 
       
   491 The property value is stored using an instance of the CVersitDaylight class.
       
   492 
       
   493 The UID for a daylight savings rule property value is KVersitPropertyDaylightUid. 
       
   494 @publishedAll
       
   495 @released
       
   496 */
       
   497 	{
       
   498 public:
       
   499 	IMPORT_C CParserPropertyValueDaylight(CVersitDaylight* aValue);
       
   500 	IMPORT_C ~CParserPropertyValueDaylight();
       
   501 	inline CVersitDaylight* Value() const;
       
   502 public: // from CParserTimePropertyValue
       
   503 	IMPORT_C void ConvertAllDateTimesToUTCL(const TTimeIntervalSeconds& aIncrement,const CVersitDaylight* aDaylight);
       
   504 	IMPORT_C void ConvertAllUTCDateTimesToMachineLocalL(const TTimeIntervalSeconds& aIncrement);
       
   505 public: // from CParserPropertyValue
       
   506 	IMPORT_C void ExternalizeL(RWriteStream& aStream,const Versit::TEncodingAndCharset& aEncodingCharset,TInt aLengthOutput);
       
   507 private:
       
   508 	CVersitDaylight* iValue;
       
   509 	};
       
   510 
       
   511 //
       
   512 //  CParserPropertyValueDateTime
       
   513 //
       
   514 class CParserPropertyValueDateTime : public CParserTimePropertyValue
       
   515 /** A date/time property value parser. 
       
   516 
       
   517 The date/time value is contained in a TVersitDateTime object.
       
   518 
       
   519 The UID for a date/time property value is KVersitPropertyDateTimeUid. 
       
   520 @publishedAll
       
   521 @released
       
   522 */
       
   523 	{
       
   524 public:
       
   525 	IMPORT_C CParserPropertyValueDateTime(TVersitDateTime* aValue);
       
   526 	IMPORT_C ~CParserPropertyValueDateTime();
       
   527 	inline TVersitDateTime* Value() const;
       
   528 public: // from CParserTimePropertyValue
       
   529 	IMPORT_C void ConvertAllDateTimesToUTCL(const TTimeIntervalSeconds& aIncrement,const CVersitDaylight* aDaylight);
       
   530 	IMPORT_C void ConvertAllUTCDateTimesToMachineLocalL(const TTimeIntervalSeconds& aIncrement);
       
   531 public: // from CParserPropertyValue
       
   532 	IMPORT_C void ExternalizeL(RWriteStream& aStream,const Versit::TEncodingAndCharset& /*aEncodingCharset*/,TInt /*aLengthOutput*/);
       
   533 protected:
       
   534 	TVersitDateTime* iValue;
       
   535 	};
       
   536 
       
   537 //
       
   538 //  CParserPropertyValueDate
       
   539 //
       
   540 class CParserPropertyValueDate : public CParserTimePropertyValue
       
   541 /** A date property value parser.
       
   542 
       
   543 The date value is contained in a TVersitDateTime object. 
       
   544 
       
   545 The UID for a date property value is KVersitPropertyDateUid. 
       
   546 @publishedAll
       
   547 @released
       
   548 */
       
   549 	{
       
   550 public:
       
   551 	IMPORT_C CParserPropertyValueDate(TVersitDateTime* aValue);
       
   552 	IMPORT_C ~CParserPropertyValueDate();
       
   553 	inline TVersitDateTime* Value() const;
       
   554 public: // from CParserTimePropertyValue
       
   555 	IMPORT_C void ConvertAllDateTimesToUTCL(const TTimeIntervalSeconds& /*aIncrement*/,const CVersitDaylight* /*aDaylight*/);
       
   556 	IMPORT_C void ConvertAllUTCDateTimesToMachineLocalL(const TTimeIntervalSeconds& /*aIncrement*/);
       
   557 public: // from CParserPropertyValue
       
   558 	IMPORT_C void ExternalizeL(RWriteStream& aStream,const Versit::TEncodingAndCharset& aEncodingCharset,TInt /*aLengthOutput*/);
       
   559 private:
       
   560 	TVersitDateTime* iValue;
       
   561 	};
       
   562 
       
   563 //
       
   564 //  CParserPropertyValueMultiDateTime
       
   565 //
       
   566 class CParserPropertyValueMultiDateTime : public CParserTimePropertyValue
       
   567 /** A property value parser which stores a list of date/time values using an array 
       
   568 of TVersitDateTime objects.
       
   569 
       
   570 The UID for a multiple date/time property value is KVersitPropertyMultiDateTimeUid. 
       
   571 @publishedAll
       
   572 @released
       
   573 */
       
   574 	{
       
   575 public:
       
   576 	IMPORT_C CParserPropertyValueMultiDateTime(CArrayPtr<TVersitDateTime>* aValue);
       
   577 	IMPORT_C ~CParserPropertyValueMultiDateTime();
       
   578 	inline CArrayPtr<TVersitDateTime>* Value() const;
       
   579 public: // from CParserTimePropertyValue
       
   580 	IMPORT_C void ConvertAllDateTimesToUTCL(const TTimeIntervalSeconds& aIncrement,const CVersitDaylight* aDaylight);
       
   581 	IMPORT_C void ConvertAllUTCDateTimesToMachineLocalL(const TTimeIntervalSeconds& aIncrement);
       
   582 public: // from CParserPropertyValue
       
   583 	IMPORT_C void ExternalizeL(RWriteStream& aStream,const Versit::TEncodingAndCharset& /*aEncodingCharset*/,TInt aLengthOutput);
       
   584 protected:
       
   585 	CArrayPtr<TVersitDateTime>* iValue;
       
   586 	};
       
   587 
       
   588 //
       
   589 //  CParserPropertyValueInt
       
   590 //
       
   591 class CParserPropertyValueInt : public CParserPropertyValue
       
   592 /** An integer property value parser.
       
   593 
       
   594 This stores a property value as a signed integer. For example, an employee 
       
   595 ID number might be stored using this class.
       
   596 
       
   597 The UID for an integer property value is KVersitPropertyIntUid. 
       
   598 @publishedAll
       
   599 @released
       
   600 */
       
   601 	{
       
   602 public:
       
   603 	IMPORT_C CParserPropertyValueInt(TInt aValue);
       
   604 	inline TInt Value() const;
       
   605 public: // from CParserPropertyValue
       
   606 	IMPORT_C void ExternalizeL(RWriteStream& aStream,const Versit::TEncodingAndCharset& aEncodingCharset,TInt /*aLengthOutput*/);
       
   607 protected:
       
   608 	TInt iValue;
       
   609 	};
       
   610 
       
   611 //
       
   612 //	CParserProperty
       
   613 //
       
   614 
       
   615 class CParserProperty : public CBase
       
   616 /** A vCard or vCalendar property.
       
   617 
       
   618 A property consists of a name, an optional value and one or more optional 
       
   619 parameters.
       
   620 
       
   621 The name, value and parameters are initialised on construction.
       
   622 
       
   623 Versit properties have the general form:
       
   624 
       
   625 Property Name (; Property Parameter Name(=Property Parameter Value)* : Property 
       
   626 Value)
       
   627 
       
   628 where items in brackets are optional and * indicates that the item may be 
       
   629 repeated. 
       
   630 
       
   631 For instance, TEL; HOME; ENCODING=QUOTED-PRINTABLE; CHARSET=US-ASCII : 01234 567890
       
   632 
       
   633 Here, TEL is the property name; HOME, ENCODING and CHARSET are property parameter 
       
   634 names; QUOTED-PRINTABLE and US-ASCII are property parameter values. The component 
       
   635 following the colon is the property value.
       
   636 
       
   637 Properties also have a name UID, which set during internalisation of a property 
       
   638 and used only during internalisation. It is set by SetNameUid() and is used 
       
   639 to allow number comparisons during internalisation. This provides a faster 
       
   640 alternative to string comparisons when checking a property to see if it is 
       
   641 a significant one (e.g. a begin or binary property). This is the only use 
       
   642 of the name UID: it is not used during externalisation of a property.
       
   643 
       
   644 Note that grouped properties are supported by the derived class, CParserGroupedProperty. 
       
   645 The vCalender parser does not have property groups, and so stores all properties 
       
   646 using this base class, whereas the vCard parser stores all properties using 
       
   647 CParserGroupedProperty. 
       
   648 @publishedAll
       
   649 @released
       
   650 */
       
   651 	{
       
   652 public:
       
   653 	IMPORT_C static					CParserProperty* NewL(CParserPropertyValue& aPropertyValue, const TDesC8& aName, CArrayPtr<CParserParam>* aArrayOfParams);
       
   654 	IMPORT_C CParserProperty(CArrayPtr<CParserParam>* aArrayOfParams);
       
   655 	IMPORT_C ~CParserProperty();
       
   656 	IMPORT_C virtual void			ExternalizeL(RWriteStream& aStream, CVersitParser* aVersitParser = NULL);
       
   657 	IMPORT_C CParserParam*			Param(const TDesC8& aParamName) const; // note params can only appear once
       
   658 	IMPORT_C void					AddParamL(CParserParam* aParam);
       
   659 	IMPORT_C void					DeleteParam(TDesC8& aParamName);
       
   660 	IMPORT_C void					SetNameL(const TDesC8& aName);
       
   661 	IMPORT_C virtual TBool			SupportsInterface(const TUid& /*aInterfaceUid*/) const;
       
   662 	IMPORT_C TPtrC8					Name() const;
       
   663 	inline void						SetValue(CParserPropertyValue* aPropertyValue);
       
   664 	inline CParserPropertyValue*	Value() const;
       
   665 	inline TUid						Uid() const;
       
   666 	inline void						SetNameUid(TUid aUid);
       
   667 	inline TUid						NameUid() const;
       
   668 	inline void						SetParamArray(CArrayPtr<CParserParam>* aArrayOfParams);
       
   669 
       
   670 	
       
   671 	IMPORT_C TBool LoadBinaryValuesFromFilesL(RFs& aFileSession);
       
   672 	IMPORT_C TBool SaveBinaryValuesToFilesL(TInt aSizeThreshold,const TDesC& aPath,RFs& aFileSession);
       
   673 protected:
       
   674 	IMPORT_C CParserProperty(CParserPropertyValue& aPropertyValue, CArrayPtr<CParserParam>* aArrayOfParams);
       
   675 	IMPORT_C static void			ConstructSelfL(CParserProperty& aSelf,const TDesC8& aName);
       
   676 
       
   677 public:
       
   678 	IMPORT_C CArrayPtr<CParserParam>* ParamArray()const;
       
   679 
       
   680 protected:
       
   681 	CParserPropertyValue*			iPropertyValue;
       
   682 	HBufC8*							iPropertyName;
       
   683 	TUid							iPropertyNameUid;
       
   684 	CArrayPtr<CParserParam>*		iArrayOfParams;
       
   685 
       
   686 private:
       
   687 	friend class CVersitParser;
       
   688 	inline HBufC8*&					NameBuf();
       
   689 	IMPORT_C virtual void			Reserved();
       
   690 	void ReadBinaryDataL(const CBufSeg* aBufseg_ptr,HBufC8** aBuffer);
       
   691 	void GenerateNameAndCreateFileL(RFs& aFileSession,TPtr8 aPropertyName,RFile& aFile,TDes& aFileName);
       
   692 	
       
   693 	};
       
   694 
       
   695 #include <vprop.inl>
       
   696 
       
   697 #endif