|
1 // Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies). |
|
2 // All rights reserved. |
|
3 // This component and the accompanying materials are made available |
|
4 // under the terms of "Eclipse Public License v1.0" |
|
5 // which accompanies this distribution, and is available |
|
6 // at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
7 // |
|
8 // Initial Contributors: |
|
9 // Nokia Corporation - initial contribution. |
|
10 // |
|
11 // Contributors: |
|
12 // |
|
13 // Description: |
|
14 // |
|
15 |
|
16 #ifndef __VPBAPPLUGIN_H__ |
|
17 #define __VPBAPPLUGIN_H__ |
|
18 |
|
19 #ifndef __VOBSERV_H__ |
|
20 #include <vobserv.h> |
|
21 #endif |
|
22 |
|
23 #include <e32base.h> |
|
24 |
|
25 /** Extension interface UID */ |
|
26 const TUid KUidVersitPlugInExtension = {0xA0001B18}; |
|
27 |
|
28 |
|
29 /** |
|
30 Provides an extension to the MVersitPlugIn interface to allow further |
|
31 modification of Versit low level formatting so that a parser compliant with the |
|
32 vCard 3.0 (RFC2426) and iCalendar (RFC2445) specifications can be created. |
|
33 |
|
34 Implementation of this interface is optional. Parser behaviour is not modified |
|
35 if the function MVersitPlugIn::GetInterface() has not been implemented or does |
|
36 not return an instance of a class implementing this interface when passed the |
|
37 Uid parameter value KUidVersitPlugInExtension. |
|
38 |
|
39 @internalComponent |
|
40 @released |
|
41 */ |
|
42 class MVersitPlugInExtension |
|
43 { |
|
44 public: |
|
45 /** Allows automatic CHARSET parameter export to be disabled |
|
46 |
|
47 This function is needed because vCard 3.0 doesnot support the CHARSET parameter. |
|
48 Character set encodings are defined in an enclosing MIME header and apply to the |
|
49 whole vCard. |
|
50 |
|
51 If there is no plug-in then the CHARSET parameter will be exported as required for |
|
52 vCard 2.1 and vCal 1.0 |
|
53 |
|
54 @return ETrue if the CHARSET parameter should not be exported |
|
55 */ |
|
56 virtual TBool DisableCharsetParam() = 0; |
|
57 |
|
58 /** Determines how a binary property value should be wrapped when externalising to a stream. |
|
59 |
|
60 If there is no plug-in then line wrapping will follow vCal v1.0 and vCard v2.1 wrapping rules. |
|
61 In this case, the text is split into lines with a maximum length of KBase64MaxLineLength (64) |
|
62 characters, and two spaces are inserted at the beginning of each new line. |
|
63 |
|
64 @param aCurrentLineLength The number of characters already written to the current |
|
65 line, which needs to be taken into account when calculating where the next |
|
66 line break should occur. This value should be updated before returning. |
|
67 @param aBuffer The encoded binary property value |
|
68 @return ETrue if the property value is wrapped using the method defined in |
|
69 this (overloaded) function. EFalse if the property value is not wrapped |
|
70 by this function (in which case the default wrapping rules are implemented) |
|
71 */ |
|
72 virtual TBool WrapBinaryLinesL(CBufBase& aBuffer, TInt& aCurrentLineLength) = 0; |
|
73 |
|
74 /** Allows removal of the blank line automatically inserted after binary property values |
|
75 |
|
76 This function is needed because vCard 3.0 doesnot require a blank line to determine the |
|
77 end of encoded binary data |
|
78 |
|
79 If there is no plug-in then a blank line will be added |
|
80 |
|
81 @return ETrue if a blank line should not be added after a binary value |
|
82 */ |
|
83 virtual TBool DisableBlankLineAfterBinaryValue() = 0; |
|
84 |
|
85 /** Performs folding of property parameters when externalising to a stream. |
|
86 |
|
87 This function is needed because vCard 3.0 supports folding of property parameters. |
|
88 |
|
89 If there is no plug-in then folding will follow vCard v2.1(folding parameters is optional) |
|
90 and vCal v1.0 where only folding of property value is supported. |
|
91 |
|
92 @return ETrue if property parameters need folding |
|
93 */ |
|
94 virtual TBool FoldParam() = 0; |
|
95 }; |
|
96 |
|
97 NONSHARABLE_CLASS(CVCard3ParserPlugIn) : public CBase, public MVersitPlugIn, public MVersitPlugInExtension |
|
98 /** |
|
99 Enables vCard 3.0 format export as defined by rfc2425 and rfc2426 |
|
100 @internalComponent |
|
101 @released |
|
102 */ |
|
103 { |
|
104 public: //from MVersitPlugIn |
|
105 virtual TBool AddSpace(); |
|
106 virtual TBool DeleteAllSpaces(); |
|
107 virtual TBool NeedsBlankLine(); |
|
108 virtual void RemoveEscaping(TPtr16& aText); |
|
109 virtual void AddEscaping(HBufC16*& aText); |
|
110 virtual TBool WrapLine(RWriteStream& aStream, TInt& aCurrentLineLength, const TPtr8& aText); |
|
111 virtual TBool EncodingType(Versit::TVersitEncoding& aEncoding, TBool aRequiresEncoding, |
|
112 Versit::TVersitEncoding aDefaultEncoding, TUid aPropertyUid, TUint aPropertyCharsetId); |
|
113 virtual const TDesC8& EncodingName(Versit::TVersitEncoding aEncoding); |
|
114 virtual void GetInterface(TUid aInterfaceUid, TAny*& aInterface); |
|
115 |
|
116 public: //from MVersitPlugInExtension |
|
117 virtual TBool DisableCharsetParam(); |
|
118 virtual TBool DisableBlankLineAfterBinaryValue(); |
|
119 virtual TBool WrapBinaryLinesL(CBufBase& aBuffer, TInt& aCurrentLineLength); |
|
120 virtual TBool FoldParam(); |
|
121 |
|
122 private: |
|
123 void DoWrapLineL(RWriteStream& aStream, TInt& aCurrentLineLength, const TPtr8& aText); |
|
124 }; |
|
125 |
|
126 #endif //__VPBAPPLUGIN_H__ |