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