|
1 /* |
|
2 * Copyright (c) 2008 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 * |
|
16 */ |
|
17 |
|
18 |
|
19 #ifndef SUITEPARSER_H |
|
20 #define SUITEPARSER_H |
|
21 |
|
22 // INCLUDES |
|
23 #include <e32std.h> |
|
24 #include <e32base.h> |
|
25 #include <xcfwengine.h> |
|
26 |
|
27 // FORWARD DECLARATIONS |
|
28 class CXCFWTree; |
|
29 class CSuiteObject; |
|
30 class RSuiteObjectArray; |
|
31 class CSuiteObjectFactory; |
|
32 |
|
33 // CLASS DECLARATION |
|
34 |
|
35 /** |
|
36 * CSuiteParser |
|
37 * |
|
38 */ |
|
39 NONSHARABLE_CLASS( CSuiteParser ) : public CBase, public MXCFWEngineObserver |
|
40 { |
|
41 public: |
|
42 //event enumeration |
|
43 |
|
44 enum TSuiteParsingStatus // statuses |
|
45 |
|
46 { |
|
47 ECompleted = 0, // factory settings completed successfully |
|
48 EFailed = -1 // factory settings failed |
|
49 }; |
|
50 |
|
51 public: |
|
52 // Constructors and destructor |
|
53 |
|
54 /** |
|
55 * Destructor. |
|
56 */ |
|
57 ~CSuiteParser(); |
|
58 |
|
59 /** |
|
60 * Two-phased constructor. |
|
61 * @param aFileName a xml file to parse. |
|
62 */ |
|
63 static CSuiteParser* NewL( const TDesC& aFileName ); |
|
64 |
|
65 /** |
|
66 * Two-phased constructor. |
|
67 * @param aFileName a xml file to parse. |
|
68 */ |
|
69 static CSuiteParser* NewLC( const TDesC& aFileName ); |
|
70 |
|
71 /** |
|
72 * Gets suites array |
|
73 * @param aSuitesArray array that wil be filled with suites. |
|
74 */ |
|
75 TInt GetSuitsArrayL( RPointerArray<CSuiteObject>& aSuitesArray ); |
|
76 |
|
77 private: |
|
78 |
|
79 /** |
|
80 * Constructor for performing 1st stage construction |
|
81 */ |
|
82 CSuiteParser(); |
|
83 |
|
84 /** |
|
85 * EPOC default constructor for performing 2nd stage construction |
|
86 * @param aFileName a xml file to parse. |
|
87 */ |
|
88 void ConstructL( const TDesC& aFileName ); |
|
89 |
|
90 /** |
|
91 * Handles the "entries" node. |
|
92 * @param aSuitesArray array that wil be filled with suites. |
|
93 */ |
|
94 void HandleEntriesL( RPointerArray<CSuiteObject>& aSuitesArray ); |
|
95 |
|
96 /** |
|
97 * Creats suite object from node in xml file |
|
98 * @param aNode that contains suite's data. |
|
99 */ |
|
100 CSuiteObject* CreateSuiteLC( MXCFWNode* aNode ); |
|
101 |
|
102 |
|
103 public: |
|
104 // Functions from base classes |
|
105 |
|
106 /** |
|
107 * Called when Engine parsing / saving state changes |
|
108 * User can do desired actions on corresponding events. |
|
109 * @param aEvent Engine event. |
|
110 */ |
|
111 virtual void HandleEngineEventL( TXCFWEngineEvent aEvent ); |
|
112 |
|
113 /** |
|
114 * Called when there's an error during parsing / saving |
|
115 * @param aErrorCode Error code from engine |
|
116 */ |
|
117 virtual void HandleEngineErrorL( TInt aErrorCode ); |
|
118 |
|
119 /** |
|
120 * Called when the file parsing is finished |
|
121 * |
|
122 * @param aStatus parsing status. |
|
123 */ |
|
124 void HandleCompletionL( TSuiteParsingStatus aStatus ); |
|
125 |
|
126 private: // data |
|
127 |
|
128 /** |
|
129 * Name of a file to parse. Own. |
|
130 */ |
|
131 RBuf iFileName; |
|
132 |
|
133 /** |
|
134 * Content engine. Own. |
|
135 */ |
|
136 CXCFWEngine* iContentEngine; |
|
137 |
|
138 /** |
|
139 * Content tree. Own. |
|
140 */ |
|
141 CXCFWTree* iContentTree; |
|
142 |
|
143 /** |
|
144 * scheduler for make synchronous restoration |
|
145 */ |
|
146 CActiveSchedulerWait* iActiveScheduler; |
|
147 |
|
148 /** |
|
149 * Status of parsing |
|
150 */ |
|
151 TSuiteParsingStatus iCompletionStatus; |
|
152 |
|
153 /** |
|
154 * Factory object needed for localised attributes. Own. |
|
155 */ |
|
156 CSuiteObjectFactory* iObjectFactory; |
|
157 |
|
158 }; |
|
159 |
|
160 |
|
161 #endif // SUITEPARSER_H |