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