epoc32/include/app/vobserv.h
author William Roberts <williamr@symbian.org>
Wed, 31 Mar 2010 12:33:34 +0100
branchSymbian3
changeset 4 837f303aceeb
parent 3 e1b950c65cb4
permissions -rw-r--r--
Current Symbian^3 public API header files (from PDK 3.0.h)
This is the epoc32/include tree with the "platform" subtrees removed, and
all but a selected few mbg and rsg files removed.
williamr@2
     1
// Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies).
williamr@2
     2
// All rights reserved.
williamr@2
     3
// This component and the accompanying materials are made available
williamr@4
     4
// under the terms of "Eclipse Public License v1.0"
williamr@2
     5
// which accompanies this distribution, and is available
williamr@4
     6
// at the URL "http://www.eclipse.org/legal/epl-v10.html".
williamr@2
     7
//
williamr@2
     8
// Initial Contributors:
williamr@2
     9
// Nokia Corporation - initial contribution.
williamr@2
    10
//
williamr@2
    11
// Contributors:
williamr@2
    12
//
williamr@2
    13
// Description:
williamr@2
    14
//
williamr@2
    15
williamr@2
    16
#ifndef __VOBSERV_H__
williamr@2
    17
#define __VOBSERV_H__
williamr@2
    18
williamr@2
    19
#ifndef __E32DEF_H__
williamr@2
    20
#include <e32def.h>
williamr@2
    21
#endif
williamr@2
    22
#ifndef __E32STD_H__
williamr@2
    23
#include <e32std.h>
williamr@2
    24
#endif
williamr@2
    25
#ifndef __E32DES16_H__
williamr@2
    26
#include <e32des16.h>
williamr@2
    27
#endif
williamr@2
    28
#ifndef __S32STRM_H__
williamr@2
    29
#include <s32strm.h>
williamr@2
    30
#endif
williamr@2
    31
#ifndef __VUTIL_H__
williamr@2
    32
#include <vutil.h>
williamr@2
    33
#endif
williamr@2
    34
williamr@2
    35
class CVersitParser;
williamr@2
    36
williamr@2
    37
class MVersitObserver
williamr@2
    38
/** A Versit parser observer.
williamr@2
    39
williamr@2
    40
This is a plug-in class and contains only pure virtual functions.
williamr@2
    41
williamr@2
    42
An implementator of this class can find out the version number of an entity 
williamr@2
    43
being parsed. The version number specifies the version of the vCard/vCalendar 
williamr@2
    44
specification used by the data of the vCard/vCalendar. This is for use in 
williamr@2
    45
conjunction with the MVersitPlugin class, which adjusts the parser's behaviour 
williamr@2
    46
according to the vCard/vCalendar version.
williamr@2
    47
williamr@2
    48
An implementator of this class can also respond to the creation of a new parser 
williamr@2
    49
for an embedded sub-entity. This is so that the observer can set the MVersitPlugin, 
williamr@2
    50
as well as itself, for each new parser that is created.
williamr@2
    51
williamr@2
    52
An observer is set up for a Versit parser using CVersitParser::SetObserver(). 
williamr@2
    53
@publishedAll
williamr@2
    54
@released
williamr@2
    55
*/
williamr@2
    56
	{
williamr@2
    57
public:
williamr@2
    58
	/** Called when the version property (a property of the name KVersitTokenVERSION) 
williamr@2
    59
	of an entity is parsed during internalisation of a stream, if the Versit parser 
williamr@2
    60
	has an observer.
williamr@2
    61
	
williamr@2
    62
	An implementation of this function can determine the version of an entity 
williamr@2
    63
	being parsed.
williamr@2
    64
	
williamr@2
    65
	Called by CVersitParser::ParsePropertiesL().
williamr@2
    66
	
williamr@2
    67
	@param aParser A pointer to the parser object that detected the version.
williamr@2
    68
	@param aVersion A unicode string containing the version number detected. */
williamr@2
    69
	virtual void VersionSet(CVersitParser* aParser,const TDesC16& aVersion)=0;
williamr@2
    70
	/** Called when a new Versit parser is created to parse an embedded object, 
williamr@2
    71
	specifically a vEvent, a vTodo or an agent, if the Versit parser has an observer.
williamr@2
    72
	
williamr@2
    73
	@param aParser The newly created Versit entity. */
williamr@2
    74
	virtual void NewParser(CVersitParser* aParser)=0;
williamr@2
    75
private:
williamr@2
    76
	IMPORT_C virtual void Reserved1();
williamr@2
    77
	IMPORT_C virtual void Reserved2();
williamr@2
    78
	};
williamr@2
    79
williamr@2
    80
class MVersitPlugIn
williamr@2
    81
/** A Versit parser plug-in.
williamr@2
    82
williamr@2
    83
This is a plug-in class and contains only pure virtual functions.
williamr@2
    84
williamr@2
    85
An implementator of this class can override some of the low level behaviour 
williamr@2
    86
of a Versit parser. For instance, options are provided to determine behaviour 
williamr@2
    87
during line wrapping and unwrapping.
williamr@2
    88
williamr@2
    89
The use of this plug-in is optional, and when there is no plug-in the parser 
williamr@2
    90
object will use default behaviour. However, vCard v3.0 has some differences 
williamr@2
    91
to vCard v2.1, such as for line wrapping and unwrapping. Symbian OS supports 
williamr@2
    92
vCard v2.1 in its default behaviour. Therefore this plug-in can be used to 
williamr@2
    93
provide compatibility with vCard v3.0. 
williamr@2
    94
@publishedAll
williamr@2
    95
@released
williamr@2
    96
*/
williamr@2
    97
	{
williamr@2
    98
public:
williamr@2
    99
	/** Tests whether a space is to be added when merging (unwrapping) two lines 
williamr@2
   100
	while internalising a stream. 
williamr@2
   101
	
williamr@2
   102
	If there is no plug-in then a space will be added.
williamr@2
   103
	
williamr@2
   104
	Used by the CLineReader class.
williamr@2
   105
	
williamr@2
   106
	@return ETrue if a space is to be added and EFalse if not. */
williamr@2
   107
	virtual TBool AddSpace()=0;				//Unwrapping lines
williamr@2
   108
	/** Tests whether white space at the start of a line, apart from the first space, 
williamr@2
   109
	forms part of the data when internalising a stream.
williamr@2
   110
	
williamr@2
   111
	Note that the first space is always ignored and never included.
williamr@2
   112
	
williamr@2
   113
	If there is no plug-in then the rest of the white space at the start of a 
williamr@2
   114
	line (tabs and spaces) is skipped and does not form part of the data when 
williamr@2
   115
	internalising a stream.
williamr@2
   116
	
williamr@2
   117
	Used by the CLineReader class.
williamr@2
   118
	
williamr@2
   119
	@return EFalse if the spaces are to be part of the data and ETrue if not. */
williamr@2
   120
	virtual TBool DeleteAllSpaces()=0;		//Unwrapping lines
williamr@2
   121
	/** Tests how the end of Base64 data (data encoded using Versit::EBase64Encoding) 
williamr@2
   122
	should be detected when internalising a stream. 
williamr@2
   123
	
williamr@2
   124
	To determine the end of Base64 data, either a blank line can be used, or a line 
williamr@2
   125
	without a space at the start.
williamr@2
   126
	
williamr@2
   127
	If there is no plug-in then a blank line will be looked for. 
williamr@2
   128
	
williamr@2
   129
	Used by the CVersitParser class.
williamr@2
   130
	
williamr@2
   131
	@return ETrue if a blank line should be used and EFalse if a line without 
williamr@2
   132
	a space at the start should be used. */
williamr@2
   133
	virtual TBool NeedsBlankLine()=0;		//Unwrapping Base64 data
williamr@2
   134
	/** Allows the removal of escape characters from a property value when internalising 
williamr@2
   135
	from a stream.
williamr@2
   136
	
williamr@2
   137
	Versit deals with the escaping of semi-colons and the escape character itself 
williamr@2
   138
	(that is, the Yen character for Shift-JIS or a backslash for other character 
williamr@2
   139
	sets) without the help of a plug-in. Other characters, such as commas and 
williamr@2
   140
	carriage returns, can be escaped and un-escaped using the plug-in's AddEscaping() 
williamr@2
   141
	and RemoveEscaping().
williamr@2
   142
	
williamr@2
   143
	This function is needed as escaping is done differently in vCard v3.0: firstly, 
williamr@2
   144
	commas are used as syntactical characters and so need to be escaped when they 
williamr@2
   145
	are just part of the text; secondly, \\r\\n in plain (un-encoded) text is used 
williamr@2
   146
	to mean a CRLF, whereas v2.1 forces you to use Quoted Printble encoding if 
williamr@2
   147
	there is a CRLF in the data.
williamr@2
   148
	
williamr@2
   149
	Note that, although the string passed into this function can be changed, it 
williamr@2
   150
	must not be made longer.
williamr@2
   151
	
williamr@2
   152
	Used by the CVersitParser class.
williamr@2
   153
	
williamr@2
   154
	@param aText The property value text from which escape characters are to be 
williamr@2
   155
	removed. */
williamr@2
   156
	virtual void RemoveEscaping(TPtr16& aText)=0;
williamr@2
   157
	/** Allows the addition of escape characters to a property value when externalising 
williamr@2
   158
	to a stream. 
williamr@2
   159
	
williamr@2
   160
	Versit deals with the escaping of semi-colons and the escape character itself 
williamr@2
   161
	(that is, the Yen character for Shift-JIS or a backslash for other character 
williamr@2
   162
	sets) without the help of a plug-in. Other characters, such as commas and 
williamr@2
   163
	carriage returns, can be escaped and un-escaped using the plug-in's RemoveEscaping() 
williamr@2
   164
	and AddEscaping().
williamr@2
   165
	
williamr@2
   166
	This function is needed as escaping is done differently in vCard v3.0: firstly, 
williamr@2
   167
	commas are used as syntactical characters and so need to be escaped when they 
williamr@2
   168
	are just part of the text; secondly, \\r\\n in plain (un-encoded) text is used 
williamr@2
   169
	to mean a CRLF, whereas v2.1 forces you to use Quoted Printble encoding if 
williamr@2
   170
	there is a CRLF in the data.
williamr@2
   171
	
williamr@2
   172
	If the string passed into this function needs to be made longer, then this 
williamr@2
   173
	should be done with the following command, otherwise the cleanup stack will 
williamr@2
   174
	eventually panic:
williamr@2
   175
	
williamr@2
   176
	@code
williamr@2
   177
	aText=aText->ReAllocL(newSize); 
williamr@2
   178
	@endcode
williamr@2
   179
	
williamr@2
   180
	Used by the CParserPropertyValue class.
williamr@2
   181
	
williamr@2
   182
	@param aText The property value text to which escape characters are to be 
williamr@2
   183
	added. */
williamr@2
   184
	virtual void AddEscaping(HBufC16*& aText)=0;
williamr@2
   185
	/** Determines how an unencoded property value should be wrapped when externalising 
williamr@2
   186
	to a stream.
williamr@2
   187
	
williamr@2
   188
	If there is no plug-in then line wrapping will follow vCal v1.0 and vCard 
williamr@2
   189
	v2.1 wrapping rules. In this case, the text is split into lines with a maximum 
williamr@2
   190
	length of KMaxExternalizedTokenLength (70) characters, and two spaces are inserted 
williamr@2
   191
	at the beginning of each new line.
williamr@2
   192
	
williamr@2
   193
	Used by the CParserPropertyValue class.
williamr@2
   194
	
williamr@2
   195
	@param aStream The stream to write the text to.
williamr@2
   196
	@param aCurrentLineLength The number of characters already written to the current 
williamr@2
   197
	line, which needs to be taken into account when calculating where the next 
williamr@2
   198
	line break should occur. This value should be updated before returning.
williamr@2
   199
	@param aText The property value text to write to the stream, in the correct 
williamr@2
   200
	character set and encoded as necessary.
williamr@2
   201
	@return ETrue if the property value is wrapped using the method defined in 
williamr@2
   202
	this (overloaded) function. EFalse if the property value text is not wrapped 
williamr@2
   203
	by this function (in which case the default wrapping rules are implemented). */
williamr@2
   204
	virtual TBool WrapLine(RWriteStream& aStream,TInt& aCurrentLineLength,const TPtr8& aText)=0;
williamr@2
   205
	/** Determines how property values are encoded when externalising a property to 
williamr@2
   206
	a stream.
williamr@2
   207
	
williamr@2
   208
	This function is called for each property in turn and can specify how encoding 
williamr@2
   209
	should be implemented for the value of that property.
williamr@2
   210
	
williamr@2
   211
	If there is no plug-in, or this function returns EFalse, then the default 
williamr@2
   212
	rules are used to determine how each property value is encoded.
williamr@2
   213
	
williamr@2
   214
	Used by the CVersitParser plug-in when externalising a property.
williamr@2
   215
	
williamr@2
   216
	@param aEncoding On return, specifies the encoding type used.
williamr@2
   217
	@param aRequiresEncoding ETrue if encoding is required. This is the case if 
williamr@2
   218
	either the default encoding is not Versit::ENoEncoding, or if the property 
williamr@2
   219
	value contains characters that cannot be written out directly (e.g. equals, 
williamr@2
   220
	CR, LF, tab or non-ASCII characters).
williamr@2
   221
	@param aDefaultEncoding The default encoding specifed by the user of the parser.
williamr@2
   222
	@param aPropertyUid The property UID of the property being externalised. These are 
williamr@2
   223
	defined in vuid.h.
williamr@2
   224
	@param aPropertyCharsetId The character set UID of the character set being 
williamr@2
   225
	used to output the property.
williamr@2
   226
	@return ETrue if the encoding type to be used is defined in this (overloaded) 
williamr@2
   227
	function. EFalse if this function does not determine the encoding type (in 
williamr@2
   228
	which case Versit's default method is used to decide the encoding type). */
williamr@2
   229
	virtual TBool EncodingType(Versit::TVersitEncoding& aEncoding,TBool aRequiresEncoding,Versit::TVersitEncoding aDefaultEncoding
williamr@2
   230
																						,TUid aPropertyUid,TUint aPropertyCharsetId)=0;
williamr@2
   231
	/** Returns the encoding name to be used for a specified encoding type when externalising 
williamr@2
   232
	a property to a stream, or allows the default name to be used.
williamr@2
   233
	
williamr@2
   234
	Can override the default name Versit would select if there was no plug-in ("BASE64", 
williamr@2
   235
	"QUOTED-PRINTABLE", "8-BIT").
williamr@2
   236
	
williamr@2
   237
	The default names are selected using VersitUtils::IANAEncodingName().
williamr@2
   238
	
williamr@2
   239
	Used by the CVersitParser class when externalising a property.
williamr@2
   240
	
williamr@2
   241
	@param aEncoding The encoding type the name is required for.
williamr@2
   242
	@return The name to use for the encoding type, or a zero length descriptor 
williamr@2
   243
	if the default name should be used. */
williamr@2
   244
	virtual const TDesC8& EncodingName(Versit::TVersitEncoding aEncoding)=0;
williamr@2
   245
	
williamr@2
   246
	/** Returns a pointer to a specified interface extension - to allow future extension
williamr@2
   247
	of this class without breaking binary compatibility
williamr@2
   248
williamr@2
   249
	@param aInterfaceUid Identifier of the interface to be retrieved
williamr@2
   250
	@param aInterface A reference to a pointer that retrieves the specified interface.
williamr@2
   251
	*/
williamr@2
   252
	IMPORT_C virtual void GetInterface(TUid aInterfaceUid, TAny*& aInterface);
williamr@2
   253
private:
williamr@2
   254
	IMPORT_C virtual void Reserved2();
williamr@2
   255
	};
williamr@4
   256
	
williamr@4
   257
/** Extension interface UID
williamr@4
   258
@publishedAll
williamr@4
   259
@released
williamr@4
   260
*/
williamr@4
   261
const TUid KUidVersitPluginExtensionBase64Termination = {0x10285A92};
williamr@4
   262
williamr@4
   263
/**
williamr@4
   264
Provides an extension to the MVersitPlugIn interface to allow a different ending of 
williamr@4
   265
the base64 multi-lines from the default format.
williamr@4
   266
williamr@4
   267
Implementation of this interface is optional. Parser behaviour is not modified
williamr@4
   268
if the function MVersitPlugIn::GetInterface() has not been implemented or does
williamr@4
   269
not return an instance of a class implementing this interface when passed the
williamr@4
   270
Uid parameter value KUidVersitPluginExtensionBase64Termination.
williamr@4
   271
williamr@4
   272
@publishedAll
williamr@4
   273
@released
williamr@4
   274
*/
williamr@4
   275
class MVersitPlugInExtensionBase64Ending
williamr@4
   276
	{
williamr@4
   277
public:
williamr@4
   278
williamr@4
   279
	/** Allows Base64 encoding multi-lines without leading space and/or a blank line at the end
williamr@4
   280
	
williamr@4
   281
	@return ETrue, if the base64 data doesn't have leading spaces and/or a blank line at the end. The
williamr@4
   282
	versit parser will then search for ":" to determine if the next line is a continuation or a 
williamr@4
   283
	new property
williamr@4
   284
	*/
williamr@4
   285
	virtual TBool BlankLineAndLeadingSpaceNotRequired()=0;
williamr@4
   286
	};
williamr@2
   287
williamr@2
   288
#endif