class CVersitParser : public CBase |
A generic Versit parser.
Provides generic functions which implement behaviour common to both vCalendar and vCard parsers. For instance:
InternalizeL() and ExternalizeL() functions, for writing and reading data from a stream or file.
adding/retrieving properties and sub-entities to/from an existing entity.
encoding and character set conversion capabilities.
Although this is not an abstract class, in practice you would create and use objects of a derived class instead (CParserVCal or CParserVCard), as these provide additional functionality needed for parsing vCalendars and vCards.
Note: a flag used in the class constructor indicates whether the entity needs a version property. The version property will be inserted at the start of the array of properties for the entity, and specifies the version of the vCard/vCalendar specification used by the data of this particular vCard/vCalendar. The versions that are currently supported are vCard v2.1 and vCalendar v1.0.
A typical vCard looks like this:
BEGIN VCARD
VERSION 2.1 ...
END VCARD
Note: if you are sequentially creating and destroying multiple parsers, a major performance improvement may be achieved by using thread local storage to store an instance of CVersitUnicodeUtils which persists and can be used by all of the parsers.
See CVersitTlsData for more details.
Private Member Functions | |
---|---|
void | ConvertAllUTCDateTimesToMachineLocalL(const TTimeIntervalSeconds &, const CVersitDaylight *) |
void | ConvertUTCDateTimeToMachineLocal(TVersitDateTime *, const TTimeIntervalSeconds &, const CVersitDaylight *) |
void | DoInternalizeL() |
IMPORT_C void | Reserved1() |
IMPORT_C void | Reserved2() |
void | SetLineCharsetDetailsToDefault() |
void | SetLineEncodingDetailsToDefault() |
Public Member Enumerations | |
---|---|
enum | TCharCodes { ESpace = ' ', EHTab = 9, ELineFeed = 10, ECarriageReturn = 13, EColon = ':' } |
enum | TVersitParserFlags { ENoVersionProperty = 0, ESupportsVersion = 0x01, EImportSyncML = 0x1000, EUseAutoDetection = 0x4000, ECharSetIdentified = 0x8000, EUseDefaultCharSetForAllProperties = 0x2000 } |
Protected Attributes | |
---|---|
CArrayPtr< CVersitParser > * | iArrayOfEntities |
CArrayPtr< CParserProperty > * | iArrayOfProperties |
const CArrayFix< CCnvCharacterSetConverter::SCharacterSet > * | iAutoDetectCharSets |
CParserProperty * | iCurrentProperty |
TParserCodingDetails | iCurrentPropertyCodingDetails |
HBufC8 * | iDecodedValue |
TParserCodingDetails | iDefaultCodingDetails |
TBuf< KVersitMaxVersionLength > | iDefaultVersion |
HBufC * | iEntityName |
TInt | iFlags |
CBufSeg * | iLargeDataBuf |
CLineReader * | iLineReader |
MVersitObserver * | iObserver |
CLineReader * | iOwnedLineReader |
MVersitPlugIn * | iPlugIn |
CVersitTlsData * | iStaticUtils |
RWriteStream * | iWriteStream |
Private Attributes | |
---|---|
TInt | iParseBegin |
TInt | iReserved2 |
IMPORT_C void | AddEntityL | ( | CVersitParser * | aEntity | ) |
CVersitParser * aEntity |
IMPORT_C void | AddPropertyL | ( | CParserProperty * | aProperty, |
TBool | aInternalizing = EFalse | |||
) |
CParserProperty * aProperty | |
TBool aInternalizing = EFalse |
IMPORT_C void | AdjustAllPropertyDateTimesToMachineLocalL | ( | ) |
IMPORT_C void | AnalysesEncodingCharset | ( | CArrayPtr< CParserParam > * | aArrayOfParams | ) | [protected] |
CArrayPtr< CParserParam > * aArrayOfParams |
IMPORT_C CArrayPtr< CVersitParser > * | ArrayOfEntities | ( | TBool | aTakeOwnership = ETrue | ) |
TBool aTakeOwnership = ETrue |
IMPORT_C CArrayPtr< CParserProperty > * | ArrayOfProperties | ( | TBool | aTakeOwnership = ETrue | ) |
TBool aTakeOwnership = ETrue |
IMPORT_C void | ConvertAllPropertyDateTimesToMachineLocalL | ( | const TTimeIntervalSeconds & | aIncrement, |
const CVersitDaylight * | aDaylight | |||
) | [virtual] |
const TTimeIntervalSeconds & aIncrement | |
const CVersitDaylight * aDaylight |
void | ConvertAllUTCDateTimesToMachineLocalL | ( | const TTimeIntervalSeconds & | aIncrement, |
const CVersitDaylight * | aDaylight | |||
) | [private] |
const TTimeIntervalSeconds & aIncrement | |
const CVersitDaylight * aDaylight |
IMPORT_C TInt | ConvertFromUnicodeToISOL | ( | TDes8 & | aIso, |
const TDesC16 & | aUnicode, | |||
CCnvCharacterSetConverter * | aConverter | |||
) | [static] |
TDes8 & aIso | |
const TDesC16 & aUnicode | |
CCnvCharacterSetConverter * aConverter |
IMPORT_C TInt | ConvertToUnicodeFromISOL | ( | TDes16 & | aUnicode, |
const TDesC8 & | aIso, | |||
TUint | aCharacterSet | |||
) | [protected] |
HBufC * | ConvertToUnicodeL | ( | const TDesC8 & | aValue | ) | [protected] |
const TDesC8 & aValue |
void | ConvertUTCDateTimeToMachineLocal | ( | TVersitDateTime * | aDateTime, |
const TTimeIntervalSeconds & | aIncrement, | |||
const CVersitDaylight * | aDaylight | |||
) | [private] |
TVersitDateTime * aDateTime | |
const TTimeIntervalSeconds & aIncrement | |
const CVersitDaylight * aDaylight |
IMPORT_C TVersitDateTime * | DecodeDateTimeL | ( | TDes & | aToken | ) | const |
TDes & aToken |
IMPORT_C HBufC * | DecodePropertyValueL | ( | const TDesC8 & | aValue | ) | [protected] |
const TDesC8 & aValue |
IMPORT_C void | DecodePropertyValueL | ( | const TDesC8 & | aValue, |
const TUid & | aEncodingUid | |||
) | [protected] |
IMPORT_C TTime * | DecodeTimePeriodL | ( | const TDesC & | aToken | ) | const [protected] |
const TDesC & aToken |
IMPORT_C TTimeIntervalSeconds | DecodeTimeZoneL | ( | const TDesC & | aToken | ) | const [protected] |
const TDesC & aToken |
IMPORT_C void | DoAddPropertyL | ( | CParserProperty * | aProperty | ) | [protected] |
CParserProperty * aProperty |
IMPORT_C CArrayPtr< CVersitParser > * | EntityL | ( | const TDesC & | aEntityName, |
TBool | aTakeOwnership = ETrue | |||
) |
IMPORT_C void | ExternalizeL | ( | RWriteStream & | aStream | ) | [virtual] |
RWriteStream & aStream |
IMPORT_C TBool | FindFirstField | ( | TPtr16 & | aField, |
TPtr16 & | aRemaining, | |||
TBool | aTrimSpace = ETrue | |||
) | [protected] |
IMPORT_C void | FindRemainingField | ( | TPtr16 & | aField, |
TPtr16 & | aRemaining | |||
) | [protected] |
IMPORT_C TInt | GetNumberL | ( | const TDesC & | aToken, |
TInt & | aNumChars | |||
) | const [protected] |
IMPORT_C CArrayPtr< CParserParam > * | GetPropertyParamsLC | ( | TPtr8 | aParams | ) | [protected] |
TPtr8 aParams |
IMPORT_C void | InternalizeL | ( | RFile & | aInputFile, |
TInt & | aBytesThroughFile | |||
) |
IMPORT_C void | InternalizeL | ( | RReadStream & | aStream | ) | [virtual] |
RReadStream & aStream |
IMPORT_C void | InternalizeL | ( | HBufC * | aEntityName, |
CLineReader * | aLineReader | |||
) | [virtual] |
HBufC * aEntityName | |
CLineReader * aLineReader |
TBool | IsPunctuationToken | ( | TUint | aChar | ) | [protected, static] |
TUint aChar |
IMPORT_C TBool | IsValidLabel | ( | const TDesC & | aLabel, |
TInt & | aPos | |||
) | [static] |
IMPORT_C TBool | IsValidParameterValue | ( | TInt & | aPos, |
const TDesC & | aParamValue | |||
) | [static] |
IMPORT_C TInt | LoadBinaryValuesFromFilesL | ( | RFs & | aFileSession | ) |
RFs & aFileSession |
CParserPropertyValueHBufC * | MakeDefaultPropertyValueL | ( | HBufC16 *& | aValue | ) | [protected] |
HBufC16 *& aValue |
IMPORT_C CVersitParser * | MakeEntityL | ( | TInt | aEntityUid, |
HBufC * | aEntityName | |||
) | [protected, virtual] |
IMPORT_C void | MakePropertyL | ( | TPtr8 & | aPropName, |
TInt | aValueStart | |||
) | [protected] |
IMPORT_C CDesCArray * | MakePropertyValueCDesCArrayL | ( | TPtr16 | aStringValue | ) | [protected] |
TPtr16 aStringValue |
IMPORT_C CVersitDaylight * | MakePropertyValueDaylightL | ( | TPtr16 | aDaylightValue | ) | [protected] |
TPtr16 aDaylightValue |
IMPORT_C CParserPropertyValue * | MakePropertyValueL | ( | const TUid & | aPropertyUid, |
HBufC16 *& | aValue | |||
) | [protected, virtual] |
IMPORT_C CArrayPtr< TVersitDateTime > * | MakePropertyValueMultiDateTimeL | ( | TPtr16 | aDateTimeGroup | ) | [protected] |
TPtr16 aDateTimeGroup |
TUint | MapVersitCharsetToCharConvCharset | ( | Versit::TVersitCharSet | aVersitSet | ) | [static] |
Versit::TVersitCharSet aVersitSet |
TUint | MapVersitEncodingToConArcUid | ( | Versit::TVersitEncoding | aVersitEncoding | ) | [static] |
Versit::TVersitEncoding aVersitEncoding |
MVersitObserver * | Observer | ( | ) | [inline] |
Gets a pointer to the Versit observer.
A pointer to the observer.
IMPORT_C void | ParseParamL | ( | CArrayPtr< CParserParam > * | aArray, |
TPtr8 | aParam | |||
) | [protected] |
CArrayPtr< CParserParam > * aArray | |
TPtr8 aParam |
MVersitPlugIn * | PlugIn | ( | ) | [inline] |
Gets a pointer to the Versit plug-in.
A pointer to the plug-in.
IMPORT_C CArrayPtr< CParserProperty > * | PropertyL | ( | const TDesC8 & | aPropertyName, |
const TUid & | aPropertyUid, | |||
TBool | aTakeOwnership = ETrue | |||
) | const |
IMPORT_C CArrayPtr< CParserParam > * | ReadLineAndDecodeParamsLC | ( | TInt & | aValueStart, |
TInt & | aNameLen | |||
) | [protected] |
IMPORT_C void | ReadMultiLineValueL | ( | TPtr8 & | aValue, |
TInt | aValueStart, | |||
TBool | aBinaryData | |||
) | [protected] |
IMPORT_C TUid | RecognizeToken | ( | const TDesC8 & | aToken | ) | const [virtual] |
const TDesC8 & aToken |
IMPORT_C void | ResetAndDestroyArrayOfDateTimes | ( | TAny * | aObject | ) | [static] |
TAny * aObject |
IMPORT_C void | ResetAndDestroyArrayOfEntities | ( | TAny * | aObject | ) | [static] |
TAny * aObject |
IMPORT_C void | ResetAndDestroyArrayOfParams | ( | TAny * | aObject | ) | [static] |
TAny * aObject |
IMPORT_C void | ResetAndDestroyArrayOfProperties | ( | TAny * | aObject | ) | [static] |
TAny * aObject |
IMPORT_C TInt | SaveBinaryValuesToFilesL | ( | TInt | aSizeThreshold, |
const TDesC & | aPath | |||
) |
IMPORT_C TInt | SaveBinaryValuesToFilesL | ( | TInt | aSizeThreshold, |
const TDesC & | aPath, | |||
RFs & | aFileSession | |||
) |
IMPORT_C void | SetAutoDetect | ( | TBool | aOn, |
const CArrayFix< CCnvCharacterSetConverter::SCharacterSet > * | aAutoDetectCharSets = NULL | |||
) |
TBool aOn | |
const CArrayFix< CCnvCharacterSetConverter::SCharacterSet > * aAutoDetectCharSets = NULL |
IMPORT_C void | SetCharacterConverter | ( | Versit::TEncodingAndCharset & | encodingAndCharset | ) |
Versit::TEncodingAndCharset & encodingAndCharset |
IMPORT_C void | SetDefaultCharSet | ( | const Versit::TVersitCharSet | aCharSet | ) |
const Versit::TVersitCharSet aCharSet |
IMPORT_C void | SetDefaultCharSetId | ( | TUint | aCharSetId | ) |
TUint aCharSetId |
IMPORT_C void | SetDefaultEncoding | ( | const Versit::TVersitEncoding | aEncoding | ) |
const Versit::TVersitEncoding aEncoding |
IMPORT_C void | SetEntityNameL | ( | const TDesC & | aEntityName | ) |
const TDesC & aEntityName |
IMPORT_C void | SetLineCharacterSet | ( | Versit::TVersitCharSet | aLineCharSet | ) | [protected] |
Versit::TVersitCharSet aLineCharSet |
IMPORT_C void | SetLineCharacterSetId | ( | TUint | aLineCharSetId | ) | [protected] |
TUint aLineCharSetId |
IMPORT_C void | SetLineCoding | ( | Versit::TVersitCharSet | aLineCharSet, |
Versit::TVersitEncoding | aLineEncoding | |||
) | [protected] |
Versit::TVersitCharSet aLineCharSet | |
Versit::TVersitEncoding aLineEncoding |
IMPORT_C void | SetLineEncoding | ( | Versit::TVersitEncoding | aLineEncoding | ) | [protected] |
Versit::TVersitEncoding aLineEncoding |
IMPORT_C void | SetLineEncoding | ( | TUint | aVersitEncodingUid | ) | [protected] |
TUint aVersitEncodingUid |
void | SetObserver | ( | MVersitObserver * | aObserver | ) | [inline] |
Sets the Versit observer.
MVersitObserver * aObserver | A pointer to the observer. |
void | SetPlugIn | ( | MVersitPlugIn * | aPlugIn | ) | [inline] |
Sets the Versit plug-in.
If there is one, the Versit plug-in needs to be set before any properties are added to the parser. This is done for you when internalising (using InternalizeL()) or adding properties (using AddPropertyL()).
MVersitPlugIn * aPlugIn | A pointer to the plug in. |
White space character codes: used while analysing the syntax of the received data and while externalising data.
ESpace = ' ' |
' ' |
EHTab = 9 |
9 |
ELineFeed = 10 |
10 |
ECarriageReturn = 13 |
13 |
EColon = ':' |
':' |
Flags that can be specified on construction.
ENoVersionProperty = 0 |
This entity does not need a version property. |
ESupportsVersion = 0x01 |
This entity should have a version property. |
EImportSyncML = 0x1000 | |
EUseAutoDetection = 0x4000 |
Indicates whether the parser should use auto-detection of character sets when one has not been explicitly specified. |
ECharSetIdentified = 0x8000 |
The current property has specified a character set. |
EUseDefaultCharSetForAllProperties = 0x2000 |
If the charset is not explicitly specified, the default charset will be used instead of US-ASCII as required by the Versit specification . |
CArrayPtr< CVersitParser > * | iArrayOfEntities | [protected] |
CArrayPtr< CParserProperty > * | iArrayOfProperties | [protected] |
const CArrayFix< CCnvCharacterSetConverter::SCharacterSet > * | iAutoDetectCharSets | [protected] |
TParserCodingDetails | iCurrentPropertyCodingDetails | [protected] |
TBuf< KVersitMaxVersionLength > | iDefaultVersion | [protected] |