Location:
versit.h
Link against: versit.lib
CVersitParser
Supported from 5.0
vCalendar or vCard parser.
The vCalendar or vCard data is read from or
written to a stream. InternalizeL()
reads the vCalendar or vCard contained in the
stream and parses it, breaking it down into its constituent sub-entities (e.g.
to-dos, events, and nested vCards) and properties. It also converts all
date/times into machine-local values. ExternalizeL()
writes the
vCalendar or vCard to a write stream, converting all date/time values from
machine-local into universal time. Most users of this class will only need to
use these two functions.
The class also provides functions to add properties and
sub-entities to an existing object. Although this is not an abstract class, in
practice, you would create and use objects of one of the derived classes
instead (CParserVCard
or CParserVCal
).
|
Defined in CVersitParser
:
AddEntityL()
, AddPropertyL()
, ArrayOfEntities()
, ArrayOfProperties()
, ConvertAllPropertyDateTimesToMachineLocalL()
, DefaultCharSet()
, DefaultEncoding()
, EBIG5CharSet
, EEUCJPCharSet
, EGB231280CharSet
, EGBKCharSet
, EISO2022JPCharSet
, EISO885910CharSet
, EISO88591CharSet
, EISO88592CharSet
, EISO88593CharSet
, EISO88594CharSet
, EISO88595CharSet
, EISO88597CharSet
, EISO88599CharSet
, EShiftJISCharSet
, EUSAsciiCharSet
, EUTF7CharSet
, EUTF8CharSet
, EntityL()
, EntityName()
, ExternalizeL()
, InternalizeL()
, IsValidLabel()
, IsValidParameterValue()
, PropertyL()
, SetDefaultCharSet()
, SetDefaultEncoding()
, SetEntityNameL()
, SetParamCharType()
, TVersitCharSet
Inherited from CBase
:
operator new()
void ExternalizeL(RWriteStream& aStream);
Externalises a versit entity (vCard or vCalendar) and all of
its sub-entities and properties to a write stream. Converts all date/time
values from machine-local into universal time. The presence of this function
means that the standard templated operator<<()
(defined in
s32strm.h) is available to externalise objects of this class.
|
void ExternalizeL(RFile& aOutputFile);
Externalises a versit entity (vCard or vCalendar) and all of its sub-entities and properties to a file. Converts all date/time values from machine-local into universal time.
|
void InternalizeL(RReadStream& aStream);
Internalises a versit entity (vCard or vCalendar) and all of its
sub-entities and properties from a read stream. Converts all date/times into
machine-local values. The presence of this function means that the standard
templated operator>>()
(defined in s32strm.h) is available
to internalise objects of this class.
|
void InternalizeL(RFile& aInputFile,TInt& aBytesThroughFile);
Internalises a versit entity (vCard or vCalendar) and all of its
sub-entities and properties from a file. Converts all date/times into
machine-local values. aBytesThroughFile
is the file position at
which reading should start. On return, it is updated to mark the file position
of the last byte read from the file.
|
|
void AddEntityL(CVersitParser* aEntity);
Adds a sub-entity (e.g. a to-do, event or a nested vCard) to the current entity. This function may be used when building up a versit parser object from a client application.
|
CArrayPtr<CVersitParser>* ArrayOfEntities(TBool aTakeOwnership);
Gets the current entity's array of sub-entities. The current entity may
be a top level entity, or may itself be a sub-entity. If
aTakeOwnership
is true, the array of sub-entities owned by the
current entity is then set to NULL so that the code which calls this function
takes ownership of the array.
|
|
CArrayPtr<CVersitParser>* EntityL(const TDesC& aEntityName,TBool aTakeOwnership);
Gets all sub-entities in the current entity, whose name matches the name specified.
|
|
void SetEntityNameL(const TDesC& aEntityName);
Sets the name for the current entity to one of: VCARD, VCALENDAR, VEVENT or VTODO.
|
|
TPtrC EntityName() const;
Gets the current entity's name. If no name has been set, returns an empty descriptor.
|
void AddPropertyL(CParserProperty* aProperty,TBool aInternalizing);
Appends a property to the current entity's list of properties. This function may be used when building up a versit parser object from a client application.
|
CArrayPtr<CParserProperty>* ArrayOfProperties(TBool aTakeOwnership);
Gets the current entity’s array of properties. If
aTakeOwnership
is true, the entity’s array of properties is
then set to NULL so that the code which calls this function takes ownership of
the array.
|
|
CArrayPtr<CParserProperty>* PropertyL(const TDesC& aPropertyName,const TUid& aPropertyUid,TBool aTakeOwnership);
Gets all properties in the current entity's list of properties whose name and value match the name and value specified.
|
|
void ConvertAllPropertyDateTimesToMachineLocalL(const TTimeIntervalSeconds& aIncrement,const CVersitDaylight* aDaylight);
Converts all date/time property values contained in the current entity's list of properties into machine local values.
It does this first by converting all date/times into universal time, by
adding aIncrement
and subtracting the daylight saving offset
specified in aDaylight
(if daylight saving is in effect). Then,
these universal time values are converted into machine local times by adding
the universal time offset for the machine's locale.
Note that this function is called by InternalizeL()
.
|
TBool IsValidLabel(const TDesC& aLabel, TInt& aPos);
Tests whether a property name is valid.
Notes:
The property name is invalid if it contains any of the following characters: —
[] (left or right square bracket)
= (equals sign)
: (colon)
. (dot)
, (comma)
|
|
TBool IsValidParameterValue(TInt& aPos,const TDesC& aParamValue) const;
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)
|
|
Imported property values are always in ASCII unless the encoding format is stated in the preceding property parameter. Hence the default character set is not used for internalising Versit objects.
The only exception to this behaviour is when the default character set is specified to be UTF-7. In this case ALL property values are written in UTF-7 — even if they could be represented in ASCII.
Versit first attempts to encode property values using the ASCII character set. If a value cannot be represented in ASCII then Versit attempts to encode the value using the default character set. If this character set is also incapable of representing the property value, then UTF-8 is used.
Versit property names and property parameters are always exported using the ASCII character set. However property values may be exported using other character sets/transformation formats.
const CVersitParser::TVersitCharSet DefaultCharSet() const;
Supported from 5.1
Gets the default character set or transformation format. This may be used to encode property values in versit objects.
Notes:
ASCII is used to encode property values whenever possible. When ASCII isn’t capable of representing a property value, then the default character set is used. If this is not able to represent the value then UTF-8 is used.
If the format is set to UTF-7 then all property values are written using UTF-7.
The default character set is not used when internalising versit objects.
|
void SetDefaultCharSet(const CVersitParser::TVersitCharSet aCharSet);
Supported from 5.1
Sets the default character set or transformation format. This may be used to encode property values in versit objects.
Notes:
ASCII is used to encode property values whenever possible. When ASCII isn’t capable of representing a property value, then the default character set is used. If this is not able to represent the value then UTF-8 is used.
If the format is set to UTF-7 then all property values are written using UTF-7.
The default character set is not used when internalising versit objects.
|
void SetParamCharType(TUid aTokenUid);
Supported from 5.1
Converts a versit-specific UID value that represents a character set into
a versit character set enumeration value (see
CVersitParser::TVersitCharSet
) and sets it as the character set
for the property currently being parsed (overrides the parser's default
character set). This function is called by the parser when parsing a property
which contains the charset property parameter.
|
const CVersitParser::TVersitEncoding DefaultEncoding() const;
Supported from 5.1
Gets the parser's default character encoding, as set by
SetDefaultEncoding()
. This value is initialised on construction to
ENoEncoding
.
|
void SetDefaultEncoding(const CVersitParser::TVersitEncoding aEncoding);
Supported from 5.1
Sets the parser's default character encoding.
|
TVersitCharSet
Supported from 5.1
Versit-specific character set identifiers. These are used in the Versit API to represent foreign (non-Unicode) character set encodings for vCard and vCalendar properties.
|