|
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 parser class. |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #ifndef __WBXMLSYNCMLPARSER_H__ |
|
20 #define __WBXMLSYNCMLPARSER_H__ |
|
21 |
|
22 // ------------------------------------------------------------------------------------------------ |
|
23 // Includes |
|
24 // ------------------------------------------------------------------------------------------------ |
|
25 #include "WBXMLHandler.h" |
|
26 #include "xmlelement.h" |
|
27 #include "NSmlStack.h" |
|
28 #include "smldtd.h" |
|
29 |
|
30 // ------------------------------------------------------------------------------------------------ |
|
31 // MWBXMLSyncMLCallbacks |
|
32 // ------------------------------------------------------------------------------------------------ |
|
33 |
|
34 class MWBXMLSyncMLCallbacks |
|
35 { |
|
36 public: |
|
37 virtual Ret_t smlStartMessageFuncL( SmlSyncHdrPtr_t aContent ) = 0; |
|
38 virtual Ret_t smlEndMessageFuncL( Boolean_t final ) = 0; |
|
39 |
|
40 virtual Ret_t smlStartSyncFuncL( SmlSyncPtr_t aContent ) = 0; |
|
41 virtual Ret_t smlEndSyncFuncL() = 0; |
|
42 |
|
43 virtual Ret_t smlStartAtomicFuncL( SmlAtomicPtr_t aContent ) = 0; |
|
44 virtual Ret_t smlEndAtomicFuncL() = 0; |
|
45 |
|
46 virtual Ret_t smlStartSequenceFuncL( SmlSequencePtr_t aContent ) = 0; |
|
47 virtual Ret_t smlEndSequenceFuncL() = 0; |
|
48 |
|
49 virtual Ret_t smlAddCmdFuncL( SmlAddPtr_t aContent ) = 0; |
|
50 virtual Ret_t smlAlertCmdFuncL( SmlAlertPtr_t aContent ) = 0; |
|
51 virtual Ret_t smlDeleteCmdFuncL( SmlDeletePtr_t aContent ) = 0; |
|
52 virtual Ret_t smlGetCmdFuncL( SmlGetPtr_t aContent ) = 0; |
|
53 virtual Ret_t smlPutCmdFuncL( SmlPutPtr_t aContent ) = 0; |
|
54 virtual Ret_t smlMapCmdFuncL( SmlMapPtr_t aContent ) = 0; |
|
55 virtual Ret_t smlResultsCmdFuncL( SmlResultsPtr_t aContent ) = 0; |
|
56 virtual Ret_t smlStatusCmdFuncL( SmlStatusPtr_t aContent ) = 0; |
|
57 virtual Ret_t smlReplaceCmdFuncL( SmlReplacePtr_t aContent ) = 0; |
|
58 virtual Ret_t smlCopyCmdFuncL( SmlCopyPtr_t param ) = 0; |
|
59 virtual Ret_t smlMoveCmdFuncL( SmlMovePtr_t param ) = 0; //1.2 CHANGES: Move command added |
|
60 virtual Ret_t smlExecCmdFuncL( SmlExecPtr_t aContent ) = 0; |
|
61 virtual Ret_t smlSearchCmdFuncL( SmlSearchPtr_t aContent ) = 0; |
|
62 }; |
|
63 |
|
64 // ------------------------------------------------------------------------------------------------ |
|
65 // CWBXMLSyncMLDocHandler |
|
66 // ------------------------------------------------------------------------------------------------ |
|
67 class CWBXMLSyncMLDocHandler : public CBase, public MWBXMLDocumentHandler, public MWBXMLExtensionHandler |
|
68 { |
|
69 public: |
|
70 IMPORT_C static CWBXMLSyncMLDocHandler* NewL( MWBXMLSyncMLCallbacks* aCallbacks ); |
|
71 IMPORT_C ~CWBXMLSyncMLDocHandler(); |
|
72 |
|
73 private: |
|
74 void ConstructL(); |
|
75 CWBXMLSyncMLDocHandler( MWBXMLSyncMLCallbacks* aCallbacks ); |
|
76 void AddElementL( CXMLElement* aElement ); |
|
77 |
|
78 // from MWBXMLDocumentHandler |
|
79 void StartDocumentL( TUint8 aVersion, TInt32 aPublicId, TUint32 aCharset ); |
|
80 void StartDocumentL( TUint8 aVersion, const TDesC8& aPublicIdStr, TUint32 aCharset ); |
|
81 void EndDocumentL(); |
|
82 void StartElementL( TWBXMLTag aTag, const CWBXMLAttributes& aAttributes ); |
|
83 void EndElementL( TWBXMLTag aTag ); |
|
84 void CodePageSwitchL( TUint8 aPage ); |
|
85 void CharactersL( const TDesC8& aBuffer ); |
|
86 void DocumentChangedL(); |
|
87 |
|
88 // from MWBXMLExtensionHandler |
|
89 void Ext_IL( TWBXMLTag aTag, const TDesC8& aData ); |
|
90 void Ext_TL( TWBXMLTag aTag, TUint32 aData ); |
|
91 void ExtL( TWBXMLTag aTag ); |
|
92 void OpaqueL( const TDesC8& aData ); |
|
93 |
|
94 private: |
|
95 CNSmlStack<CXMLElement>* iCmdStack; |
|
96 CNSmlStack<CXMLElement>* iCleanupStack; |
|
97 MWBXMLSyncMLCallbacks* iCallbacks; |
|
98 }; |
|
99 |
|
100 #endif // __WBXMLSYNCMLPARSER_H__ |