1.1 --- a/epoc32/include/vobserv.h Tue Mar 16 16:12:26 2010 +0000
1.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
1.3 @@ -1,257 +0,0 @@
1.4 -// Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies).
1.5 -// All rights reserved.
1.6 -// This component and the accompanying materials are made available
1.7 -// 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.8 -// which accompanies this distribution, and is available
1.9 -// at the URL "http://www.symbianfoundation.org/legal/licencesv10.html".
1.10 -//
1.11 -// Initial Contributors:
1.12 -// Nokia Corporation - initial contribution.
1.13 -//
1.14 -// Contributors:
1.15 -//
1.16 -// Description:
1.17 -//
1.18 -
1.19 -#ifndef __VOBSERV_H__
1.20 -#define __VOBSERV_H__
1.21 -
1.22 -#ifndef __E32DEF_H__
1.23 -#include <e32def.h>
1.24 -#endif
1.25 -#ifndef __E32STD_H__
1.26 -#include <e32std.h>
1.27 -#endif
1.28 -#ifndef __E32DES16_H__
1.29 -#include <e32des16.h>
1.30 -#endif
1.31 -#ifndef __S32STRM_H__
1.32 -#include <s32strm.h>
1.33 -#endif
1.34 -#ifndef __VUTIL_H__
1.35 -#include <vutil.h>
1.36 -#endif
1.37 -
1.38 -class CVersitParser;
1.39 -
1.40 -class MVersitObserver
1.41 -/** A Versit parser observer.
1.42 -
1.43 -This is a plug-in class and contains only pure virtual functions.
1.44 -
1.45 -An implementator of this class can find out the version number of an entity
1.46 -being parsed. The version number specifies the version of the vCard/vCalendar
1.47 -specification used by the data of the vCard/vCalendar. This is for use in
1.48 -conjunction with the MVersitPlugin class, which adjusts the parser's behaviour
1.49 -according to the vCard/vCalendar version.
1.50 -
1.51 -An implementator of this class can also respond to the creation of a new parser
1.52 -for an embedded sub-entity. This is so that the observer can set the MVersitPlugin,
1.53 -as well as itself, for each new parser that is created.
1.54 -
1.55 -An observer is set up for a Versit parser using CVersitParser::SetObserver().
1.56 -@publishedAll
1.57 -@released
1.58 -*/
1.59 - {
1.60 -public:
1.61 - /** Called when the version property (a property of the name KVersitTokenVERSION)
1.62 - of an entity is parsed during internalisation of a stream, if the Versit parser
1.63 - has an observer.
1.64 -
1.65 - An implementation of this function can determine the version of an entity
1.66 - being parsed.
1.67 -
1.68 - Called by CVersitParser::ParsePropertiesL().
1.69 -
1.70 - @param aParser A pointer to the parser object that detected the version.
1.71 - @param aVersion A unicode string containing the version number detected. */
1.72 - virtual void VersionSet(CVersitParser* aParser,const TDesC16& aVersion)=0;
1.73 - /** Called when a new Versit parser is created to parse an embedded object,
1.74 - specifically a vEvent, a vTodo or an agent, if the Versit parser has an observer.
1.75 -
1.76 - @param aParser The newly created Versit entity. */
1.77 - virtual void NewParser(CVersitParser* aParser)=0;
1.78 -private:
1.79 - IMPORT_C virtual void Reserved1();
1.80 - IMPORT_C virtual void Reserved2();
1.81 - };
1.82 -
1.83 -class MVersitPlugIn
1.84 -/** A Versit parser plug-in.
1.85 -
1.86 -This is a plug-in class and contains only pure virtual functions.
1.87 -
1.88 -An implementator of this class can override some of the low level behaviour
1.89 -of a Versit parser. For instance, options are provided to determine behaviour
1.90 -during line wrapping and unwrapping.
1.91 -
1.92 -The use of this plug-in is optional, and when there is no plug-in the parser
1.93 -object will use default behaviour. However, vCard v3.0 has some differences
1.94 -to vCard v2.1, such as for line wrapping and unwrapping. Symbian OS supports
1.95 -vCard v2.1 in its default behaviour. Therefore this plug-in can be used to
1.96 -provide compatibility with vCard v3.0.
1.97 -@publishedAll
1.98 -@released
1.99 -*/
1.100 - {
1.101 -public:
1.102 - /** Tests whether a space is to be added when merging (unwrapping) two lines
1.103 - while internalising a stream.
1.104 -
1.105 - If there is no plug-in then a space will be added.
1.106 -
1.107 - Used by the CLineReader class.
1.108 -
1.109 - @return ETrue if a space is to be added and EFalse if not. */
1.110 - virtual TBool AddSpace()=0; //Unwrapping lines
1.111 - /** Tests whether white space at the start of a line, apart from the first space,
1.112 - forms part of the data when internalising a stream.
1.113 -
1.114 - Note that the first space is always ignored and never included.
1.115 -
1.116 - If there is no plug-in then the rest of the white space at the start of a
1.117 - line (tabs and spaces) is skipped and does not form part of the data when
1.118 - internalising a stream.
1.119 -
1.120 - Used by the CLineReader class.
1.121 -
1.122 - @return EFalse if the spaces are to be part of the data and ETrue if not. */
1.123 - virtual TBool DeleteAllSpaces()=0; //Unwrapping lines
1.124 - /** Tests how the end of Base64 data (data encoded using Versit::EBase64Encoding)
1.125 - should be detected when internalising a stream.
1.126 -
1.127 - To determine the end of Base64 data, either a blank line can be used, or a line
1.128 - without a space at the start.
1.129 -
1.130 - If there is no plug-in then a blank line will be looked for.
1.131 -
1.132 - Used by the CVersitParser class.
1.133 -
1.134 - @return ETrue if a blank line should be used and EFalse if a line without
1.135 - a space at the start should be used. */
1.136 - virtual TBool NeedsBlankLine()=0; //Unwrapping Base64 data
1.137 - /** Allows the removal of escape characters from a property value when internalising
1.138 - from a stream.
1.139 -
1.140 - Versit deals with the escaping of semi-colons and the escape character itself
1.141 - (that is, the Yen character for Shift-JIS or a backslash for other character
1.142 - sets) without the help of a plug-in. Other characters, such as commas and
1.143 - carriage returns, can be escaped and un-escaped using the plug-in's AddEscaping()
1.144 - and RemoveEscaping().
1.145 -
1.146 - This function is needed as escaping is done differently in vCard v3.0: firstly,
1.147 - commas are used as syntactical characters and so need to be escaped when they
1.148 - are just part of the text; secondly, \\r\\n in plain (un-encoded) text is used
1.149 - to mean a CRLF, whereas v2.1 forces you to use Quoted Printble encoding if
1.150 - there is a CRLF in the data.
1.151 -
1.152 - Note that, although the string passed into this function can be changed, it
1.153 - must not be made longer.
1.154 -
1.155 - Used by the CVersitParser class.
1.156 -
1.157 - @param aText The property value text from which escape characters are to be
1.158 - removed. */
1.159 - virtual void RemoveEscaping(TPtr16& aText)=0;
1.160 - /** Allows the addition of escape characters to a property value when externalising
1.161 - to a stream.
1.162 -
1.163 - Versit deals with the escaping of semi-colons and the escape character itself
1.164 - (that is, the Yen character for Shift-JIS or a backslash for other character
1.165 - sets) without the help of a plug-in. Other characters, such as commas and
1.166 - carriage returns, can be escaped and un-escaped using the plug-in's RemoveEscaping()
1.167 - and AddEscaping().
1.168 -
1.169 - This function is needed as escaping is done differently in vCard v3.0: firstly,
1.170 - commas are used as syntactical characters and so need to be escaped when they
1.171 - are just part of the text; secondly, \\r\\n in plain (un-encoded) text is used
1.172 - to mean a CRLF, whereas v2.1 forces you to use Quoted Printble encoding if
1.173 - there is a CRLF in the data.
1.174 -
1.175 - If the string passed into this function needs to be made longer, then this
1.176 - should be done with the following command, otherwise the cleanup stack will
1.177 - eventually panic:
1.178 -
1.179 - @code
1.180 - aText=aText->ReAllocL(newSize);
1.181 - @endcode
1.182 -
1.183 - Used by the CParserPropertyValue class.
1.184 -
1.185 - @param aText The property value text to which escape characters are to be
1.186 - added. */
1.187 - virtual void AddEscaping(HBufC16*& aText)=0;
1.188 - /** Determines how an unencoded property value should be wrapped when externalising
1.189 - to a stream.
1.190 -
1.191 - If there is no plug-in then line wrapping will follow vCal v1.0 and vCard
1.192 - v2.1 wrapping rules. In this case, the text is split into lines with a maximum
1.193 - length of KMaxExternalizedTokenLength (70) characters, and two spaces are inserted
1.194 - at the beginning of each new line.
1.195 -
1.196 - Used by the CParserPropertyValue class.
1.197 -
1.198 - @param aStream The stream to write the text to.
1.199 - @param aCurrentLineLength The number of characters already written to the current
1.200 - line, which needs to be taken into account when calculating where the next
1.201 - line break should occur. This value should be updated before returning.
1.202 - @param aText The property value text to write to the stream, in the correct
1.203 - character set and encoded as necessary.
1.204 - @return ETrue if the property value is wrapped using the method defined in
1.205 - this (overloaded) function. EFalse if the property value text is not wrapped
1.206 - by this function (in which case the default wrapping rules are implemented). */
1.207 - virtual TBool WrapLine(RWriteStream& aStream,TInt& aCurrentLineLength,const TPtr8& aText)=0;
1.208 - /** Determines how property values are encoded when externalising a property to
1.209 - a stream.
1.210 -
1.211 - This function is called for each property in turn and can specify how encoding
1.212 - should be implemented for the value of that property.
1.213 -
1.214 - If there is no plug-in, or this function returns EFalse, then the default
1.215 - rules are used to determine how each property value is encoded.
1.216 -
1.217 - Used by the CVersitParser plug-in when externalising a property.
1.218 -
1.219 - @param aEncoding On return, specifies the encoding type used.
1.220 - @param aRequiresEncoding ETrue if encoding is required. This is the case if
1.221 - either the default encoding is not Versit::ENoEncoding, or if the property
1.222 - value contains characters that cannot be written out directly (e.g. equals,
1.223 - CR, LF, tab or non-ASCII characters).
1.224 - @param aDefaultEncoding The default encoding specifed by the user of the parser.
1.225 - @param aPropertyUid The property UID of the property being externalised. These are
1.226 - defined in vuid.h.
1.227 - @param aPropertyCharsetId The character set UID of the character set being
1.228 - used to output the property.
1.229 - @return ETrue if the encoding type to be used is defined in this (overloaded)
1.230 - function. EFalse if this function does not determine the encoding type (in
1.231 - which case Versit's default method is used to decide the encoding type). */
1.232 - virtual TBool EncodingType(Versit::TVersitEncoding& aEncoding,TBool aRequiresEncoding,Versit::TVersitEncoding aDefaultEncoding
1.233 - ,TUid aPropertyUid,TUint aPropertyCharsetId)=0;
1.234 - /** Returns the encoding name to be used for a specified encoding type when externalising
1.235 - a property to a stream, or allows the default name to be used.
1.236 -
1.237 - Can override the default name Versit would select if there was no plug-in ("BASE64",
1.238 - "QUOTED-PRINTABLE", "8-BIT").
1.239 -
1.240 - The default names are selected using VersitUtils::IANAEncodingName().
1.241 -
1.242 - Used by the CVersitParser class when externalising a property.
1.243 -
1.244 - @param aEncoding The encoding type the name is required for.
1.245 - @return The name to use for the encoding type, or a zero length descriptor
1.246 - if the default name should be used. */
1.247 - virtual const TDesC8& EncodingName(Versit::TVersitEncoding aEncoding)=0;
1.248 -
1.249 - /** Returns a pointer to a specified interface extension - to allow future extension
1.250 - of this class without breaking binary compatibility
1.251 -
1.252 - @param aInterfaceUid Identifier of the interface to be retrieved
1.253 - @param aInterface A reference to a pointer that retrieves the specified interface.
1.254 - */
1.255 - IMPORT_C virtual void GetInterface(TUid aInterfaceUid, TAny*& aInterface);
1.256 -private:
1.257 - IMPORT_C virtual void Reserved2();
1.258 - };
1.259 -
1.260 -#endif