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