1.1 --- a/epoc32/include/vprop.h Tue Nov 24 13:55:44 2009 +0000
1.2 +++ b/epoc32/include/vprop.h Tue Mar 16 16:12:26 2010 +0000
1.3 @@ -1,1 +1,697 @@
1.4 -vprop.h
1.5 +// Copyright (c) 1997-2009 Nokia Corporation and/or its subsidiary(-ies).
1.6 +// All rights reserved.
1.7 +// This component and the accompanying materials are made available
1.8 +// 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
1.9 +// which accompanies this distribution, and is available
1.10 +// at the URL "http://www.symbianfoundation.org/legal/licencesv10.html".
1.11 +//
1.12 +// Initial Contributors:
1.13 +// Nokia Corporation - initial contribution.
1.14 +//
1.15 +// Contributors:
1.16 +//
1.17 +// Description:
1.18 +//
1.19 +
1.20 +#ifndef __VPROP_H__
1.21 +#define __VPROP_H__
1.22 +
1.23 +#ifndef __E32BASE_H__
1.24 +#include <e32base.h>
1.25 +#endif
1.26 +
1.27 +#ifndef __BADESCA_H__
1.28 +#include <badesca.h>
1.29 +#endif
1.30 +
1.31 +#ifndef __S32STRM_H__
1.32 +#include <s32strm.h>
1.33 +#endif
1.34 +
1.35 +#ifndef __E32MATH_H__
1.36 +#include <e32math.h>
1.37 +#endif
1.38 +
1.39 +
1.40 +#ifndef __VUID_H__
1.41 +#include <vuid.h>
1.42 +#endif
1.43 +
1.44 +#ifndef __VTOKEN_H__
1.45 +#include <vtoken.h>
1.46 +#endif
1.47 +
1.48 +#ifndef __VUTIL_H__
1.49 +#include <vutil.h>
1.50 +#endif
1.51 +
1.52 +#ifndef __S32FILE_H__
1.53 +#include <s32file.h>
1.54 +#endif
1.55 +//
1.56 +
1.57 +class CParserProperty;
1.58 +class CVersitParser;
1.59 +class MVersitPlugIn;
1.60 +class CParserPropertyValueCDesCArray;
1.61 +
1.62 +const TInt KRandomnumberlen = 5;
1.63 +const TInt KMaxGeneratedfilenamelen =16;
1.64 +//
1.65 +// CParserParam
1.66 +//
1.67 +
1.68 +class CParserParam : public CBase
1.69 +/** A Versit property parameter.
1.70 +
1.71 +A property parameter consists of a name and optionally a value, both in descriptor
1.72 +form. Parser properties (class CParserProperty) may own one or more property
1.73 +parameters.
1.74 +
1.75 +Note:
1.76 +
1.77 +The private parameter name and value members are stored as narrow (8-bit)
1.78 +rather than 16-bit Unicode descriptors.
1.79 +
1.80 +However, certain member functions take or return a Unicode value,
1.81 +for the purpose of backwards compatibility. In this case a simple conversion
1.82 +takes place: this ignores the top 8 bits (for Unicode -> Narrow) or adds zero
1.83 +for the top 8-bits (for Narrow->Unicode).
1.84 +@publishedAll
1.85 +@released
1.86 +*/
1.87 + {
1.88 +public:
1.89 + IMPORT_C static CParserParam* NewL(const TDesC8& aName, const TDesC8& aValue);
1.90 + IMPORT_C static CParserParam* NewL(const TDesC8& aName, const TDesC& aValue);
1.91 + IMPORT_C ~CParserParam();
1.92 + IMPORT_C void SetValueL(const TDesC8& aValue);
1.93 + IMPORT_C void SetValueL(HBufC8* aValue);
1.94 + IMPORT_C TInt ExternalizeL(RWriteStream& aStream) const;
1.95 + IMPORT_C TPtrC8 Name() const;
1.96 + IMPORT_C TPtrC8 Value() const;
1.97 + IMPORT_C HBufC* ValueL() const;
1.98 + IMPORT_C TInt ExternalizeL(RWriteStream& aStream, TInt& aLengthOutput, CVersitParser* aVersitParser) const;
1.99 +private:
1.100 + CParserParam(HBufC8* aName, HBufC8* aValue);
1.101 +private:
1.102 + HBufC8* iParamName;
1.103 + HBufC8* iValue;
1.104 + };
1.105 +
1.106 +//
1.107 +// TVersitDateTime
1.108 +//
1.109 +
1.110 +class TVersitDateTime
1.111 +/** Defines a Versit date and time.
1.112 +
1.113 +This class is used throughout Versit to represent the date and time. It uses
1.114 +a TDateTime object to store the date/time value and records whether this value
1.115 +is local to the machine which originated the vCard, local to the machine on
1.116 +which the code is running, or universal time (UTC).
1.117 +
1.118 +The Year(), Month() and Day() member functions of class TDateTime may be used
1.119 +to extract the date and time components from the TVersitDateTime::iDateTime.
1.120 +@publishedAll
1.121 +@released */
1.122 + {
1.123 +public:
1.124 + /** Relative time flags. */
1.125 + enum TRelativeTime
1.126 + {
1.127 + /** Time is stored in UTC. */
1.128 + EIsUTC,
1.129 + /** Time is local to the machine which originated the vCard. */
1.130 + EIsVCardLocal,
1.131 + /** Time is local to the machine on which the code is running. */
1.132 + EIsMachineLocal,
1.133 + /** Unused. */
1.134 + EIsCorrect
1.135 + };
1.136 + IMPORT_C TVersitDateTime(const TDateTime& aDateTime,TRelativeTime aRelativeTime);
1.137 +
1.138 + /** Date/time flags.
1.139 + @publishedAll
1.140 + @deprecated since 9.1*/
1.141 + enum TVersitDateTimeFlags
1.142 + {
1.143 + EExportNullFlag=0,
1.144 + /** Indicates whether the relative time is to be externalized along with the date/time
1.145 + value.
1.146 +
1.147 + The flag is set to 'EExportNullFlag' by default.
1.148 +
1.149 + This is only implemented (by CParserTimePropertyValue::EncodeVersitDateTimeL())
1.150 + if the date/time is universal. When the flag is set, the externalised value
1.151 + is followed by the token, KVersitTokenUniversalTime. */
1.152 + EExportTimeZoneDesignator=0x01,
1.153 + EExportLeaveAsLocalTime=0x02
1.154 + };
1.155 + /**
1.156 + @deprecated since 9.1
1.157 + */
1.158 + inline void SetFlag(TVersitDateTimeFlags aFlag) { iFlags |= aFlag; }
1.159 + /**
1.160 + @deprecated since 9.1
1.161 + */
1.162 + inline TBool IsFlagSet(TVersitDateTimeFlags aFlag) const { return iFlags & aFlag; }
1.163 + /**
1.164 + @deprecated since 9.1
1.165 + */
1.166 + inline void ClearFlag(TVersitDateTimeFlags aFlag) { iFlags &= ~aFlag; }
1.167 +public:
1.168 + /** The date/time value. */
1.169 + TDateTime iDateTime;
1.170 + /** Specifies whether the time value is local to the machine which originated the
1.171 + vCard, local to the machine on which the code is running, or universal. */
1.172 + TRelativeTime iRelativeTime;
1.173 +private:
1.174 + TInt iFlags;
1.175 + };
1.176 +
1.177 +//
1.178 +// CParserPropertyValue
1.179 +//
1.180 +class CParserPropertyValue : public CBase
1.181 +/** Abstract base class for all property values.
1.182 +
1.183 +Defines a pure virtual ExternalizeL() function which should write out the
1.184 +property value to a stream.
1.185 +
1.186 +The type of derived class is returned by the Uid() function; the UID value is
1.187 +specified on construction.
1.188 +
1.189 +The other functions relate to the character set, encoding format and plug-in
1.190 +used during externalising.
1.191 +@publishedAll
1.192 +@released
1.193 +*/
1.194 + {
1.195 +public:
1.196 + /** Externalises the property value to a write stream.
1.197 +
1.198 + Implementations of this function are invoked by the parser's ExternalizeL()
1.199 + function.
1.200 +
1.201 + @param aStream Stream to which the property value is externalised.
1.202 + @param aEncodingCharset The character set and encoding information.
1.203 + @param aLengthOutput The amount of text that has been outputted so far on the
1.204 + line (for the property name), which may need to be taken into account when
1.205 + calculating if and where any line break should occur. */
1.206 + virtual void ExternalizeL(RWriteStream& aStream,const Versit::TEncodingAndCharset& aEncodingCharset,TInt aLengthOutput)=0;
1.207 + IMPORT_C virtual TBool IsAsciiCharacterSetSufficient();
1.208 + IMPORT_C virtual void EncodeL(CBufBase* aTarget,const TDesC8& aSource,const TUid& aEncoding) const;
1.209 + IMPORT_C virtual TBool SupportsInterface(const TUid& /*aInterfaceUid*/) const;
1.210 + inline TUid Uid() const;
1.211 + inline void SetPlugIn(MVersitPlugIn* aPlugIn);
1.212 +protected:
1.213 + IMPORT_C CParserPropertyValue(const TUid& aPropertyValueUid);
1.214 + IMPORT_C void FoldEncodeAndWriteValueToStreamL(RWriteStream& aStream, const TDesC& aValue
1.215 + ,const Versit::TEncodingAndCharset& aEncodingCharset,TInt& aLengthOutput) const;
1.216 + IMPORT_C void FoldEncodeAndWriteValueToStreamL(RWriteStream& aStream, const CDesCArray* aValueArray
1.217 + ,const Versit::TEncodingAndCharset& aEncodingCharset,TInt& aLengthOutput) const;
1.218 + IMPORT_C void FoldAndWriteValueToStreamL(RWriteStream& aStream, const TDesC& aValue
1.219 + ,const Versit::TEncodingAndCharset& aEncodingCharset,TInt& aLengthOutput) const;
1.220 + IMPORT_C static void Append(TDes16& aTarget,TDesC8& aSource);
1.221 +protected:
1.222 + inline MVersitPlugIn* PlugIn();
1.223 +
1.224 +private:
1.225 + TUid iPropertyValueTypeUid;
1.226 + MVersitPlugIn* iPlugIn;
1.227 + };
1.228 +
1.229 +//
1.230 +// CParserTimePropertyValue
1.231 +//
1.232 +
1.233 +class CVersitDaylight;
1.234 +
1.235 +class CParserTimePropertyValue : public CParserPropertyValue
1.236 +/** Abstract base class for all of the date/time property value classes.
1.237 +
1.238 +Provides date/time conversion functions between machine-local and universal
1.239 +time.
1.240 +
1.241 +The date/time property value classes are CParserPropertyValueAlarm,
1.242 +CParserPropertyValueDate, CParserPropertyValueDateTime,
1.243 +CParserPropertyValueMultiDateTime, CParserPropertyValueDaylight and
1.244 +CParserPropertyValueRecurrence.
1.245 +@publishedAll
1.246 +@released
1.247 +*/
1.248 + {
1.249 +public:
1.250 + /** This is implemented, where applicable, to convert date/time
1.251 + values into universal time.
1.252 +
1.253 + The date/time is checked against the daylight saving information provided
1.254 + in aDaylight. If it falls inside the daylight saving period then the daylight
1.255 + saving offset is subtracted from the time to convert it to universal time.
1.256 + Otherwise aIncrement is added to the date/time of the alarm to convert it
1.257 + to universal time.
1.258 +
1.259 + Note that the daylight savings offset will adjust the time both for the daylight
1.260 + saving and for the time zone.
1.261 +
1.262 + The function has no effect if it date/times are already stored in universal
1.263 + time.
1.264 +
1.265 + If aDaylight is a NULL pointer then aIncrement is used.
1.266 +
1.267 + @param aIncrement A time interval in seconds which represents the time zone's
1.268 + offset from universal time.
1.269 + @param aDaylight Pointer to the specification for daylight saving. If the alarm's
1.270 + time value is within the period for daylight saving, the value is modified
1.271 + by the daylight saving offset (which accounts for both the time zone and daylight
1.272 + saving rule).
1.273 + @deprecated since 9.1
1.274 + */
1.275 + IMPORT_C virtual void ConvertAllDateTimesToUTCL(const TTimeIntervalSeconds& aIncrement,const CVersitDaylight* aDaylight)=0;
1.276 + /** Pure virtual function which is implemented, where applicable, to convert the
1.277 + date/time property value into machine-local time.
1.278 +
1.279 + This process involves adjusting the date/time value by the offset in aIncrement.
1.280 +
1.281 + The function has no effect if the value is already stored as machine-local
1.282 + time.
1.283 +
1.284 + The universal date/times are assumed to have been corrected for any daylight saving
1.285 + rule in effect.
1.286 +
1.287 + @param aIncrement A time interval which represents the number of seconds which
1.288 + is to be added to the date/time value. This should normally be the universal
1.289 + time offset for the machine's locale.
1.290 + @deprecated since 9.1 */
1.291 + IMPORT_C virtual void ConvertAllUTCDateTimesToMachineLocalL(const TTimeIntervalSeconds& aIncrement)=0;
1.292 + static void ConvertDateTime(TDateTime& aDateTime,const TTimeIntervalSeconds& aIncrement,const CVersitDaylight* aDaylight,TBool aTo);
1.293 +public: //from CParserPropertyValue
1.294 + IMPORT_C virtual TBool SupportsInterface(const TUid& aInterfaceUid) const;
1.295 +protected:
1.296 + IMPORT_C CParserTimePropertyValue(const TUid& aPropertyValueUid);
1.297 + IMPORT_C void ConvertDateTime(TDateTime* aDateTime,const TTimeIntervalSeconds& aIncrement,const CVersitDaylight* aDaylight);
1.298 + IMPORT_C void EncodeVersitDateTimeL(TDes8& aBuf,const TVersitDateTime& aDateTime,TBool aEncodeTime=ETrue) const;
1.299 + IMPORT_C void EncodeTimePeriodL(TDes8& aBuf,const TTime& aTimePeriod) const;
1.300 + };
1.301 +
1.302 +//
1.303 +// CParserPropertyValueHBufC
1.304 +//
1.305 +class CParserPropertyValueHBufC : public CParserPropertyValue
1.306 +/** A heap descriptor property value parser.
1.307 +
1.308 +Many properties are stored using this class. Examples are vCard e-mails and
1.309 +vCalendar locations.
1.310 +
1.311 +The UID for a heap descriptor property value is KVersitPropertyHBufCUid.
1.312 +@publishedAll
1.313 +@released
1.314 +*/
1.315 + {
1.316 +public:
1.317 + IMPORT_C static CParserPropertyValueHBufC* NewL(const TDesC& aValue);
1.318 + IMPORT_C CParserPropertyValueHBufC(HBufC16* aValue);
1.319 + IMPORT_C ~CParserPropertyValueHBufC();
1.320 + IMPORT_C TPtrC Value() const;
1.321 + IMPORT_C HBufC* TakeValueOwnership();
1.322 + IMPORT_C CParserPropertyValueCDesCArray* TreatAsArrayPropertyLC(const CParserProperty& aOwningProperty) const;
1.323 +public: // from CParserPropertyValue
1.324 + IMPORT_C TBool IsAsciiCharacterSetSufficient();
1.325 + IMPORT_C void ExternalizeL(RWriteStream& aStream,const Versit::TEncodingAndCharset& aEncodingCharset,TInt aLengthOutput);
1.326 +private:
1.327 + CParserPropertyValueHBufC();
1.328 + void ConstructL(const TDesC& aValue);
1.329 +protected:
1.330 + HBufC* iValue;
1.331 + };
1.332 +
1.333 +//
1.334 +// CParserPropertyValueBinary
1.335 +//
1.336 +
1.337 +class CParserPropertyValueBinary : public CParserPropertyValue
1.338 +/** A binary property value parser.
1.339 +
1.340 +It is used to store logos, photos, alarm content and binary attachment as binary values.
1.341 +
1.342 +The UID for a binary property value is KVersitPropertyBinaryUid.
1.343 +@publishedAll
1.344 +@released
1.345 +*/
1.346 + {
1.347 +public:
1.348 + IMPORT_C static CParserPropertyValueBinary* NewL(const TDesC8& aValue);
1.349 + IMPORT_C static CParserPropertyValueBinary* NewLC(const TDesC8& aValue);
1.350 +
1.351 + inline CParserPropertyValueBinary(CBufSeg& aValue);
1.352 + IMPORT_C ~CParserPropertyValueBinary();
1.353 + IMPORT_C const CBufSeg* Value() const;
1.354 +public: // from CParserPropertyValue
1.355 + IMPORT_C void ExternalizeL(RWriteStream& aStream,const Versit::TEncodingAndCharset& aEncodingCharset,TInt /*aLengthOutput*/);
1.356 +protected:
1.357 + inline CParserPropertyValueBinary();
1.358 + void ConstructL(const TDesC8& aValue);
1.359 + void ExternalizeL(RWriteStream& aStream, const Versit::TEncodingAndCharset& aEncodingCharset, TInt aLengthOutput, RReadStream& aReadStream);
1.360 +
1.361 +protected:
1.362 + CBufSeg* iValue;
1.363 + };//
1.364 +
1.365 +NONSHARABLE_CLASS(CParserPropertyValueBinaryFile) : public CParserPropertyValueBinary
1.366 +/** A file property value parser.
1.367 +
1.368 +It is used to store a file handle so that the binary data can be read through the handle when exporting.
1.369 +It is not used when importing.
1.370 +The UID for a binary property value is KVersitPropertyBinaryUid.
1.371 +@publishedPartner
1.372 +@prototype
1.373 +*/
1.374 + {
1.375 +public:
1.376 + IMPORT_C static CParserPropertyValueBinaryFile* NewL(const RFile& aFileHandle);
1.377 + IMPORT_C ~CParserPropertyValueBinaryFile();
1.378 +public: // from CParserPropertyValue
1.379 + void ExternalizeL(RWriteStream& aStream,const Versit::TEncodingAndCharset& aEncodingCharset,TInt aLengthOutput);
1.380 +
1.381 +private:
1.382 + void ConstructL(const RFile& aFileHandle);
1.383 +private:
1.384 + RFileReadStream iFileStream;
1.385 + };
1.386 +
1.387 +// CParserPropertyValueCDesCArray
1.388 +//
1.389 +class CParserPropertyValueCDesCArray : public CParserPropertyValue
1.390 +/** A property value parser which stores an array of descriptors.
1.391 +
1.392 +Can be used by both vCards and vCalendars, for example to store a postal address
1.393 +or information about an organisation.
1.394 +
1.395 +The UID for a descriptor array property value is KVersitPropertyCDesCArrayUid.
1.396 +@publishedAll
1.397 +@released
1.398 +*/
1.399 + {
1.400 +public:
1.401 + IMPORT_C CParserPropertyValueCDesCArray(CDesCArray* aValue);
1.402 + IMPORT_C ~CParserPropertyValueCDesCArray();
1.403 + inline CDesCArray* Value() const;
1.404 + IMPORT_C TBool IsPresent(const TDesC& aValue) const;
1.405 +public: // from CParserPropertyValue
1.406 + IMPORT_C TBool IsAsciiCharacterSetSufficient();
1.407 + IMPORT_C void ExternalizeL(RWriteStream& aStream,const Versit::TEncodingAndCharset& aEncodingCharset,TInt aLengthOutput);
1.408 +protected:
1.409 + CDesCArray* iValue;
1.410 + };
1.411 +
1.412 +//
1.413 +// CParserPropertyValueTimeZone
1.414 +//
1.415 +
1.416 +class CParserPropertyValueTimeZone: public CParserPropertyValue
1.417 +/** A time zone property value parser.
1.418 +
1.419 +Stores and externalises a property value which represents the time zone information
1.420 +for a vCard or vCalendar.
1.421 +
1.422 +The time zone is specified as the universal time offset. This is a time interval
1.423 +which is a positive or negative number of seconds from universal time. Time
1.424 +zones east of universal time have positive numbers. Time zones west of universal
1.425 +time have negative numbers.
1.426 +
1.427 +The UID for a time zone property value is KVersitPropertyTimeZoneUid.
1.428 +@publishedAll
1.429 +@released
1.430 +*/
1.431 + {
1.432 +public:
1.433 + static void EncodeTimeZone(TDes8& aBuf,TTimeIntervalSeconds iValue);
1.434 + IMPORT_C CParserPropertyValueTimeZone(TTimeIntervalSeconds aValue);
1.435 + inline TTimeIntervalSeconds Value() const;
1.436 +public: // from CParserPropertyValue
1.437 + IMPORT_C void ExternalizeL(RWriteStream& aStream,const Versit::TEncodingAndCharset& aEncodingCharset,TInt /*aLengthOutput*/);
1.438 +protected:
1.439 + TTimeIntervalSeconds iValue;
1.440 + };
1.441 +
1.442 +//
1.443 +// CVersitDaylight
1.444 +//
1.445 +class CVersitDaylight : public CBase
1.446 +/** Universal time offset information, including the daylight savings offset.
1.447 +
1.448 +This class deals with the daylight saving offset: a one hour offset that occurs
1.449 +in many countries during part of the year. This offset needs to be taken into
1.450 +account when converting Versit times (TVersitDateTimes) between universal
1.451 +and machine-local times.
1.452 +
1.453 +This class stores information about the offset, including its length in seconds,
1.454 +when it takes effect and the standard time designations.
1.455 +
1.456 +Note that the universal offset (iOffset) is the sum of the daylight saving
1.457 +offset and any time zone offset, as it is the absolute offset from GMT.
1.458 +
1.459 +An instance of this class is owned by the CParserPropertyValueDaylight class.
1.460 +@publishedAll
1.461 +@released
1.462 +*/
1.463 + {
1.464 +public:
1.465 + IMPORT_C static CVersitDaylight* NewL(TBool aSavings, TTimeIntervalSeconds aOffset, TVersitDateTime* aStartTime, TVersitDateTime* aEndTime, const TDesC& aStandardDesignation, const TDesC& aDaylightDesignation);
1.466 + IMPORT_C ~CVersitDaylight();
1.467 +private:
1.468 + CVersitDaylight(TBool aSavings, TTimeIntervalSeconds aOffset, TVersitDateTime* aStartTime, TVersitDateTime* aEndTime);
1.469 + void ConstructL(const TDesC& aStandardDesignation, const TDesC& aDaylightDesignation);
1.470 +public:
1.471 + /** A sort key than can be used when sorting an array of properties by start date/time. */
1.472 + TInt64 iStartTimeSortKey;
1.473 + /** The daylight savings flag: this is ETrue if daylight saving is in effect
1.474 + in the locale and EFalse if not. */
1.475 + TBool iSavings;
1.476 + /** The absolute offset from GMT, which is the sum of the time zone and daylight
1.477 + saving offsets (in seconds). */
1.478 + TTimeIntervalSeconds iOffset;
1.479 + /** The date/time at which the period for daylight saving begins. */
1.480 + TVersitDateTime* iStartTime;
1.481 + /** The date/time at which the period for daylight saving ends. */
1.482 + TVersitDateTime* iEndTime;
1.483 + /** The standard time designation, e.g. GMT, EST. */
1.484 + HBufC* iStandardDesignation;
1.485 + /** The daylight saving time designation, e.g. BST, EDT. */
1.486 + HBufC* iDaylightDesignation;
1.487 + };
1.488 +
1.489 +//
1.490 +// CParserPropertyValueDaylight
1.491 +//
1.492 +class CParserPropertyValueDaylight : public CParserTimePropertyValue
1.493 +/** A property value parser which contains the daylight savings rule for a vCalendar.
1.494 +
1.495 +The property value is stored using an instance of the CVersitDaylight class.
1.496 +
1.497 +The UID for a daylight savings rule property value is KVersitPropertyDaylightUid.
1.498 +@publishedAll
1.499 +@released
1.500 +*/
1.501 + {
1.502 +public:
1.503 + IMPORT_C CParserPropertyValueDaylight(CVersitDaylight* aValue);
1.504 + IMPORT_C ~CParserPropertyValueDaylight();
1.505 + inline CVersitDaylight* Value() const;
1.506 +public: // from CParserTimePropertyValue
1.507 + IMPORT_C void ConvertAllDateTimesToUTCL(const TTimeIntervalSeconds& aIncrement,const CVersitDaylight* aDaylight);
1.508 + IMPORT_C void ConvertAllUTCDateTimesToMachineLocalL(const TTimeIntervalSeconds& aIncrement);
1.509 +public: // from CParserPropertyValue
1.510 + IMPORT_C void ExternalizeL(RWriteStream& aStream,const Versit::TEncodingAndCharset& aEncodingCharset,TInt aLengthOutput);
1.511 +private:
1.512 + CVersitDaylight* iValue;
1.513 + };
1.514 +
1.515 +//
1.516 +// CParserPropertyValueDateTime
1.517 +//
1.518 +class CParserPropertyValueDateTime : public CParserTimePropertyValue
1.519 +/** A date/time property value parser.
1.520 +
1.521 +The date/time value is contained in a TVersitDateTime object.
1.522 +
1.523 +The UID for a date/time property value is KVersitPropertyDateTimeUid.
1.524 +@publishedAll
1.525 +@released
1.526 +*/
1.527 + {
1.528 +public:
1.529 + IMPORT_C CParserPropertyValueDateTime(TVersitDateTime* aValue);
1.530 + IMPORT_C ~CParserPropertyValueDateTime();
1.531 + inline TVersitDateTime* Value() const;
1.532 +public: // from CParserTimePropertyValue
1.533 + IMPORT_C void ConvertAllDateTimesToUTCL(const TTimeIntervalSeconds& aIncrement,const CVersitDaylight* aDaylight);
1.534 + IMPORT_C void ConvertAllUTCDateTimesToMachineLocalL(const TTimeIntervalSeconds& aIncrement);
1.535 +public: // from CParserPropertyValue
1.536 + IMPORT_C void ExternalizeL(RWriteStream& aStream,const Versit::TEncodingAndCharset& /*aEncodingCharset*/,TInt /*aLengthOutput*/);
1.537 +protected:
1.538 + TVersitDateTime* iValue;
1.539 + };
1.540 +
1.541 +//
1.542 +// CParserPropertyValueDate
1.543 +//
1.544 +class CParserPropertyValueDate : public CParserTimePropertyValue
1.545 +/** A date property value parser.
1.546 +
1.547 +The date value is contained in a TVersitDateTime object.
1.548 +
1.549 +The UID for a date property value is KVersitPropertyDateUid.
1.550 +@publishedAll
1.551 +@released
1.552 +*/
1.553 + {
1.554 +public:
1.555 + IMPORT_C CParserPropertyValueDate(TVersitDateTime* aValue);
1.556 + IMPORT_C ~CParserPropertyValueDate();
1.557 + inline TVersitDateTime* Value() const;
1.558 +public: // from CParserTimePropertyValue
1.559 + IMPORT_C void ConvertAllDateTimesToUTCL(const TTimeIntervalSeconds& /*aIncrement*/,const CVersitDaylight* /*aDaylight*/);
1.560 + IMPORT_C void ConvertAllUTCDateTimesToMachineLocalL(const TTimeIntervalSeconds& /*aIncrement*/);
1.561 +public: // from CParserPropertyValue
1.562 + IMPORT_C void ExternalizeL(RWriteStream& aStream,const Versit::TEncodingAndCharset& aEncodingCharset,TInt /*aLengthOutput*/);
1.563 +private:
1.564 + TVersitDateTime* iValue;
1.565 + };
1.566 +
1.567 +//
1.568 +// CParserPropertyValueMultiDateTime
1.569 +//
1.570 +class CParserPropertyValueMultiDateTime : public CParserTimePropertyValue
1.571 +/** A property value parser which stores a list of date/time values using an array
1.572 +of TVersitDateTime objects.
1.573 +
1.574 +The UID for a multiple date/time property value is KVersitPropertyMultiDateTimeUid.
1.575 +@publishedAll
1.576 +@released
1.577 +*/
1.578 + {
1.579 +public:
1.580 + IMPORT_C CParserPropertyValueMultiDateTime(CArrayPtr<TVersitDateTime>* aValue);
1.581 + IMPORT_C ~CParserPropertyValueMultiDateTime();
1.582 + inline CArrayPtr<TVersitDateTime>* Value() const;
1.583 +public: // from CParserTimePropertyValue
1.584 + IMPORT_C void ConvertAllDateTimesToUTCL(const TTimeIntervalSeconds& aIncrement,const CVersitDaylight* aDaylight);
1.585 + IMPORT_C void ConvertAllUTCDateTimesToMachineLocalL(const TTimeIntervalSeconds& aIncrement);
1.586 +public: // from CParserPropertyValue
1.587 + IMPORT_C void ExternalizeL(RWriteStream& aStream,const Versit::TEncodingAndCharset& /*aEncodingCharset*/,TInt aLengthOutput);
1.588 +protected:
1.589 + CArrayPtr<TVersitDateTime>* iValue;
1.590 + };
1.591 +
1.592 +//
1.593 +// CParserPropertyValueInt
1.594 +//
1.595 +class CParserPropertyValueInt : public CParserPropertyValue
1.596 +/** An integer property value parser.
1.597 +
1.598 +This stores a property value as a signed integer. For example, an employee
1.599 +ID number might be stored using this class.
1.600 +
1.601 +The UID for an integer property value is KVersitPropertyIntUid.
1.602 +@publishedAll
1.603 +@released
1.604 +*/
1.605 + {
1.606 +public:
1.607 + IMPORT_C CParserPropertyValueInt(TInt aValue);
1.608 + inline TInt Value() const;
1.609 +public: // from CParserPropertyValue
1.610 + IMPORT_C void ExternalizeL(RWriteStream& aStream,const Versit::TEncodingAndCharset& aEncodingCharset,TInt /*aLengthOutput*/);
1.611 +protected:
1.612 + TInt iValue;
1.613 + };
1.614 +
1.615 +//
1.616 +// CParserProperty
1.617 +//
1.618 +
1.619 +class CParserProperty : public CBase
1.620 +/** A vCard or vCalendar property.
1.621 +
1.622 +A property consists of a name, an optional value and one or more optional
1.623 +parameters.
1.624 +
1.625 +The name, value and parameters are initialised on construction.
1.626 +
1.627 +Versit properties have the general form:
1.628 +
1.629 +Property Name (; Property Parameter Name(=Property Parameter Value)* : Property
1.630 +Value)
1.631 +
1.632 +where items in brackets are optional and * indicates that the item may be
1.633 +repeated.
1.634 +
1.635 +For instance, TEL; HOME; ENCODING=QUOTED-PRINTABLE; CHARSET=US-ASCII : 01234 567890
1.636 +
1.637 +Here, TEL is the property name; HOME, ENCODING and CHARSET are property parameter
1.638 +names; QUOTED-PRINTABLE and US-ASCII are property parameter values. The component
1.639 +following the colon is the property value.
1.640 +
1.641 +Properties also have a name UID, which set during internalisation of a property
1.642 +and used only during internalisation. It is set by SetNameUid() and is used
1.643 +to allow number comparisons during internalisation. This provides a faster
1.644 +alternative to string comparisons when checking a property to see if it is
1.645 +a significant one (e.g. a begin or binary property). This is the only use
1.646 +of the name UID: it is not used during externalisation of a property.
1.647 +
1.648 +Note that grouped properties are supported by the derived class, CParserGroupedProperty.
1.649 +The vCalender parser does not have property groups, and so stores all properties
1.650 +using this base class, whereas the vCard parser stores all properties using
1.651 +CParserGroupedProperty.
1.652 +@publishedAll
1.653 +@released
1.654 +*/
1.655 + {
1.656 +public:
1.657 + IMPORT_C static CParserProperty* NewL(CParserPropertyValue& aPropertyValue, const TDesC8& aName, CArrayPtr<CParserParam>* aArrayOfParams);
1.658 + IMPORT_C CParserProperty(CArrayPtr<CParserParam>* aArrayOfParams);
1.659 + IMPORT_C ~CParserProperty();
1.660 + IMPORT_C virtual void ExternalizeL(RWriteStream& aStream, CVersitParser* aVersitParser = NULL);
1.661 + IMPORT_C CParserParam* Param(const TDesC8& aParamName) const; // note params can only appear once
1.662 + IMPORT_C void AddParamL(CParserParam* aParam);
1.663 + IMPORT_C void DeleteParam(TDesC8& aParamName);
1.664 + IMPORT_C void SetNameL(const TDesC8& aName);
1.665 + IMPORT_C virtual TBool SupportsInterface(const TUid& /*aInterfaceUid*/) const;
1.666 + IMPORT_C TPtrC8 Name() const;
1.667 + inline void SetValue(CParserPropertyValue* aPropertyValue);
1.668 + inline CParserPropertyValue* Value() const;
1.669 + inline TUid Uid() const;
1.670 + inline void SetNameUid(TUid aUid);
1.671 + inline TUid NameUid() const;
1.672 + inline void SetParamArray(CArrayPtr<CParserParam>* aArrayOfParams);
1.673 +
1.674 +
1.675 + IMPORT_C TBool LoadBinaryValuesFromFilesL(RFs& aFileSession);
1.676 + IMPORT_C TBool SaveBinaryValuesToFilesL(TInt aSizeThreshold,const TDesC& aPath,RFs& aFileSession);
1.677 +protected:
1.678 + IMPORT_C CParserProperty(CParserPropertyValue& aPropertyValue, CArrayPtr<CParserParam>* aArrayOfParams);
1.679 + IMPORT_C static void ConstructSelfL(CParserProperty& aSelf,const TDesC8& aName);
1.680 +
1.681 +public:
1.682 + IMPORT_C CArrayPtr<CParserParam>* ParamArray()const;
1.683 +
1.684 +protected:
1.685 + CParserPropertyValue* iPropertyValue;
1.686 + HBufC8* iPropertyName;
1.687 + TUid iPropertyNameUid;
1.688 + CArrayPtr<CParserParam>* iArrayOfParams;
1.689 +
1.690 +private:
1.691 + friend class CVersitParser;
1.692 + inline HBufC8*& NameBuf();
1.693 + IMPORT_C virtual void Reserved();
1.694 + void ReadBinaryDataL(const CBufSeg* aBufseg_ptr,HBufC8** aBuffer);
1.695 + void GenerateNameAndCreateFileL(RFs& aFileSession,TPtr8 aPropertyName,RFile& aFile,TDes& aFileName);
1.696 +
1.697 + };
1.698 +
1.699 +#include <vprop.inl>
1.700 +
1.701 +#endif