epoc32/include/app/versit.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 __VERSIT_H__
williamr@2
    17
#define __VERSIT_H__
williamr@2
    18
williamr@2
    19
// System includes
williamr@2
    20
#include <e32base.h>
williamr@2
    21
#include <badesca.h>
williamr@2
    22
#include <s32file.h>
williamr@2
    23
williamr@2
    24
// User includes
williamr@2
    25
#include <vuid.h>
williamr@2
    26
#include <vtoken.h>
williamr@2
    27
#include <vprop.h>
williamr@2
    28
#include <versittls.h>
williamr@2
    29
williamr@2
    30
// Classes referenced
williamr@2
    31
class RFile;
williamr@2
    32
class TVersitDateTime;
williamr@2
    33
class MVersitObserver;
williamr@2
    34
class MVersitPlugIn;
williamr@2
    35
williamr@4
    36
#ifndef SYMBIAN_ENABLE_SPLIT_HEADERS
williamr@2
    37
// Panic enumeration
williamr@2
    38
/** Versit panic numbers. The Versit panic numbers have a category of "Versit-Parser". 
williamr@2
    39
@internalComponent
williamr@2
    40
@released
williamr@2
    41
*/
williamr@2
    42
enum TVersitParserPanic
williamr@2
    43
	{
williamr@2
    44
	ECurrentTokenNotFound,		//Unused
williamr@2
    45
	EUnicodeUtilsNotFound,		//Unused
williamr@2
    46
	ENoPropertyValue,		//Unused
williamr@2
    47
	/** A CWeekDayArray contains an invalid value (not between EMonday 
williamr@2
    48
	and ESunday inclusive). */
williamr@2
    49
	ENoWeekdayFound,
williamr@2
    50
	/** The number of a week within a month is invalid. */
williamr@2
    51
	EWeekNoOverTen,
williamr@2
    52
	/** The repeat type for a recurrence rule property value is not one of the values 
williamr@2
    53
	specified in CVersitRecurrence::TType. */
williamr@2
    54
	ENoRecognizedRepeatType,
williamr@2
    55
	EVersitPanicEscapedTextAlreadyExists,		//Unused
williamr@2
    56
	/** 8-bit encoding is proposed as the default for a parser but may not be appropriate. */
williamr@2
    57
	EVersitPanicCannotSetEightBitEncoding,
williamr@2
    58
	/** 8-bit encoding is encountered or proposed where it is not expected. */
williamr@2
    59
	EVersitPanicUnexpectedEightBitEncoding,
williamr@2
    60
	/** A parser was not specified when externalising a property. */
williamr@2
    61
	EVersitPanicNeedToSpecifyParser,
williamr@2
    62
	/** The additional storage slot for the given property has already been used */
williamr@2
    63
	EVersitPanicAdditionalStorageSlotAlreadyInUse,
williamr@2
    64
	/** Attempting to assign a NULL value to an additional storage slot  */
williamr@2
    65
	EVersitPanicNullValueAssignedToAdditionalStorageSlot,
williamr@2
    66
	//
williamr@2
    67
	EVersitPanicLast
williamr@2
    68
	};
williamr@2
    69
williamr@2
    70
/**
williamr@2
    71
Used as key into additional storage within tls object, for CVersitTLSContainer
williamr@2
    72
Value should not conflict with genuine compiler generated pointer values
williamr@4
    73
@internalComponent
williamr@4
    74
@released
williamr@2
    75
*/
williamr@2
    76
const static TInt* const KTLSVars = reinterpret_cast<TInt*>(1);
williamr@4
    77
/**
williamr@4
    78
@internalComponent
williamr@4
    79
@released
williamr@4
    80
*/
williamr@4
    81
GLREF_C void DestroyHBufC(TAny* aHBufC);
williamr@4
    82
/** Versit parser panic
williamr@4
    83
@internalComponent
williamr@4
    84
@released
williamr@4
    85
*/
williamr@4
    86
IMPORT_C void Panic(TVersitParserPanic aPanic);
williamr@4
    87
#endif //SYMBIAN_ENABLE_SPLIT_HEADERS
williamr@2
    88
williamr@2
    89
williamr@2
    90
williamr@4
    91
#ifndef SYMBIAN_ENABLE_SPLIT_HEADERS
williamr@2
    92
/** Extension mechanism for CLineReader
williamr@2
    93
This is an internal class and is only for use by CLineReader
williamr@2
    94
@internalComponent
williamr@2
    95
@released
williamr@2
    96
*/
williamr@4
    97
NONSHARABLE_CLASS(CLineReaderExtension) : public CBase
williamr@2
    98
	{
williamr@2
    99
	friend class CLineReader;
williamr@2
   100
private:
williamr@2
   101
	CLineReaderExtension();
williamr@4
   102
	~CLineReaderExtension();
williamr@4
   103
williamr@2
   104
	static CLineReaderExtension* NewL();
williamr@4
   105
	
williamr@4
   106
	void DeleteBase64ValueBuffer();
williamr@4
   107
	HBufC8* CreateBase64ValueBufferL();
williamr@4
   108
	HBufC8* Base64ValueBuffer();
williamr@2
   109
private:
williamr@2
   110
	TUint8 iBuf[1024];
williamr@2
   111
	TInt iOffset;
williamr@2
   112
	TInt iSize;
williamr@4
   113
williamr@4
   114
// Hold the line buffer temporarily. 
williamr@4
   115
// It is only used when the client wants
williamr@4
   116
// the base64 extended behaviour defined
williamr@4
   117
// in MVersitPlugInExtensionBase64Ending
williamr@4
   118
	HBufC8* iLineBase64Value;
williamr@2
   119
	};
williamr@4
   120
#else
williamr@4
   121
//Forward declare class
williamr@4
   122
class CLineReaderExtension;	
williamr@4
   123
#endif //SYMBIAN_ENABLE_SPLIT_HEADERS
williamr@2
   124
williamr@2
   125
class CLineReader : public CBase
williamr@2
   126
/** Line reader for a vCalendar or vCard parser.
williamr@2
   127
williamr@2
   128
Reads in a line at a time for the parser. 
williamr@2
   129
williamr@2
   130
Also allows the first character of the next line to be checked to see if it 
williamr@2
   131
is a space, which can indicate that the line is wrapped. This enables the 
williamr@2
   132
reading of multi-line property values.
williamr@2
   133
williamr@2
   134
Used by CVersitParser to internalise streams. 
williamr@2
   135
@publishedAll
williamr@2
   136
@released
williamr@2
   137
*/
williamr@2
   138
	{
williamr@2
   139
public:
williamr@2
   140
	/** Defines the initial line size of, and the size of expansions to, the buffer 
williamr@2
   141
	which stores the line being read. */
williamr@2
   142
	enum
williamr@2
   143
		{
williamr@2
   144
		/** The initial size of the buffer (pointed to by iBuf). */
williamr@2
   145
		EInitialLineSize=96,
williamr@2
   146
		/** The size by which the buffer (pointed to by iBuf) 
williamr@2
   147
		is expanded when it has run out of room. */
williamr@2
   148
		EExpandSize=16,
williamr@2
   149
		};
williamr@2
   150
	/** Defines values which describe the content of a line that has been read.
williamr@2
   151
williamr@2
   152
	This is the return value from the function ReadLine(). */
williamr@2
   153
	enum
williamr@2
   154
		{
williamr@2
   155
		/** The line has content (not white space). */
williamr@2
   156
		ELineHasContent=0,
williamr@2
   157
		/** The line has white space only. */
williamr@2
   158
		ELineIsWhiteSpace=1,		//Doesn't include next case
williamr@2
   159
		/** The line has no content, and so is just a carriage return and line 
williamr@2
   160
		feed ("/r/n"). */
williamr@2
   161
		ELineIsCRLFOnly=2,
williamr@4
   162
		/** The line has a colon
williamr@4
   163
		This is only used internally. When the line has a colon, ReadLineL will
williamr@4
   164
		return  ELineHasContent for the sake of backwards compatibility. 
williamr@4
   165
		*/
williamr@4
   166
		ELineHasColon
williamr@2
   167
		};
williamr@2
   168
public:
williamr@2
   169
	IMPORT_C static CLineReader* NewL(RReadStream& aStream);
williamr@2
   170
	IMPORT_C ~CLineReader();
williamr@4
   171
	IMPORT_C virtual TInt ReadLineL(TInt aPos,TInt& aErr);
williamr@2
   172
	IMPORT_C TBool AppendLineIfSpaceNextL();
williamr@2
   173
	IMPORT_C TBool IsSpaceNextL();
williamr@2
   174
	IMPORT_C TInt AppendSpaceL();
williamr@2
   175
	inline void SetPlugIn(MVersitPlugIn* aPlugIn);
williamr@2
   176
	inline void SetSkipWhiteSpaceAtStart(TBool aDoSkip);
williamr@4
   177
williamr@4
   178
public:
williamr@4
   179
	void ReadBase64ValueL(TInt aPopValueStart);
williamr@4
   180
williamr@2
   181
protected:
williamr@2
   182
	inline CLineReader(RReadStream& aStream) :iReadStream(&aStream), iBufPtr(NULL,0), iFirstCharNextLine(-1) {}
williamr@2
   183
	IMPORT_C void ConstructL();
williamr@2
   184
	IMPORT_C void ExpandBufferL(TInt aCurrentSize);
williamr@2
   185
	IMPORT_C TUint8 ReadChar(TInt& aErr);
williamr@4
   186
williamr@2
   187
private:
williamr@2
   188
	IMPORT_C virtual void Reserved();
williamr@4
   189
	
williamr@4
   190
private:
williamr@4
   191
	TInt ReadLineL(HBufC8*& aHBuf, TInt aPos,TInt& aErr);
williamr@4
   192
williamr@2
   193
public:
williamr@2
   194
	/** A pointer to an RReadStream object, the ReadUint8L() function of which is used 
williamr@2
   195
	to read single characters from the stream.
williamr@2
   196
	
williamr@2
   197
	This is passed into the NewL() function upon construction. */
williamr@2
   198
	RReadStream* iReadStream;
williamr@2
   199
	/** A pointer to a buffer which stores data read from the stream.
williamr@2
   200
	
williamr@2
   201
	Its size on construction is EInitialLineSize, and it is expanded by EExpandSize 
williamr@2
   202
	when necessary.
williamr@2
   203
	
williamr@2
   204
	A copy of this value should not be stored, since the buffer location may change 
williamr@2
   205
	if the buffer is expanded.
williamr@2
   206
	
williamr@2
   207
	Data in the buffer is not lost when the buffer is expanded, but is copied 
williamr@2
   208
	to the new location. */
williamr@2
   209
	TPtr8 iBufPtr;
williamr@2
   210
protected:
williamr@2
   211
	HBufC8* iLineBuf;
williamr@2
   212
	TInt iFirstCharNextLine;
williamr@2
   213
private:
williamr@2
   214
	MVersitPlugIn* iPlugIn;
williamr@2
   215
	TBool iSkipWhiteSpaceAtStart;
williamr@2
   216
	CLineReaderExtension* iExtension;
williamr@2
   217
	};
williamr@2
   218
williamr@2
   219
class CVersitParser : public CBase
williamr@2
   220
/** A generic Versit parser. 
williamr@2
   221
williamr@2
   222
Provides generic functions which implement behaviour common to both vCalendar 
williamr@2
   223
and vCard parsers. For instance:
williamr@2
   224
williamr@2
   225
- InternalizeL() and ExternalizeL() functions, for writing and reading 
williamr@2
   226
data from a stream or file.
williamr@2
   227
williamr@2
   228
- adding/retrieving properties and sub-entities to/from an existing entity. 
williamr@2
   229
williamr@2
   230
- encoding and character set conversion capabilities.
williamr@2
   231
williamr@2
   232
Although this is not an abstract class, in practice you would create and use 
williamr@2
   233
objects of a derived class instead (CParserVCal or CParserVCard), as these 
williamr@2
   234
provide additional functionality needed for parsing vCalendars and vCards.
williamr@2
   235
williamr@2
   236
Note: a flag used in the class constructor indicates whether the entity needs 
williamr@2
   237
a version property. The version property will be inserted at the start of 
williamr@2
   238
the array of properties for the entity, and specifies the version of the vCard/vCalendar 
williamr@2
   239
specification used by the data of this particular vCard/vCalendar. The versions 
williamr@2
   240
that are currently supported are vCard v2.1 and vCalendar v1.0.
williamr@2
   241
williamr@2
   242
A typical vCard looks like this:
williamr@2
   243
williamr@2
   244
BEGIN VCARD
williamr@2
   245
williamr@2
   246
VERSION 2.1 ...
williamr@2
   247
williamr@2
   248
END VCARD
williamr@2
   249
williamr@2
   250
Note: if you are sequentially creating and destroying multiple 
williamr@2
   251
parsers, a major performance improvement may be achieved 
williamr@2
   252
by using thread local storage to store an instance of CVersitUnicodeUtils 
williamr@2
   253
which persists and can be used by all of the parsers.
williamr@2
   254
williamr@2
   255
See CVersitTlsData for more details. 
williamr@2
   256
@publishedAll
williamr@2
   257
@released
williamr@2
   258
*/
williamr@2
   259
	{
williamr@2
   260
	friend class CParserProperty;
williamr@2
   261
public:
williamr@2
   262
	IMPORT_C CVersitParser(TUint aFlags);
williamr@2
   263
	IMPORT_C void ConstructL();
williamr@2
   264
	IMPORT_C ~CVersitParser();
williamr@2
   265
	IMPORT_C void								InternalizeL(RFile& aInputFile,TInt& aBytesThroughFile);
williamr@2
   266
	IMPORT_C virtual void						InternalizeL(RReadStream& aStream);
williamr@2
   267
	IMPORT_C virtual void						InternalizeL(HBufC* aEntityName,CLineReader* aLineReader);
williamr@2
   268
	IMPORT_C void								ExternalizeL(RFile& aOutputFile);
williamr@2
   269
	IMPORT_C virtual void						ExternalizeL(RWriteStream& aStream);
williamr@2
   270
	IMPORT_C void								AddEntityL(CVersitParser* aEntity);
williamr@2
   271
	IMPORT_C void								AddPropertyL(CParserProperty* aProperty,TBool aInternalizing=EFalse);
williamr@2
   272
	IMPORT_C CArrayPtr<CVersitParser>*			EntityL(const TDesC& aEntityName,TBool aTakeOwnership=ETrue);
williamr@2
   273
	IMPORT_C CArrayPtr<CVersitParser>*			ArrayOfEntities(TBool aTakeOwnership=ETrue);
williamr@2
   274
	IMPORT_C CArrayPtr<CParserProperty>*		PropertyL(const TDesC8& aPropertyName,const TUid& aPropertyUid,TBool aTakeOwnership=ETrue) const;
williamr@2
   275
	IMPORT_C CArrayPtr<CParserProperty>*		ArrayOfProperties(TBool aTakeOwnership=ETrue);
williamr@2
   276
	IMPORT_C virtual void						ConvertAllPropertyDateTimesToMachineLocalL(const TTimeIntervalSeconds& aIncrement,const CVersitDaylight* aDaylight);
williamr@2
   277
	IMPORT_C void								AdjustAllPropertyDateTimesToMachineLocalL();
williamr@2
   278
	IMPORT_C static TBool						IsValidParameterValue(TInt& aPos,const TDesC& aParamValue);
williamr@2
   279
	IMPORT_C void								SetEntityNameL(const TDesC& aEntityName);
williamr@2
   280
	IMPORT_C TPtrC								EntityName() const;
williamr@2
   281
	IMPORT_C static TBool						IsValidLabel(const TDesC& aLabel, TInt& aPos);
williamr@2
   282
	IMPORT_C static TInt						Val(const TDesC& aString, TInt& aNumber);
williamr@2
   283
	IMPORT_C void								SetCharacterConverter(Versit::TEncodingAndCharset& encodingAndCharset);
williamr@2
   284
williamr@2
   285
	//
williamr@2
   286
	// Set/Get the default settings for the [en|de]coding process
williamr@2
   287
	//
williamr@2
   288
	IMPORT_C Versit::TVersitEncoding			DefaultEncoding() const;
williamr@2
   289
	IMPORT_C void								SetDefaultEncoding(const Versit::TVersitEncoding aEncoding);
williamr@2
   290
	IMPORT_C Versit::TVersitCharSet				DefaultCharSet() const;
williamr@2
   291
	IMPORT_C TUint								DefaultCharSetId() const;
williamr@2
   292
	IMPORT_C void								SetDefaultCharSet(const Versit::TVersitCharSet aCharSet);
williamr@2
   293
	IMPORT_C void								SetDefaultCharSetId(TUint aCharSetId);
williamr@2
   294
	IMPORT_C void								SetAutoDetect(TBool aOn,const CArrayFix<CCnvCharacterSetConverter::SCharacterSet>* aAutoDetectCharSets=NULL);
williamr@2
   295
williamr@2
   296
	//
williamr@2
   297
	// Set/Get Observers and PlugIn's
williamr@2
   298
	//
williamr@2
   299
	inline void									SetObserver(MVersitObserver* aObserver);
williamr@2
   300
	inline MVersitObserver*						Observer();
williamr@2
   301
	inline void									SetPlugIn(MVersitPlugIn* aPlugIn);
williamr@2
   302
	inline MVersitPlugIn*						PlugIn();
williamr@2
   303
williamr@2
   304
public:
williamr@2
   305
williamr@2
   306
	IMPORT_C TInt LoadBinaryValuesFromFilesL();
williamr@2
   307
	IMPORT_C TInt LoadBinaryValuesFromFilesL(RFs& aFileSession);
williamr@2
   308
	IMPORT_C TInt SaveBinaryValuesToFilesL(TInt aSizeThreshold,const TDesC& aPath);
williamr@2
   309
	IMPORT_C TInt SaveBinaryValuesToFilesL(TInt aSizeThreshold,const TDesC& aPath,RFs& aFileSession);
williamr@2
   310
public:
williamr@2
   311
	/** White space character codes: used while analysing the syntax of the received 
williamr@2
   312
	data and while externalising data. 
williamr@2
   313
	@publishedAll
williamr@2
   314
	@released 
williamr@2
   315
	*/
williamr@2
   316
	enum TCharCodes
williamr@2
   317
		{
williamr@2
   318
		/** ' ' */
williamr@2
   319
		ESpace				= ' ',
williamr@2
   320
		/** 9 */
williamr@2
   321
		EHTab				= 9,
williamr@2
   322
		/** 10 */
williamr@2
   323
		ELineFeed			= 10,
williamr@2
   324
		/** 13 */
williamr@4
   325
		ECarriageReturn		= 13,
williamr@4
   326
		/** ':' */
williamr@4
   327
		EColon				=':'
williamr@2
   328
		};
williamr@2
   329
	/** Flags that can be specified on construction. 
williamr@2
   330
	@publishedAll
williamr@2
   331
	@released 
williamr@2
   332
	*/
williamr@2
   333
	enum TVersitParserFlags
williamr@2
   334
		{
williamr@2
   335
		/** This entity does not need a version property. */
williamr@2
   336
		ENoVersionProperty	= 0,
williamr@2
   337
		/** This entity should have a version property. */
williamr@2
   338
		ESupportsVersion	= 0x01,
williamr@2
   339
		//Gaps since other flags have been used in past
williamr@2
   340
		EImportSyncML		= 0x1000,	//Importing from a SyncML server
williamr@2
   341
		/** Indicates whether the parser should use auto-detection of character sets when 
williamr@2
   342
		one has not been explicitly specified. */
williamr@2
   343
		EUseAutoDetection	= 0x4000,
williamr@2
   344
		//versit Internal use only
williamr@2
   345
		/** The current property has specified a character set. */
williamr@2
   346
		ECharSetIdentified	= 0x8000,
williamr@2
   347
		/** If the charset is not explicitly specified, the default charset will be used instead of US-ASCII as required
williamr@2
   348
		by the Versit specification . */
williamr@2
   349
		EUseDefaultCharSetForAllProperties = 0x2000		
williamr@2
   350
		};
williamr@2
   351
williamr@2
   352
	//
williamr@2
   353
	// Unicode support conversion functions
williamr@2
   354
	//
williamr@2
   355
	IMPORT_C static TInt						ConvertFromUnicodeToISOL(TDes8& aIso, const TDesC16& aUnicode, CCnvCharacterSetConverter* aConverter);
williamr@2
   356
	IMPORT_C TVersitDateTime*					DecodeDateTimeL(TDes& aToken) const;
williamr@2
   357
williamr@2
   358
protected:
williamr@2
   359
	IMPORT_C TInt								ConvertToUnicodeFromISOL(TDes16& aUnicode, const TDesC8& aIso, TUint aCharacterSet);
williamr@2
   360
williamr@2
   361
	//
williamr@2
   362
	// Parsing high level functions
williamr@2
   363
	//
williamr@2
   364
	IMPORT_C void								ParsePropertiesL();
williamr@2
   365
	IMPORT_C void								ParseBeginL();
williamr@2
   366
	IMPORT_C void								ParseEndL();
williamr@2
   367
	void										ParseEndL(HBufC16& aEntityName);
williamr@2
   368
	IMPORT_C TBool								ParseEntityL();
williamr@2
   369
	IMPORT_C virtual void						ParsePropertyL();
williamr@2
   370
	IMPORT_C CArrayPtr<CParserParam>*			ReadLineAndDecodeParamsLC(TInt& aValueStart,TInt& aNameLen);
williamr@2
   371
	IMPORT_C void								MakePropertyL(TPtr8& aPropName,TInt aValueStart);
williamr@2
   372
	IMPORT_C CArrayPtr<CParserParam>*			GetPropertyParamsLC(TPtr8 aParams);
williamr@2
   373
	IMPORT_C void								ParseParamL(CArrayPtr<CParserParam>* aArray,TPtr8 aParam);
williamr@2
   374
	IMPORT_C void								AnalysesEncodingCharset(CArrayPtr<CParserParam>* aArrayOfParams);
williamr@2
   375
	IMPORT_C void								ReadMultiLineValueL(TPtr8& aValue,TInt aValueStart,TBool aBinaryData);
williamr@2
   376
	inline TPtr8&								BufPtr();
williamr@2
   377
williamr@2
   378
	//
williamr@2
   379
	// Append standard versit tokens to streams
williamr@2
   380
	//
williamr@2
   381
	IMPORT_C void								AppendBeginL();
williamr@2
   382
	IMPORT_C void								AppendEndL();
williamr@2
   383
	void										AppendEntityNameL();
williamr@2
   384
	IMPORT_C void								DoAddPropertyL(CParserProperty* aProperty);
williamr@2
   385
williamr@2
   386
	//
williamr@2
   387
	// Dispatcher functions to create entities/properties based upon a Versit identifying Uid
williamr@2
   388
	//
williamr@2
   389
	IMPORT_C virtual CVersitParser*				MakeEntityL(TInt aEntityUid,HBufC* aEntityName);
williamr@2
   390
	CParserPropertyValueHBufC*					MakeDefaultPropertyValueL(HBufC16*& aValue);
williamr@2
   391
	IMPORT_C virtual CParserPropertyValue*		MakePropertyValueL(const TUid& aPropertyUid,HBufC16*& aValue);
williamr@2
   392
	IMPORT_C HBufC*								DecodePropertyValueL(const TDesC8& aValue);
williamr@2
   393
	IMPORT_C void								DecodePropertyValueL(const TDesC8& aValue,const TUid& aEncodingUid);
williamr@2
   394
	HBufC*										ConvertToUnicodeL(const TDesC8& aValue);
williamr@2
   395
	IMPORT_C CDesCArray*						MakePropertyValueCDesCArrayL(TPtr16 aStringValue);
williamr@2
   396
	IMPORT_C CArrayPtr<TVersitDateTime>*		MakePropertyValueMultiDateTimeL(TPtr16 aDateTimeGroup);
williamr@2
   397
	IMPORT_C CVersitDaylight*					MakePropertyValueDaylightL(TPtr16 aDaylightValue);
williamr@2
   398
	IMPORT_C TBool								FindFirstField(TPtr16& aField,TPtr16& aRemaining, TBool aTrimSpace=ETrue);
williamr@2
   399
	IMPORT_C void								FindRemainingField(TPtr16& aField,TPtr16& aRemaining);
williamr@2
   400
williamr@2
   401
	//
williamr@2
   402
	// Helper methods to decode versit dates, times, and time periods
williamr@2
   403
	//
williamr@2
   404
	IMPORT_C TTimeIntervalSeconds				DecodeTimeZoneL(const TDesC& aToken) const;
williamr@2
   405
	IMPORT_C TTime*								DecodeTimePeriodL(const TDesC& aToken) const;
williamr@2
   406
	IMPORT_C TInt								GetNumberL(const TDesC& aToken,TInt& aNumChars) const;
williamr@2
   407
williamr@2
   408
public:
williamr@2
   409
	IMPORT_C virtual TUid						RecognizeToken(const TDesC8& aToken) const;
williamr@2
   410
	IMPORT_C virtual TInt						RecognizeEntityName() const;
williamr@2
   411
	//
williamr@2
   412
	// Cleanup support methods
williamr@2
   413
	//
williamr@2
   414
	IMPORT_C static void						ResetAndDestroyArrayOfParams(TAny* aObject);
williamr@2
   415
	IMPORT_C static void						ResetAndDestroyArrayOfProperties(TAny* aObject);
williamr@2
   416
	IMPORT_C static void						ResetAndDestroyArrayOfEntities(TAny* aObject);
williamr@2
   417
	IMPORT_C static void						ResetAndDestroyArrayOfDateTimes(TAny* aObject);
williamr@2
   418
williamr@2
   419
	inline void									SetFlags(TUint aFlags);
williamr@2
   420
williamr@2
   421
	
williamr@2
   422
williamr@2
   423
protected:
williamr@2
   424
	//
williamr@2
   425
	// Enquiry functions
williamr@2
   426
	//
williamr@2
   427
	static TBool								IsPunctuationToken(TUint aChar);
williamr@2
   428
	inline TBool								SupportsVersion() const;
williamr@2
   429
	inline void									SetSupportsVersion();
williamr@2
   430
	inline void									ClearSupportsVersion();
williamr@2
   431
williamr@2
   432
	//
williamr@2
   433
	// Set the settings for the [en|de]coding of the current property
williamr@2
   434
	//
williamr@2
   435
	IMPORT_C void								RestoreLineCodingDetailsToDefault();
williamr@2
   436
	IMPORT_C void								SetLineEncoding(Versit::TVersitEncoding aLineEncoding);
williamr@2
   437
	IMPORT_C void								SetLineEncoding(TUint aVersitEncodingUid);
williamr@2
   438
	IMPORT_C void								SetLineCharacterSet(Versit::TVersitCharSet aLineCharSet);
williamr@2
   439
	IMPORT_C void								SetLineCharacterSetId(TUint aLineCharSetId);
williamr@2
   440
	IMPORT_C void								SetLineCoding(Versit::TVersitCharSet aLineCharSet, Versit::TVersitEncoding aLineEncoding);
williamr@2
   441
williamr@2
   442
	//
williamr@2
   443
	// Return the settings for the current property
williamr@2
   444
	//
williamr@2
   445
	IMPORT_C Versit::TVersitEncoding			LineEncoding() const;
williamr@2
   446
	IMPORT_C Versit::TVersitCharSet				LineCharSet() const;
williamr@2
   447
	IMPORT_C TUint								LineEncodingId() const;
williamr@2
   448
	IMPORT_C TUint								LineCharSetId() const;
williamr@2
   449
williamr@2
   450
	inline CVersitUnicodeUtils&					UnicodeUtils();
williamr@2
   451
williamr@2
   452
public:
williamr@2
   453
	//
williamr@2
   454
	// Static utility functions to aid with the Unicode conversion process
williamr@2
   455
	//
williamr@2
   456
	static TUint								MapVersitCharsetToCharConvCharset(Versit::TVersitCharSet aVersitSet);
williamr@2
   457
	static TUint								MapVersitEncodingToConArcUid(Versit::TVersitEncoding aVersitEncoding);
williamr@2
   458
williamr@2
   459
private:
williamr@2
   460
	void										SetLineCharsetDetailsToDefault();
williamr@2
   461
	void										SetLineEncodingDetailsToDefault();
williamr@2
   462
williamr@2
   463
private:	//To fix TimeZone SyncML bug
williamr@2
   464
	void										ConvertAllUTCDateTimesToMachineLocalL(const TTimeIntervalSeconds& aIncrement,const CVersitDaylight* aDaylight);
williamr@2
   465
	void										ConvertUTCDateTimeToMachineLocal(TVersitDateTime* aDateTime,const TTimeIntervalSeconds& aIncrement,const CVersitDaylight* aDaylight);
williamr@2
   466
	//void										AddTimeZonePropertyL();
williamr@2
   467
williamr@2
   468
protected:
williamr@2
   469
	struct TParserCodingDetails
williamr@2
   470
		{
williamr@2
   471
		Versit::TVersitEncoding		iEncoding;
williamr@2
   472
		TUint						iEncodingUid;
williamr@2
   473
		Versit::TVersitCharSet		iCharSet;
williamr@2
   474
		TUint						iCharSetUid;
williamr@2
   475
		};
williamr@2
   476
williamr@2
   477
protected:
williamr@2
   478
	// Default settings & internal flags
williamr@2
   479
	TInt							iFlags;
williamr@2
   480
	TParserCodingDetails			iDefaultCodingDetails;
williamr@2
   481
	TParserCodingDetails			iCurrentPropertyCodingDetails;
williamr@2
   482
	TBuf<KVersitMaxVersionLength>	iDefaultVersion;
williamr@2
   483
	const CArrayFix<CCnvCharacterSetConverter::SCharacterSet>* iAutoDetectCharSets;
williamr@2
   484
williamr@2
   485
	// Member data relating to the current item being parsed
williamr@2
   486
	HBufC*							iEntityName;
williamr@2
   487
	CArrayPtr<CVersitParser>*		iArrayOfEntities;
williamr@2
   488
	CArrayPtr<CParserProperty>*		iArrayOfProperties;
williamr@2
   489
	CParserProperty*				iCurrentProperty;
williamr@2
   490
	CLineReader*					iOwnedLineReader;
williamr@2
   491
	CLineReader*					iLineReader;
williamr@2
   492
	HBufC8*							iDecodedValue;
williamr@2
   493
	CBufSeg*						iLargeDataBuf;
williamr@2
   494
williamr@2
   495
	// In memory buffers
williamr@2
   496
	RWriteStream*					iWriteStream;
williamr@2
   497
williamr@2
   498
	// General utility class
williamr@2
   499
	CVersitTlsData*					iStaticUtils;
williamr@2
   500
williamr@2
   501
	// Plug-in classes
williamr@2
   502
	MVersitObserver*				iObserver;
williamr@2
   503
	MVersitPlugIn*					iPlugIn;
williamr@2
   504
williamr@2
   505
private:
williamr@2
   506
	void DoInternalizeL();
williamr@2
   507
	IMPORT_C virtual void Reserved1();
williamr@2
   508
	IMPORT_C virtual void Reserved2();
williamr@2
   509
private:
williamr@2
   510
	TInt iParseBegin;
williamr@2
   511
	TInt iReserved2;
williamr@2
   512
	};
williamr@4
   513
	
williamr@4
   514
#ifndef SYMBIAN_ENABLE_SPLIT_HEADERS
williamr@2
   515
NONSHARABLE_CLASS( CVersitTLSContainer ): public CBase	
williamr@2
   516
/**
williamr@2
   517
Wrapper class for static variables to be stored in TLS
williamr@2
   518
@internalComponent
williamr@2
   519
@released
williamr@2
   520
*/
williamr@2
   521
	{
williamr@2
   522
public:
williamr@2
   523
	static CVersitTLSContainer *NewLC(const TInt aSize);
williamr@2
   524
	~CVersitTLSContainer();
williamr@2
   525
public:
williamr@2
   526
	HBufC * iShiftJisEscape;//Store shift-jis escape charcter, as generated by relevant charconv plugin	
williamr@2
   527
	};
williamr@4
   528
#endif //SYMBIAN_ENABLE_SPLIT_HEADERS
williamr@2
   529
#include <versit.inl>
williamr@2
   530
williamr@2
   531
#endif