|
1 /* |
|
2 * Copyright (c) 2003 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. |
|
4 * This component and the accompanying materials are made available |
|
5 * under the terms of "Eclipse Public License v1.0" |
|
6 * which accompanies this distribution, and is available |
|
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 * |
|
9 * Initial Contributors: |
|
10 * Nokia Corporation - initial contribution. |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: |
|
15 * A simple XML writer that implements |
|
16 * the XML writer interface. |
|
17 * |
|
18 */ |
|
19 |
|
20 |
|
21 #ifndef __XW_IMPL__ |
|
22 #define __XW_IMPL__ |
|
23 |
|
24 #include <e32base.h> |
|
25 #include "XwApi.h" |
|
26 |
|
27 /** |
|
28 * A simple XML writer that implements |
|
29 * the XML writer interface. |
|
30 */ |
|
31 class CXmlWriter : public CBase, public MXmlWriter |
|
32 { |
|
33 public: // Construction and destruction |
|
34 IMPORT_C static CXmlWriter* NewL(); |
|
35 IMPORT_C static CXmlWriter* NewLC(); |
|
36 IMPORT_C virtual ~CXmlWriter(); |
|
37 |
|
38 private: // Construction |
|
39 CXmlWriter(); |
|
40 void ConstructL(); |
|
41 |
|
42 public: // MXmlWriter methods |
|
43 IMPORT_C void AddPrologL(); |
|
44 IMPORT_C void AddPrologL(const TDesC8& aVersionNum); |
|
45 IMPORT_C void AddStartTagL(const TDesC8& aName); |
|
46 IMPORT_C void OpenStartTagL(const TDesC8& aName); |
|
47 IMPORT_C void AddAttributeL(const TDesC8& aName, const TDesC8& aValue); |
|
48 IMPORT_C void CloseStartTagL(TBool aEndElement); |
|
49 IMPORT_C void AddTextL(const TDesC8& aText); |
|
50 IMPORT_C void AddXmlTextL(const TDesC8& aText); |
|
51 IMPORT_C void AddEndTagL(const TDesC8& aName); |
|
52 IMPORT_C void AddCdataSectL(const TDesC8& aText); |
|
53 IMPORT_C void InsertTextL(TInt aPos, const TDesC8& aText); |
|
54 IMPORT_C void InsertXmlTextL(TInt aPos, const TDesC8& aText); |
|
55 IMPORT_C TInt Length(); |
|
56 IMPORT_C TPtrC8 DocPart(TInt aStartPos, TInt aEndPos); |
|
57 IMPORT_C void Reset(); |
|
58 |
|
59 private: |
|
60 void CheckSpaceL(const TInt aSpace); |
|
61 void CheckSpaceL(const TDesC8& aText); |
|
62 void CheckSpaceL(const TDesC8& aText1, const TDesC8& aText2); |
|
63 void CheckTempBufSpaceL(const TInt aSpace); |
|
64 void InsertEntitiesL(); |
|
65 |
|
66 private: |
|
67 TPtrC8 iDoc; |
|
68 |
|
69 HBufC8* iBuffer; |
|
70 TPtr8 iBufferPtr; |
|
71 |
|
72 HBufC8* iTempBuffer; |
|
73 TPtr8 iTempBufferPtr; |
|
74 }; |
|
75 |
|
76 #endif // __XPP_IMPL__ |