|
1 /* |
|
2 * Copyright (c) 2004 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: SyncML document generator class. |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #ifndef __WBXMLSYNCMLGENERATOR_H__ |
|
20 #define __WBXMLSYNCMLGENERATOR_H__ |
|
21 |
|
22 // ------------------------------------------------------------------------------------------------ |
|
23 // Includes |
|
24 // ------------------------------------------------------------------------------------------------ |
|
25 |
|
26 #include "WBXMLGenerator.h" |
|
27 |
|
28 // ------------------------------------------------------------------------------------------------ |
|
29 // Toolkit includes |
|
30 // ------------------------------------------------------------------------------------------------ |
|
31 #include "smldef.h" |
|
32 #include "smldtd.h" |
|
33 #include "smlmetinfdtd.h" |
|
34 #include "smldevinfdtd.h" |
|
35 |
|
36 // ------------------------------------------------------------------------------------------------ |
|
37 // Constants |
|
38 // ------------------------------------------------------------------------------------------------ |
|
39 const TInt KNSmlBufferSafeTreshold = 8; |
|
40 |
|
41 // ------------------------------------------------------------------------------------------------ |
|
42 // CNSmlSyncMLGenerator |
|
43 // ------------------------------------------------------------------------------------------------ |
|
44 class CWBXMLSyncMLGenerator : public CWBXMLGenerator |
|
45 { |
|
46 public: |
|
47 IMPORT_C CWBXMLSyncMLGenerator( TInt32 aPublicId ); //1.2 CHANGES: publicId |
|
48 |
|
49 IMPORT_C void CreateWorkspaceL( TInt aBufferSize ); |
|
50 |
|
51 IMPORT_C Ret_t smlStartMessage( SmlSyncHdrPtr_t aContent ); |
|
52 IMPORT_C Ret_t smlEndMessage( Boolean_t aFinal ); |
|
53 |
|
54 IMPORT_C Ret_t smlStartSync( SmlSyncPtr_t aContent ); |
|
55 IMPORT_C Ret_t smlEndSync(); |
|
56 |
|
57 IMPORT_C Ret_t smlAddCmd( SmlAddPtr_t aContent ); |
|
58 IMPORT_C Ret_t smlReplaceCmd( SmlReplacePtr_t aContent ); |
|
59 |
|
60 IMPORT_C Ret_t smlCopyCmd( SmlCopyPtr_t aContent ); |
|
61 IMPORT_C Ret_t smlDeleteCmd( SmlDeletePtr_t aContent ); |
|
62 IMPORT_C Ret_t smlMoveCmd( SmlMovePtr_t aContent ); // 1.2 CHANGES: Move command |
|
63 IMPORT_C Ret_t smlAlertCmd( SmlAlertPtr_t aContent ); |
|
64 IMPORT_C Ret_t smlGetCmd( SmlGetPtr_t aContent ); |
|
65 IMPORT_C Ret_t smlPutCmd( SmlPutPtr_t aContent ); |
|
66 IMPORT_C Ret_t smlMapCmd( SmlMapPtr_t aContent ); |
|
67 IMPORT_C Ret_t smlResultsCmd( SmlResultsPtr_t aContent ); |
|
68 IMPORT_C Ret_t smlStatusCmd( SmlStatusPtr_t aContent ); |
|
69 |
|
70 IMPORT_C Ret_t smlStartAtomic( SmlAtomicPtr_t aContent ); |
|
71 IMPORT_C Ret_t smlEndAtomic(); |
|
72 IMPORT_C Ret_t smlStartSequence( SmlSequencePtr_t aContent ); |
|
73 IMPORT_C Ret_t smlEndSequence(); |
|
74 |
|
75 // Data chunk functionality |
|
76 IMPORT_C void SetTruncate( TBool aEnabled ); |
|
77 IMPORT_C TBool WasTruncated(); |
|
78 IMPORT_C TInt ItemIndex() const; |
|
79 IMPORT_C TInt DataConsumed() const; |
|
80 //1.2 Streaming: large item size |
|
81 IMPORT_C void SetContentLength(TInt aContentLength); |
|
82 //end changes |
|
83 private: |
|
84 |
|
85 // SyncML |
|
86 void AppendSyncHrdL( SmlSyncHdrPtr_t aContent ); |
|
87 void AppendSyncL( SmlSyncPtr_t aContent ); |
|
88 void AppendAddCmdL( SmlAddPtr_t aContent ); |
|
89 void AppendReplaceCmdL( SmlReplacePtr_t aContent ); |
|
90 void AppendCopyCmdL( SmlCopyPtr_t aContent ); |
|
91 void AppendDeleteCmdL( SmlDeletePtr_t aContent ); |
|
92 void AppendMoveCmdL( SmlMovePtr_t aContent ); //1.2 CHANGES: Move command |
|
93 void AppendAlertCmdL( SmlAlertPtr_t aContent ); |
|
94 void AppendGetCmdL( SmlGetPtr_t aContent ); |
|
95 void AppendPutCmdL( SmlPutPtr_t aContent ); |
|
96 void AppendMapCmdL( SmlMapPtr_t aContent ); |
|
97 void AppendResultsCmdL( SmlResultsPtr_t aContent ); |
|
98 void AppendStatusCmdL( SmlStatusPtr_t aContent ); |
|
99 void AppendPCDataL( TUint8 aElement, SmlPcdataPtr_t aContent, TInt aAmount = -1 ); |
|
100 void AppendPCDataListL( TUint8 aElement, SmlPcdataListPtr_t aList ); |
|
101 void AppendItemListL( SmlItemListPtr_t aList ); |
|
102 void AppendTargetL( SmlTargetPtr_t aContent ); |
|
103 void AppendSourceL( SmlSourcePtr_t aContent ); |
|
104 void AppendCredL( SmlCredPtr_t aContent ); |
|
105 void AppendTargetRefListL( SmlTargetRefListPtr_t aList ); |
|
106 void AppendSourceRefListL( SmlSourceRefListPtr_t aList ); |
|
107 void AppendChalL( SmlChalPtr_t aContent ); |
|
108 void AppendMapItemListL( SmlMapItemListPtr_t aList ); |
|
109 void AppendMapItemL( SmlMapItemPtr_t aContent ); |
|
110 void AppendItemL( SmlItemPtr_t aContent ); |
|
111 void AppendStartAtomicL( SmlAtomicPtr_t aContent ); |
|
112 void AppendStartSequenceL( SmlSequencePtr_t aContent ); |
|
113 void AppendEndAtomicL(); |
|
114 void AppendEndSequenceL(); |
|
115 void AppendStartAtomicOrSequenceL( SmlAtomicPtr_t aContent ); |
|
116 void AppendFilterL( SmlFilterPtr_t aContent ); //1.2 CHANGES: Filter support |
|
117 void AppendSourceParentL( SmlSourceParentPtr_t aContent ); //1.2 CHANGES: Source&Target parent |
|
118 void AppendTargetParentL( SmlTargetParentPtr_t aContent ); //1.2 CHANGES: Source&Target parent |
|
119 void AppendFieldL( SmlFieldPtr_t aContent ); //1.2 CHANGES: Field |
|
120 void AppendRecordL( SmlRecordPtr_t aContent ); //1.2 CHANGES: Record |
|
121 |
|
122 //1.2 CHANGES: Property |
|
123 void AppendPropParamL( SmlDevInfPropParamPtr_t aContent); |
|
124 void AppendPropParamListL( SmlDevInfPropParamListPtr_t aContent); |
|
125 void AppendPropertyL( SmlDevInfPropertyPtr_t aContent ); |
|
126 void AppendPropertyListL( SmlDevInfPropertyListPtr_t aContent ); |
|
127 //Changes end |
|
128 |
|
129 // MetInf |
|
130 void AppendMetaL( SmlPcdataPtr_t aContent ); |
|
131 void AppendMetaL( SmlMetInfMetInfPtr_t aMeta ); |
|
132 void AppendMetMemL( SmlMetInfMemPtr_t aContent ); |
|
133 void AppendMetAnchorL( SmlMetInfAnchorPtr_t aContent ); |
|
134 |
|
135 // Misc |
|
136 void DoSmlStartMessageL( SmlSyncHdrPtr_t aContent ); |
|
137 void DoSmlEndMessageL( Boolean_t aFinal ); |
|
138 void DoAppendTargetL( SmlTargetPtr_t aContent ); |
|
139 void DoAppendSourceL( SmlSourcePtr_t aContent ); |
|
140 void DoAppendGenericCmdL( SmlGenericCmdPtr_t aContent, Flag_t aMask ); |
|
141 void DoAppendMetaL( SmlMetInfMetInfPtr_t aMeta ); |
|
142 void DoAppendPutGetL( SmlGetPtr_t aContent ); |
|
143 |
|
144 void AppendItemBeginL( SmlItemPtr_t aContent ); |
|
145 void AppendItemEndL( TBool aMoreData = EFalse ); |
|
146 void AppendItemDataL( SmlItemPtr_t aContent, TInt aAmount = -1 ); |
|
147 void FreeItemSizeAndMetaIfNeeded( SmlItemPtr_t aItem ); |
|
148 void DoAppendSourceOrTargetParentL(SmlSourceOrTargetParentPtr_t aContent); //1.2 CHANGES: Source & Target parent |
|
149 |
|
150 private: |
|
151 TInt32 iPublicId; //1.2 CHANGES: publicId |
|
152 TInt iItemIndex; |
|
153 TInt iDataConsumed; |
|
154 TBool iUseTruncation; |
|
155 TBool iItemWasTruncated; |
|
156 TBuf8<64> iBuffer; |
|
157 //1.2 Streaming: large item size |
|
158 TInt iContentLength; |
|
159 //end changes |
|
160 }; |
|
161 |
|
162 #endif // __WBXMLSYNCMLGENERATOR_H__ |