CVersitParser Class Reference

class CVersitParser : public CBase

A generic Versit parser.

Provides generic functions which implement behaviour common to both vCalendar and vCard parsers. For instance:

  • 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.

Inherits from

Nested Classes and Structures

Public Member Functions
CVersitParser ( TUint )
~CVersitParser ()
IMPORT_C void AddEntityL ( CVersitParser *)
IMPORT_C void AddPropertyL ( CParserProperty *, TBool )
IMPORT_C void AdjustAllPropertyDateTimesToMachineLocalL ()
IMPORT_C CArrayPtr < CVersitParser > * ArrayOfEntities ( TBool )
IMPORT_C CArrayPtr < CParserProperty > * ArrayOfProperties ( TBool )
IMPORT_C void ConstructL ()
IMPORT_C void ConvertAllPropertyDateTimesToMachineLocalL (const TTimeIntervalSeconds &, const CVersitDaylight *)
IMPORT_C TInt ConvertFromUnicodeToISOL ( TDes8 &, const TDesC16 &, CCnvCharacterSetConverter *)
IMPORT_C TVersitDateTime * DecodeDateTimeL ( TDes &)
IMPORT_C Versit::TVersitCharSet DefaultCharSet ()
IMPORT_C TUint DefaultCharSetId ()
IMPORT_C Versit::TVersitEncoding DefaultEncoding ()
IMPORT_C CArrayPtr < CVersitParser > * EntityL (const TDesC &, TBool )
IMPORT_C TPtrC EntityName ()
IMPORT_C void ExternalizeL ( RFile &)
IMPORT_C void ExternalizeL ( RWriteStream &)
IMPORT_C void InternalizeL ( RFile &, TInt &)
IMPORT_C void InternalizeL ( RReadStream &)
IMPORT_C void InternalizeL ( HBufC *, CLineReader *)
IMPORT_C TBool IsValidLabel (const TDesC &, TInt &)
IMPORT_C TBool IsValidParameterValue ( TInt &, const TDesC &)
IMPORT_C TInt LoadBinaryValuesFromFilesL ()
IMPORT_C TInt LoadBinaryValuesFromFilesL ( RFs &)
TUint MapVersitCharsetToCharConvCharset ( Versit::TVersitCharSet )
TUint MapVersitEncodingToConArcUid ( Versit::TVersitEncoding )
MVersitObserver * Observer ()
MVersitPlugIn * PlugIn ()
IMPORT_C CArrayPtr < CParserProperty > * PropertyL (const TDesC8 &, const TUid &, TBool )
IMPORT_C TInt RecognizeEntityName ()
IMPORT_C TUid RecognizeToken (const TDesC8 &)
IMPORT_C void ResetAndDestroyArrayOfDateTimes ( TAny *)
IMPORT_C void ResetAndDestroyArrayOfEntities ( TAny *)
IMPORT_C void ResetAndDestroyArrayOfParams ( TAny *)
IMPORT_C void ResetAndDestroyArrayOfProperties ( TAny *)
IMPORT_C TInt SaveBinaryValuesToFilesL ( TInt , const TDesC &)
IMPORT_C TInt SaveBinaryValuesToFilesL ( TInt , const TDesC &, RFs &)
IMPORT_C void SetAutoDetect ( TBool , const CArrayFix < CCnvCharacterSetConverter::SCharacterSet > *)
IMPORT_C void SetCharacterConverter ( Versit::TEncodingAndCharset &)
IMPORT_C void SetDefaultCharSet (const Versit::TVersitCharSet )
IMPORT_C void SetDefaultCharSetId ( TUint )
IMPORT_C void SetDefaultEncoding (const Versit::TVersitEncoding )
IMPORT_C void SetEntityNameL (const TDesC &)
void SetFlags ( TUint )
void SetObserver ( MVersitObserver *)
void SetPlugIn ( MVersitPlugIn *)
IMPORT_C TInt Val (const TDesC &, TInt &)
Protected Member Functions
IMPORT_C void AnalysesEncodingCharset ( CArrayPtr < CParserParam > *)
IMPORT_C void AppendBeginL ()
IMPORT_C void AppendEndL ()
void AppendEntityNameL ()
TPtr8 & BufPtr ()
void ClearSupportsVersion ()
IMPORT_C TInt ConvertToUnicodeFromISOL ( TDes16 &, const TDesC8 &, TUint )
HBufC * ConvertToUnicodeL (const TDesC8 &)
IMPORT_C HBufC * DecodePropertyValueL (const TDesC8 &)
IMPORT_C void DecodePropertyValueL (const TDesC8 &, const TUid &)
IMPORT_C TTime * DecodeTimePeriodL (const TDesC &)
IMPORT_C TTimeIntervalSeconds DecodeTimeZoneL (const TDesC &)
IMPORT_C void DoAddPropertyL ( CParserProperty *)
IMPORT_C TBool FindFirstField ( TPtr16 &, TPtr16 &, TBool )
IMPORT_C void FindRemainingField ( TPtr16 &, TPtr16 &)
IMPORT_C TInt GetNumberL (const TDesC &, TInt &)
IMPORT_C CArrayPtr < CParserParam > * GetPropertyParamsLC ( TPtr8 )
TBool IsPunctuationToken ( TUint )
IMPORT_C Versit::TVersitCharSet LineCharSet ()
IMPORT_C TUint LineCharSetId ()
IMPORT_C Versit::TVersitEncoding LineEncoding ()
IMPORT_C TUint LineEncodingId ()
CParserPropertyValueHBufC * MakeDefaultPropertyValueL ( HBufC16 *&)
IMPORT_C CVersitParser * MakeEntityL ( TInt , HBufC *)
IMPORT_C void MakePropertyL ( TPtr8 &, TInt )
IMPORT_C CDesCArray * MakePropertyValueCDesCArrayL ( TPtr16 )
IMPORT_C CVersitDaylight * MakePropertyValueDaylightL ( TPtr16 )
IMPORT_C CParserPropertyValue * MakePropertyValueL (const TUid &, HBufC16 *&)
IMPORT_C CArrayPtr < TVersitDateTime > * MakePropertyValueMultiDateTimeL ( TPtr16 )
IMPORT_C void ParseBeginL ()
IMPORT_C void ParseEndL ()
void ParseEndL ( HBufC16 &)
IMPORT_C TBool ParseEntityL ()
IMPORT_C void ParseParamL ( CArrayPtr < CParserParam > *, TPtr8 )
IMPORT_C void ParsePropertiesL ()
IMPORT_C void ParsePropertyL ()
IMPORT_C CArrayPtr < CParserParam > * ReadLineAndDecodeParamsLC ( TInt &, TInt &)
IMPORT_C void ReadMultiLineValueL ( TPtr8 &, TInt , TBool )
IMPORT_C void RestoreLineCodingDetailsToDefault ()
IMPORT_C void SetLineCharacterSet ( Versit::TVersitCharSet )
IMPORT_C void SetLineCharacterSetId ( TUint )
IMPORT_C void SetLineCoding ( Versit::TVersitCharSet , Versit::TVersitEncoding )
IMPORT_C void SetLineEncoding ( Versit::TVersitEncoding )
IMPORT_C void SetLineEncoding ( TUint )
void SetSupportsVersion ()
TBool SupportsVersion ()
CVersitUnicodeUtils & UnicodeUtils ()
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 ()
Inherited Functions
CBase::CBase()
CBase::Delete(CBase *)
CBase::Extension_(TUint,TAny *&,TAny *)
CBase::operator new(TUint)
CBase::operator new(TUint,TAny *)
CBase::operator new(TUint,TLeave)
CBase::operator new(TUint,TLeave,TUint)
CBase::operator new(TUint,TUint)
CBase::~CBase()
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

Constructor & Destructor Documentation

CVersitParser(TUint)

IMPORT_C CVersitParser ( TUint aFlags )

The first phase constructor for a Versit parser.

Sets the default encoding to Versit::ENoEncoding and the default character set to Versit::EUSAsciiCharSet .

Note: this function is called by the CParserVCal and CParserVCard constructors. It should only be called directly by a user if creating a new parser

Parameters

TUint aFlags The flag to indicate whether this entity needs a version property. The possible values for this flag are given in the TVersitParserFlags enumeration. If a version property is needed, one will be created and appended to the start of the array of properties.

~CVersitParser()

IMPORT_C ~CVersitParser ( )

Frees all resources owned by the object, prior to its destruction.

Member Functions Documentation

AddEntityL(CVersitParser *)

IMPORT_C void AddEntityL ( CVersitParser * aEntity )

Adds a sub-entity (e.g. a to-do, event or a nested vCard) to the current entity.

Sets the default encoding and character set to the default ones of the current Versit parser, then adds the entity to the array of entities owned by the parser.

Note: This function may be used when building up a Versit parser object from a client application.

Called by ParseEntityL() .

Parameters

CVersitParser * aEntity The entity to be added into the array of entities. Ownership of aEntity is taken at beginning of the function.

AddPropertyL(CParserProperty *, TBool)

IMPORT_C void AddPropertyL ( CParserProperty * aProperty,
TBool aInternalizing = EFalse
)

Appends a property to the current entity's array of properties.

This function may be used when building up a Versit parser object from a client application. It is not called internally.

Parameters

CParserProperty * aProperty Pointer to the property to add to the entity.
TBool aInternalizing = EFalse This parameter is used to distinguish between reading an entity from a stream or file (i.e. internalising), in which case the argument should have a value of ETrue, and building an entity "by hand" (e.g. creating a vCard in the Contacts application), in which case the argument should have a value of EFalse.

AdjustAllPropertyDateTimesToMachineLocalL()

IMPORT_C void AdjustAllPropertyDateTimesToMachineLocalL ( )

AnalysesEncodingCharset(CArrayPtr< CParserParam > *)

IMPORT_C void AnalysesEncodingCharset ( CArrayPtr < CParserParam > * aArrayOfParams ) [protected]

Parameters

CArrayPtr < CParserParam > * aArrayOfParams

AppendBeginL()

IMPORT_C void AppendBeginL ( ) [protected]

AppendEndL()

IMPORT_C void AppendEndL ( ) [protected]

AppendEntityNameL()

void AppendEntityNameL ( ) [protected]

ArrayOfEntities(TBool)

IMPORT_C CArrayPtr < CVersitParser > * ArrayOfEntities ( TBool aTakeOwnership = ETrue )

Gets the current entity's array of sub-entities.

Note: the current entity may be a top level entity, or may itself be a sub-entity.

Parameters

TBool aTakeOwnership = ETrue If ETrue, the calling code takes ownership of the array; the array of entities owned by the current entity is then deleted. If EFalse, ownership remains with the Versit parser.

ArrayOfProperties(TBool)

IMPORT_C CArrayPtr < CParserProperty > * ArrayOfProperties ( TBool aTakeOwnership = ETrue )

Gets the current entity's array of properties.

Parameters

TBool aTakeOwnership = ETrue If ETrue, the calling code takes ownership of the array; the entity's array of properties is then deleted . If EFalse, ownership remains with the entity.

BufPtr()

TPtr8 & BufPtr ( ) [protected, inline]

ClearSupportsVersion()

void ClearSupportsVersion ( ) [protected, inline]

ConstructL()

IMPORT_C void ConstructL ( )

The second phase constructor for a Versit parser.

Stores a pointer to a CVersitTlsData (thread local storage data class). This is used to allow an instance of CVersitUnicodeUtils to be shared by all co-existing parsers, which provides a major performance improvement.

Called by the CParserVCal and CParserVCard constructors.

Should only be called directly by a user if creating a new parser.

ConvertAllPropertyDateTimesToMachineLocalL(const TTimeIntervalSeconds &, const CVersitDaylight *)

IMPORT_C void ConvertAllPropertyDateTimesToMachineLocalL ( const TTimeIntervalSeconds & aIncrement,
const CVersitDaylight * aDaylight
) [virtual]

Converts all date/time property values contained in the current entity's array of properties into machine local values.

This conversion is needed because of differences in universal and local times due to time zones and daylight savings (seasonal time shifts).

First, all of the date/times are converted to universal time, if they are not already:

If daylight saving is in effect then the daylight savings rule (held in the aDaylight parameter) will be used to compensate for differences between universal and local times due to both time zones and the daylight saving. Otherwise, the aIncrement parameter is used to compensate for any difference due to time zones alone.

Then, these universal time values are converted into machine local times by adding the universal time offset for the machine's locale.

since 9.1

Parameters

const TTimeIntervalSeconds & aIncrement A time interval in seconds which represents the negative of the time zone of the originating machine. For instance, if the time zone is +04:30, aIncrement should be set to -04:30.
const CVersitDaylight * aDaylight Pointer to the specification for daylight saving. If the date/time value is within the period for daylight saving, the value is modified by the daylight saving offset (which accounts for both the time zone and daylight saving rule).

ConvertAllUTCDateTimesToMachineLocalL(const TTimeIntervalSeconds &, const CVersitDaylight *)

void ConvertAllUTCDateTimesToMachineLocalL ( const TTimeIntervalSeconds & aIncrement,
const CVersitDaylight * aDaylight
) [private]

Parameters

const TTimeIntervalSeconds & aIncrement
const CVersitDaylight * aDaylight

ConvertFromUnicodeToISOL(TDes8 &, const TDesC16 &, CCnvCharacterSetConverter *)

IMPORT_C TInt ConvertFromUnicodeToISOL ( TDes8 & aIso,
const TDesC16 & aUnicode,
CCnvCharacterSetConverter * aConverter
) [static]

Converts text in the Unicode character set (UCS-2) into a non-unicode (International Standards Organisation) character set.

Which ISO character set the string is converted to is determined by the value of the character set identifier in the aConverter parameter.

Parameters

TDes8 & aIso On return, the converted text string in the specified ISO character set.
const TDesC16 & aUnicode The Unicode text string to be converted.
CCnvCharacterSetConverter * aConverter The character set converter.

ConvertToUnicodeFromISOL(TDes16 &, const TDesC8 &, TUint)

IMPORT_C TInt ConvertToUnicodeFromISOL ( TDes16 & aUnicode,
const TDesC8 & aIso,
TUint aCharacterSet
) [protected]

Converts text in a non-Unicode character set into Unicode (UCS-2).

Parameters

TDes16 & aUnicode On return, the converted text string in the Unicode character set.
const TDesC8 & aIso The non-Unicode text string to be converted.
TUint aCharacterSet The non-Unicode character set in which aIso is encoded.

ConvertToUnicodeL(const TDesC8 &)

HBufC * ConvertToUnicodeL ( const TDesC8 & aValue ) [protected]

Parameters

const TDesC8 & aValue

ConvertUTCDateTimeToMachineLocal(TVersitDateTime *, const TTimeIntervalSeconds &, const CVersitDaylight *)

void ConvertUTCDateTimeToMachineLocal ( TVersitDateTime * aDateTime,
const TTimeIntervalSeconds & aIncrement,
const CVersitDaylight * aDaylight
) [private]

Parameters

TVersitDateTime * aDateTime
const TTimeIntervalSeconds & aIncrement
const CVersitDaylight * aDaylight

DecodeDateTimeL(TDes &)

IMPORT_C TVersitDateTime * DecodeDateTimeL ( TDes & aToken ) const

Parameters

TDes & aToken

DecodePropertyValueL(const TDesC8 &)

IMPORT_C HBufC * DecodePropertyValueL ( const TDesC8 & aValue ) [protected]

Parameters

const TDesC8 & aValue

DecodePropertyValueL(const TDesC8 &, const TUid &)

IMPORT_C void DecodePropertyValueL ( const TDesC8 & aValue,
const TUid & aEncodingUid
) [protected]

Parameters

const TDesC8 & aValue
const TUid & aEncodingUid

DecodeTimePeriodL(const TDesC &)

IMPORT_C TTime * DecodeTimePeriodL ( const TDesC & aToken ) const [protected]

Parameters

const TDesC & aToken

DecodeTimeZoneL(const TDesC &)

IMPORT_C TTimeIntervalSeconds DecodeTimeZoneL ( const TDesC & aToken ) const [protected]

Parameters

const TDesC & aToken

DefaultCharSet()

IMPORT_C Versit::TVersitCharSet DefaultCharSet ( ) const

Gets the default character set or transformation format. This may be used to represent property values in Versit objects.

DefaultCharSetId()

IMPORT_C TUint DefaultCharSetId ( ) const

Gets the default character set or transformation format.

This may be used to represent property values in Versit objects.

DefaultEncoding()

IMPORT_C Versit::TVersitEncoding DefaultEncoding ( ) const

Gets the parser's default encoding.

This value is initialised on construction, to ENoEncoding.

DoAddPropertyL(CParserProperty *)

IMPORT_C void DoAddPropertyL ( CParserProperty * aProperty ) [protected]

Parameters

CParserProperty * aProperty

DoInternalizeL()

void DoInternalizeL ( ) [private]

EntityL(const TDesC &, TBool)

IMPORT_C CArrayPtr < CVersitParser > * EntityL ( const TDesC & aEntityName,
TBool aTakeOwnership = ETrue
)

Gets all sub-entities in the current entity, whose name matches the name specified.

Parameters

const TDesC & aEntityName The sub-entity name of interest, e.g. KVersitVarTokenVEVENT or KVersitVarTokenVTODO. All sub-entities which match this name are returned in the array of pointers.
TBool aTakeOwnership = ETrue If ETrue, the calling code takes ownership of each matching sub-entity, in which case the sub-entities are deleted from the current object's array of entities. If EFalse, ownership remains with the Versit parser.

EntityName()

IMPORT_C TPtrC EntityName ( ) const

Gets the current entity's name.

If no name has been set, returns an empty descriptor.

ExternalizeL(RFile &)

IMPORT_C void ExternalizeL ( RFile & aOutputFile )

Externalises a Versit entity (vCard or vCalendar) and all of its sub-entities and properties to a file.

Adds a version property to the start of the current entity's array of properties if the entity supports this.

This is a thin layer over the CVersitParser::ExternalizeL(RWriteStream& aStream) function to enable a versit entity to be externalised into an RFile .

Parameters

RFile & aOutputFile The file to which to write the entity.

ExternalizeL(RWriteStream &)

IMPORT_C void ExternalizeL ( RWriteStream & aStream ) [virtual]

Externalises a Versit entity (vCard or vCalendar) and all of its sub-entities and properties to a write stream.

Adds a version property to the start of the current entity's array of properties if the entity supports this. (If there isn't an array of properties then one is made).

The presence of this function means that the standard templated operator<<() (defined in s32strm.h) is available to externalise objects of this class.

This virtual function serves as a base function for derived classes to externalise an entity.

Parameters

RWriteStream & aStream Stream to which the entity should be externalised.

FindFirstField(TPtr16 &, TPtr16 &, TBool)

IMPORT_C TBool FindFirstField ( TPtr16 & aField,
TPtr16 & aRemaining,
TBool aTrimSpace = ETrue
) [protected]

Parameters

TPtr16 & aField
TPtr16 & aRemaining
TBool aTrimSpace = ETrue

FindRemainingField(TPtr16 &, TPtr16 &)

IMPORT_C void FindRemainingField ( TPtr16 & aField,
TPtr16 & aRemaining
) [protected]

Sets up a pointer to the remaining field. Sets the original remaining field pointers length to 0.

Parameters

TPtr16 & aField on return points to the data and length that aRemaining originally pointed to.
TPtr16 & aRemaining as input references a location that the descriptor is to represent. On return length is set to 0.

GetNumberL(const TDesC &, TInt &)

IMPORT_C TInt GetNumberL ( const TDesC & aToken,
TInt & aNumChars
) const [protected]

Parameters

const TDesC & aToken
TInt & aNumChars

GetPropertyParamsLC(TPtr8)

IMPORT_C CArrayPtr < CParserParam > * GetPropertyParamsLC ( TPtr8 aParams ) [protected]

Parameters

TPtr8 aParams

InternalizeL(RFile &, TInt &)

IMPORT_C void InternalizeL ( RFile & aInputFile,
TInt & aBytesThroughFile
)

Internalises a versit entity (vCard or vCalendar) and all of its sub-entities and properties from a file.

Stores all date/time in same format as received

leave
KErrEof The file position specified is beyond the end of the file.

Parameters

RFile & aInputFile The file from which to internalise the entity.
TInt & aBytesThroughFile The number of bytes into the file at which to begin reading. On return, is updated to contain the last position in the file which was read.

InternalizeL(RReadStream &)

IMPORT_C void InternalizeL ( RReadStream & aStream ) [virtual]

Internalises a Versit entity (vCard or vCalendar) contained in the incoming stream and parses it, breaking it down into its constituent sub-entities (e.g. to-dos, events, and nested vCards) and properties.

The presence of this function means that the standard templated operator>>() (defined in s32strm.h) is available to internalise objects of this class.

This virtual function serves as a base function for derived classes to internalise an entity.

Parameters

RReadStream & aStream Stream from which the vCalendar should be internalised.

InternalizeL(HBufC *, CLineReader *)

IMPORT_C void InternalizeL ( HBufC * aEntityName,
CLineReader * aLineReader
) [virtual]

Internalises a vCalendar or vCard sub-entity.

(Assumes "BEGIN : <EntityName> CRLF" has been parsed).

This virtual function serves as a base function for derived classes to parse a sub-entity.

Parameters

HBufC * aEntityName The entity name to be parsed. Ownership of aEntityName is taken by the parser.
CLineReader * aLineReader Pointer to a line reader which is used by the super-entity.

IsPunctuationToken(TUint)

TBool IsPunctuationToken ( TUint aChar ) [protected, static]

Parameters

TUint aChar

IsValidLabel(const TDesC &, TInt &)

IMPORT_C TBool IsValidLabel ( const TDesC & aLabel,
TInt & aPos
) [static]

Tests whether a property name is valid.

The property name is invalid if it contains any of the following characters:-

[] (left or right square bracket)

= (equals sign)

: (colon)

. (dot)

, (comma)

Parameters

const TDesC & aLabel The property name to test.
TInt & aPos On return, contains the character position within the property name of the first invalid character found.

IsValidParameterValue(TInt &, const TDesC &)

IMPORT_C TBool IsValidParameterValue ( TInt & aPos,
const TDesC & aParamValue
) [static]

Tests whether a property parameter name or value is valid.

If the string aParamValue contains any punctuation characters, the string is invalid. Otherwise, it is valid. Punctuation characters are defined as any of the following:-

[] (left or right square bracket)

= (equals sign)

: (colon)

; (semi colon)

. (dot)

, (comma)

Parameters

TInt & aPos On return, contains the character position of the first invalid character in the property parameter name or value.
const TDesC & aParamValue The property parameter name or value to test.

LineCharSet()

IMPORT_C Versit::TVersitCharSet LineCharSet ( ) const [protected]

LineCharSetId()

IMPORT_C TUint LineCharSetId ( ) const [protected]

LineEncoding()

IMPORT_C Versit::TVersitEncoding LineEncoding ( ) const [protected]

LineEncodingId()

IMPORT_C TUint LineEncodingId ( ) const [protected]

LoadBinaryValuesFromFilesL()

IMPORT_C TInt LoadBinaryValuesFromFilesL ( )

Loads all files represented by URI property values and sets the binary data contained in the files to be the property values instead of the URIs.

For every property in the parser, if its value is a URI containing file:// followed by a path and filename, then the file is opened and the binary data it contains is read into a CParserPropertyValueBinary object. This replaces the URI as the property value. The function also operates on any agents in the vCard that contain URI property values.

The function creates its own file server session, which is needed to open the files. It leaves if there is a problem opening any of the files.

LoadBinaryValuesFromFilesL(RFs &)

IMPORT_C TInt LoadBinaryValuesFromFilesL ( RFs & aFileSession )

Loads all files represented by URI property values and sets the binary data contained in the files to be the property values instead of the URIs.

For every property in the parser, if its value is a URI containing file:// followed by a path and filename, then the file is opened and the binary data it contains is read into a CParserPropertyValueBinary object. This replaces the URI as the property value. The function also operates on any agents in the vCard that contain URI property values.

The function uses the file server session supplied, which is needed to open the files. It leaves if there is a problem opening any of the files.

Parameters

RFs & aFileSession The file server session used to open the files.

MakeDefaultPropertyValueL(HBufC16 *&)

CParserPropertyValueHBufC * MakeDefaultPropertyValueL ( HBufC16 *& aValue ) [protected]

Instantiates and gives ownership of a CParserPropertyValueHBufC object.

Parameters

HBufC16 *& aValue

MakeEntityL(TInt, HBufC *)

IMPORT_C CVersitParser * MakeEntityL ( TInt aEntityUid,
HBufC * aEntityName
) [protected, virtual]

Parameters

TInt aEntityUid
HBufC * aEntityName

MakePropertyL(TPtr8 &, TInt)

IMPORT_C void MakePropertyL ( TPtr8 & aPropName,
TInt aValueStart
) [protected]

Parameters

TPtr8 & aPropName
TInt aValueStart

MakePropertyValueCDesCArrayL(TPtr16)

IMPORT_C CDesCArray * MakePropertyValueCDesCArrayL ( TPtr16 aStringValue ) [protected]

Parses a compound property value string.

The sub-values found are appended to an array, after removal of escape characters. The array is returned, and ownership is transferred to the caller.

Parameters

TPtr16 aStringValue Compound property value string.

MakePropertyValueDaylightL(TPtr16)

IMPORT_C CVersitDaylight * MakePropertyValueDaylightL ( TPtr16 aDaylightValue ) [protected]

Parameters

TPtr16 aDaylightValue

MakePropertyValueL(const TUid &, HBufC16 *&)

IMPORT_C CParserPropertyValue * MakePropertyValueL ( const TUid & aPropertyUid,
HBufC16 *& aValue
) [protected, virtual]

Parameters

const TUid & aPropertyUid
HBufC16 *& aValue

MakePropertyValueMultiDateTimeL(TPtr16)

IMPORT_C CArrayPtr < TVersitDateTime > * MakePropertyValueMultiDateTimeL ( TPtr16 aDateTimeGroup ) [protected]

Parameters

TPtr16 aDateTimeGroup

MapVersitCharsetToCharConvCharset(Versit::TVersitCharSet)

TUint MapVersitCharsetToCharConvCharset ( Versit::TVersitCharSet aVersitSet ) [static]

Parameters

Versit::TVersitCharSet aVersitSet

MapVersitEncodingToConArcUid(Versit::TVersitEncoding)

TUint MapVersitEncodingToConArcUid ( Versit::TVersitEncoding aVersitEncoding ) [static]

Parameters

Versit::TVersitEncoding aVersitEncoding

Observer()

MVersitObserver * Observer ( ) [inline]

Gets a pointer to the Versit observer.

ParseBeginL()

IMPORT_C void ParseBeginL ( ) [protected]

ParseEndL()

IMPORT_C void ParseEndL ( ) [protected]

ParseEndL(HBufC16 &)

void ParseEndL ( HBufC16 & aEntityName ) [protected]

Parameters

HBufC16 & aEntityName

ParseEntityL()

IMPORT_C TBool ParseEntityL ( ) [protected]

ParseParamL(CArrayPtr< CParserParam > *, TPtr8)

IMPORT_C void ParseParamL ( CArrayPtr < CParserParam > * aArray,
TPtr8 aParam
) [protected]

Parameters

CArrayPtr < CParserParam > * aArray
TPtr8 aParam

ParsePropertiesL()

IMPORT_C void ParsePropertiesL ( ) [protected]

ParsePropertyL()

IMPORT_C void ParsePropertyL ( ) [protected, virtual]

PlugIn()

MVersitPlugIn * PlugIn ( ) [inline]

Gets a pointer to the Versit plug-in.

PropertyL(const TDesC8 &, const TUid &, TBool)

IMPORT_C CArrayPtr < CParserProperty > * PropertyL ( const TDesC8 & aPropertyName,
const TUid & aPropertyUid,
TBool aTakeOwnership = ETrue
) const

Gets all properties in the current entity's array of properties whose name and value match the name and value specified.

Parameters

const TDesC8 & aPropertyName The property name of interest. Property names are defined in vtoken.h.
const TUid & aPropertyUid The ID of the property value of interest (which has the format "K<Versit/Card/Cal>Property<Type>Uid"). The values are defined in file vuid.h.
TBool aTakeOwnership = ETrue If ETrue, the calling code takes ownership of each matching property; the property is then deleted from the current entity's array. If EFalse, ownership remains with the entity.

ReadLineAndDecodeParamsLC(TInt &, TInt &)

IMPORT_C CArrayPtr < CParserParam > * ReadLineAndDecodeParamsLC ( TInt & aValueStart,
TInt & aNameLen
) [protected]

Parameters

TInt & aValueStart
TInt & aNameLen

ReadMultiLineValueL(TPtr8 &, TInt, TBool)

IMPORT_C void ReadMultiLineValueL ( TPtr8 & aValue,
TInt aValueStart,
TBool aBinaryData
) [protected]

Parameters

TPtr8 & aValue
TInt aValueStart
TBool aBinaryData

RecognizeEntityName()

IMPORT_C TInt RecognizeEntityName ( ) const [virtual]

Tests the current entity to see if it is a vEvent or vTodo.

This function is virtual. Actual testing only occurs in derived classes which implement this function.

RecognizeToken(const TDesC8 &)

IMPORT_C TUid RecognizeToken ( const TDesC8 & aToken ) const [virtual]

Returns a UID for the specified token.

This function only recognizes generic Versit tokens. For example, if aToken contains the property name KVersitTokenBEGIN, the function returns KVersitTokenBeginUid. More specific recognition should occur in derived classes which implement this function, using this as the base recogniser.

Parameters

const TDesC8 & aToken The token to be recognized.

Reserved1()

IMPORT_C void Reserved1 ( ) [private, virtual]

Reserved2()

IMPORT_C void Reserved2 ( ) [private, virtual]

ResetAndDestroyArrayOfDateTimes(TAny *)

IMPORT_C void ResetAndDestroyArrayOfDateTimes ( TAny * aObject ) [static]

Destroys an array of Versit dates and times.

Parameters

TAny * aObject Pointer to the array of Versit dates and times to be destroyed.

ResetAndDestroyArrayOfEntities(TAny *)

IMPORT_C void ResetAndDestroyArrayOfEntities ( TAny * aObject ) [static]

Destroys an array of entities.

Parameters

TAny * aObject Pointer to the array of entities to be destroyed.

ResetAndDestroyArrayOfParams(TAny *)

IMPORT_C void ResetAndDestroyArrayOfParams ( TAny * aObject ) [static]

Destroys an array of parameters.

Parameters

TAny * aObject Pointer to the array of parameters to be destroyed.

ResetAndDestroyArrayOfProperties(TAny *)

IMPORT_C void ResetAndDestroyArrayOfProperties ( TAny * aObject ) [static]

Destroys an array of properties.

Parameters

TAny * aObject Pointer to the array of properties to be destroyed.

RestoreLineCodingDetailsToDefault()

IMPORT_C void RestoreLineCodingDetailsToDefault ( ) [protected]

SaveBinaryValuesToFilesL(TInt, const TDesC &)

IMPORT_C TInt SaveBinaryValuesToFilesL ( TInt aSizeThreshold,
const TDesC & aPath
)

Saves all binary property values larger than a specified threshold to files, and sets each property value to be a URI representing the file, rather than the binary data iself.

The files are created in the folder identified by aPath, and are assigned unique filenames that consist of the property name and some random numbers.

Each new URI property value is prefixed with file:// and contains the path and filename of the file created.

If a vCard contains any agent property values and if they contain binary data whose size exceeds the threshold, these property values are replaced with URI property values.

The function sets up its own file server session, which is needed to create the files. It leaves if there is a problem creating any of the files.

Parameters

TInt aSizeThreshold The threshold number of bytes for the binary data, above which the binary data is stored in a file.
const TDesC & aPath The path identifying the location in which the files are created. This must not be greater than 240 characters long or the function leaves with KErrArgument. If it doesn't end in a slash, then one is appended.

SaveBinaryValuesToFilesL(TInt, const TDesC &, RFs &)

IMPORT_C TInt SaveBinaryValuesToFilesL ( TInt aSizeThreshold,
const TDesC & aPath,
RFs & aFileSession
)

Saves all binary property values larger than a specified threshold to files, and sets each property value to be a URI representing the file rather than the binary data iself.

The files are created in the folder identified by aPath, and are assigned unique filenames that consist of the property name and some random numbers.

Each new URI property value is prefixed with file:// and contains the path and filename of the file created.

If a vCard contains any agent property values and if they contain binary data whose size exceeds the threshold, these property values are replaced with URI property values.

The function uses the file server session supplied, which is needed to create the files. It leaves if there is a problem creating any of the files.

Parameters

TInt aSizeThreshold The threshold number of bytes for the binary data, above which the binary data is stored in a file.
const TDesC & aPath The path identifying the location in which the files are created. This must not be greater than 240 characters long or the function leaves with KErrArgument. If it doesn't end in a slash, then one is appended.
RFs & aFileSession The file server session used to create the files.

SetAutoDetect(TBool, const CArrayFix< CCnvCharacterSetConverter::SCharacterSet > *)

IMPORT_C void SetAutoDetect ( TBool aOn,
const CArrayFix < CCnvCharacterSetConverter::SCharacterSet > * aAutoDetectCharSets = NULL
)

Turns auto detection of character sets on or off.

If a property does not specify a character set, then it is possible to guess its character set. This function turns this behaviour on or off. When the behaviour is on, it also lets the caller specify a restricted set of character sets to be considered.

Auto-detection of character sets is used (if auto detection is on) when converting a property value to Unicode while internalising a stream.

Parameters

TBool aOn If ETrue, auto detection is turned on; if EFalse (the default value), auto detection is turned off
const CArrayFix < CCnvCharacterSetConverter::SCharacterSet > * aAutoDetectCharSets = NULL If specified then auto detection will only consider the character sets listed. If NULL, all available character sets are considered.

SetCharacterConverter(Versit::TEncodingAndCharset &)

IMPORT_C void SetCharacterConverter ( Versit::TEncodingAndCharset & encodingAndCharset )

Sets a character converter suitable for converting strings between Unicode and the specified character set.

The function finds a suitable converter for the character set specified in aEncodingAndCharset.iCharSetId, if one is available, and assigns it to aEncodingAndCharset.iConverter.

If there is no converter available for the specified character set then iConverter is set to NULL.

This function is only of use if executing a major change to the externalisation behaviour, particularly if overriding CParserProperty::ExternalizeL() - the function from which this function is called.

Parameters

Versit::TEncodingAndCharset & encodingAndCharset A utility class from which the character set information is extracted (from its member iCharSetId) and to which the suitable character converter is set (to its member iConverter).

SetDefaultCharSet(const Versit::TVersitCharSet)

IMPORT_C void SetDefaultCharSet ( const Versit::TVersitCharSet aCharSet )

Sets the default character set or transformation format.

This may be used to represent property values in Versit objects.

Parameters

const Versit::TVersitCharSet aCharSet The default character set.

SetDefaultCharSetId(TUint)

IMPORT_C void SetDefaultCharSetId ( TUint aCharSetId )

Sets the default character set or transformation format.

This may be used to represent property values in Versit objects.

Parameters

TUint aCharSetId The UID for the character set. These are defined in charconv.h.

SetDefaultEncoding(const Versit::TVersitEncoding)

IMPORT_C void SetDefaultEncoding ( const Versit::TVersitEncoding aEncoding )

Sets the parser's default encoding to aEncoding.

panic
Versit-Parser 7 aEncoding is Versit::EEightBitEncoding .

Parameters

const Versit::TVersitEncoding aEncoding An encoding. Cannot be 8-bit.

SetEntityNameL(const TDesC &)

IMPORT_C void SetEntityNameL ( const TDesC & aEntityName )

Sets the name for the current entity to one of: VCARD, VCALENDAR, VEVENT or VTODO.

leave
KErrNoMemory Memory is allocated for the new entity name on the heap, so it can leave if there is insufficient memory available.

Parameters

const TDesC & aEntityName The new name for the current parser entity. Any existing name is first deleted.

SetFlags(TUint)

void SetFlags ( TUint aFlags ) [inline]

Parameters

TUint aFlags

SetLineCharacterSet(Versit::TVersitCharSet)

IMPORT_C void SetLineCharacterSet ( Versit::TVersitCharSet aLineCharSet ) [protected]

Parameters

Versit::TVersitCharSet aLineCharSet

SetLineCharacterSetId(TUint)

IMPORT_C void SetLineCharacterSetId ( TUint aLineCharSetId ) [protected]

Parameters

TUint aLineCharSetId

SetLineCharsetDetailsToDefault()

void SetLineCharsetDetailsToDefault ( ) [private]

SetLineCoding(Versit::TVersitCharSet, Versit::TVersitEncoding)

IMPORT_C void SetLineCoding ( Versit::TVersitCharSet aLineCharSet,
Versit::TVersitEncoding aLineEncoding
) [protected]

Parameters

Versit::TVersitCharSet aLineCharSet
Versit::TVersitEncoding aLineEncoding

SetLineEncoding(Versit::TVersitEncoding)

IMPORT_C void SetLineEncoding ( Versit::TVersitEncoding aLineEncoding ) [protected]

Parameters

Versit::TVersitEncoding aLineEncoding

SetLineEncoding(TUint)

IMPORT_C void SetLineEncoding ( TUint aVersitEncodingUid ) [protected]

Parameters

TUint aVersitEncodingUid

SetLineEncodingDetailsToDefault()

void SetLineEncodingDetailsToDefault ( ) [private]

SetObserver(MVersitObserver *)

void SetObserver ( MVersitObserver * aObserver ) [inline]

Sets the Versit observer.

Parameters

MVersitObserver * aObserver A pointer to the observer.

SetPlugIn(MVersitPlugIn *)

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() ).

Parameters

MVersitPlugIn * aPlugIn A pointer to the plug in.

SetSupportsVersion()

void SetSupportsVersion ( ) [protected, inline]

SupportsVersion()

TBool SupportsVersion ( ) const [protected, inline]

UnicodeUtils()

CVersitUnicodeUtils & UnicodeUtils ( ) [protected, inline]

Val(const TDesC &, TInt &)

IMPORT_C TInt Val ( const TDesC & aString,
TInt & aNumber
) [static]

Converts a string into an integer, for example, it converts "438" to 438.

Parameters

const TDesC & aString The string to be converted. Every character contained in the string needs to be number presentable, i.e. between '0' and '9'.
TInt & aNumber On return, the integer corresponding to aString.

Member Enumerations Documentation

Enum TCharCodes

White space character codes: used while analysing the syntax of the received data and while externalising data.

Enumerators

ESpace = ' '

' '

EHTab = 9

9

ELineFeed = 10

10

ECarriageReturn = 13

13

EColon = ':'

':'

Enum TVersitParserFlags

Flags that can be specified on construction.

Enumerators

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 .

Member Data Documentation

CArrayPtr< CVersitParser > * iArrayOfEntities

CArrayPtr < CVersitParser > * iArrayOfEntities [protected]

CArrayPtr< CParserProperty > * iArrayOfProperties

CArrayPtr < CParserProperty > * iArrayOfProperties [protected]

const CArrayFix< CCnvCharacterSetConverter::SCharacterSet > * iAutoDetectCharSets

const CArrayFix < CCnvCharacterSetConverter::SCharacterSet > * iAutoDetectCharSets [protected]

CParserProperty * iCurrentProperty

CParserProperty * iCurrentProperty [protected]

TParserCodingDetails iCurrentPropertyCodingDetails

TParserCodingDetails iCurrentPropertyCodingDetails [protected]

HBufC8 * iDecodedValue

HBufC8 * iDecodedValue [protected]

TParserCodingDetails iDefaultCodingDetails

TParserCodingDetails iDefaultCodingDetails [protected]

TBuf< KVersitMaxVersionLength > iDefaultVersion

TBuf < KVersitMaxVersionLength > iDefaultVersion [protected]

HBufC * iEntityName

HBufC * iEntityName [protected]

TInt iFlags

TInt iFlags [protected]

CBufSeg * iLargeDataBuf

CBufSeg * iLargeDataBuf [protected]

CLineReader * iLineReader

CLineReader * iLineReader [protected]

MVersitObserver * iObserver

MVersitObserver * iObserver [protected]

CLineReader * iOwnedLineReader

CLineReader * iOwnedLineReader [protected]

TInt iParseBegin

TInt iParseBegin [private]

MVersitPlugIn * iPlugIn

MVersitPlugIn * iPlugIn [protected]

TInt iReserved2

TInt iReserved2 [private]

CVersitTlsData * iStaticUtils

CVersitTlsData * iStaticUtils [protected]

RWriteStream * iWriteStream

RWriteStream * iWriteStream [protected]