|
1 // Copyright (c) 2007-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 /* |
|
17 This test provides an example of how to configure Versit parser to internalize vFormat data that |
|
18 contains multi-line base64 data which does not conform to the standard line termination. That |
|
19 is, there is neither blank line at the end nor leading spaces at each line, e.g. |
|
20 |
|
21 BEGIN:VCARD |
|
22 LOGO;VALUE=uri;ENCODING=BASE64: |
|
23 aHR0cDovL2ltYWdlLmV4Y2l0ZS5jby5qcC9qcC93b3JsZC93b3JsZF9oZWFkZXIu |
|
24 Z2lm |
|
25 LOGO;VALUE=uri;ENCODING=BASE64:aHR0cDovL2ltYWdlLmV4Y2l0ZS5jby5qcC9qcC93b3JsZC93b3JsZF9oZWFkZXIu |
|
26 Z2lm |
|
27 LOGO;VALUE=uri;ENCODING=BASE64:aHR0cDovL2ltYWdlLmV4Y2l0ZS5jby5qcC9qcC93b3JsZC93b3JsZF9oZWFkZXIu |
|
28 Z2lm |
|
29 END:VCARD |
|
30 |
|
31 In order for versit to detect the end of the property LOGO above, the client needs |
|
32 |
|
33 1. Derive your extension interface from MVersitPlugIn and MVersitPlugInExtensionBase64Ending |
|
34 2. Implement the virtual functions of basic MVersitPlugIn and the extension interface MVersitPlugInExtensionBase64Ending. |
|
35 particularly, BlankLineAndLeadingSpaceNotRequired should return ETrue. |
|
36 3. Set your plugin via API CVersitParser::SetPlugIn(MVersitPlugIn* aPlugIn) |
|
37 4. Call API CVersitParser::InternalizeL to internalize the data as usual. |
|
38 |
|
39 */ |
|
40 |
|
41 #include "base64extension.h" |
|
42 |
|
43 //Returns the interface |
|
44 void CTestVersitExtension::GetInterface(TUid aInterfaceUid, TAny*& aInterface) |
|
45 /** Returns interface extension. */ |
|
46 { |
|
47 if (aInterfaceUid == KUidVersitPluginExtensionBase64Termination) |
|
48 { |
|
49 aInterface = static_cast<MVersitPlugInExtensionBase64Ending*>(this); |
|
50 } |
|
51 } |
|
52 |
|
53 //Implementation of the extension interface interface MVersitPlugInExtensionBase64Ending |
|
54 |
|
55 CTestVersitExtension* CTestVersitExtension::NewL() |
|
56 { |
|
57 CTestVersitExtension* self = new(ELeave) CTestVersitExtension; |
|
58 return self; |
|
59 } |
|
60 |
|
61 TBool CTestVersitExtension::BlankLineAndLeadingSpaceNotRequired() |
|
62 { |
|
63 return ETrue; |
|
64 } |
|
65 |
|
66 //Implementation of basic plugin interface MVersitPlugIn |
|
67 TBool CTestVersitExtension::AddSpace() |
|
68 {//Default behaviour |
|
69 return ETrue; |
|
70 } |
|
71 |
|
72 TBool CTestVersitExtension::DeleteAllSpaces() |
|
73 {//Default behaviour |
|
74 return ETrue; |
|
75 } |
|
76 |
|
77 TBool CTestVersitExtension::NeedsBlankLine() |
|
78 {//This doesn't take effect if BlankLineAndLeadingSpaceNotRequired returns ETrue |
|
79 return EFalse; |
|
80 } |
|
81 |
|
82 void CTestVersitExtension::RemoveEscaping(TPtr16& /*aText*/) |
|
83 {//Default behaviour |
|
84 } |
|
85 |
|
86 void CTestVersitExtension::AddEscaping(HBufC16*& /*aText*/) |
|
87 {//Default behaviour |
|
88 } |
|
89 |
|
90 TBool CTestVersitExtension::WrapLine(RWriteStream& /*aStream*/, TInt& /*aCurrentLineLength*/, const TPtr8& /*aText*/) |
|
91 {//Default behaviour |
|
92 return EFalse; |
|
93 } |
|
94 |
|
95 TBool CTestVersitExtension::EncodingType(Versit::TVersitEncoding& /*aEncoding*/, TBool /*aRequiresEncoding*/, |
|
96 Versit::TVersitEncoding /*aDefaultEncoding*/, TUid /*aPropertyUid*/, TUint /*aPropertyCharsetId*/) |
|
97 {//Default behaviour |
|
98 return EFalse; |
|
99 } |
|
100 |
|
101 const TDesC8& CTestVersitExtension::EncodingName(Versit::TVersitEncoding /*aEncoding*/) |
|
102 {//Default behaviour |
|
103 return KNullDesC8; |
|
104 } |
|
105 |
|
106 |