|
1 /* |
|
2 * Copyright (c) 2005 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: Header declaration |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 |
|
21 |
|
22 |
|
23 |
|
24 |
|
25 #ifndef C_SEN_FILTER_FRAGMENT_H |
|
26 #define C_SEN_FILTER_FRAGMENT_H |
|
27 |
|
28 // INCLUDES |
|
29 |
|
30 #include <e32base.h> |
|
31 #include <flogger.h> |
|
32 |
|
33 #include "SenElement.h" |
|
34 #include "SenBaseFragment.h" |
|
35 #include <SenXmlElement.h> // check if this include is needed(?) |
|
36 |
|
37 #include "SenFilterStateMachine.h" |
|
38 #include "MSenFilterCollector.h" |
|
39 #include "MSenFilterAction.h" |
|
40 |
|
41 // CONSTANTS |
|
42 |
|
43 // FORWARD DECLARATIONS |
|
44 |
|
45 class CSenFilterStateMachine; |
|
46 class CSenFilterStateNode; |
|
47 class CSenFilterTableEntry; |
|
48 class CSenFilterNewProperty; |
|
49 class CSenFilterPutProperty; |
|
50 |
|
51 // CLASS DEFINITIONS |
|
52 |
|
53 /** |
|
54 * @author lewontin |
|
55 * |
|
56 */ |
|
57 |
|
58 |
|
59 class CSenFilterFragment : public CSenBaseFragment |
|
60 { |
|
61 |
|
62 public: // Constructors and Destructors |
|
63 |
|
64 IMPORT_C CSenFilterFragment(); |
|
65 |
|
66 |
|
67 IMPORT_C ~CSenFilterFragment(); |
|
68 |
|
69 |
|
70 public: |
|
71 |
|
72 /** |
|
73 * |
|
74 * Save any text property |
|
75 */ |
|
76 |
|
77 |
|
78 |
|
79 IMPORT_C void SetCollector(MSenFilterCollector& aCollector); |
|
80 |
|
81 /** |
|
82 * Inherited methods from CSenBaseFragment |
|
83 */ |
|
84 IMPORT_C void StartElementL(const TDesC8& aNamespaceURI, |
|
85 const TDesC8& aLocalName, |
|
86 const TDesC8& aQName, |
|
87 const RAttributeArray& aAttributes); |
|
88 |
|
89 |
|
90 IMPORT_C void CharactersL(const TDesC8& aCh, |
|
91 TInt aStart, |
|
92 TInt aLength); |
|
93 |
|
94 |
|
95 IMPORT_C void EndElementL(const TDesC8& aNamespaceURI, |
|
96 const TDesC8& aLocalName, |
|
97 const TDesC8& aQName); |
|
98 |
|
99 IMPORT_C TInt BuildFrom(const TDesC8& aString); |
|
100 |
|
101 |
|
102 // Public filter API |
|
103 |
|
104 IMPORT_C CSenFilterStateNode& AddFilterLC(CSenFilterStateNode& aNode, |
|
105 const TDesC8& aLocalName); |
|
106 |
|
107 |
|
108 IMPORT_C CSenFilterStateNode& AddRootFilterLC(const TDesC8& aLocalName); |
|
109 |
|
110 |
|
111 IMPORT_C void CompileL(); |
|
112 |
|
113 /*public void andFilter(const TDesC8& localName) throws FilterException { |
|
114 ipFsm.andFilter(localName, NULL, ipNewP, ipPutP); |
|
115 } |
|
116 public void orFilter(const TDesC8& localName) throws FilterException { |
|
117 ipFsm.orFilter(localName, NULL, ipNewP, ipPutP); |
|
118 } |
|
119 |
|
120 public void compile(){ |
|
121 ipFsm.compile(); |
|
122 }*/ |
|
123 |
|
124 /* // Override base parse to make sure the current fsm is compiled first |
|
125 public void parse(org.xml.sax.InputSource source) |
|
126 throws java.io.IOException, org.xml.sax.SAXException |
|
127 { |
|
128 ipFsm.compile(); |
|
129 super.parse(source); |
|
130 }*/ |
|
131 |
|
132 |
|
133 public: |
|
134 |
|
135 CSenFilterNewProperty* ipNewP; |
|
136 CSenFilterPutProperty* ipPutP; |
|
137 |
|
138 |
|
139 protected: |
|
140 |
|
141 //To hold the current string property value |
|
142 HBufC8* ipPropertyValue; |
|
143 |
|
144 MSenFilterCollector* ipCollector; |
|
145 |
|
146 |
|
147 private: |
|
148 |
|
149 /** |
|
150 * File logger. |
|
151 * |
|
152 */ |
|
153 RFileLogger* Log() const; |
|
154 |
|
155 |
|
156 private: |
|
157 |
|
158 CSenFilterStateMachine* ipFsm; |
|
159 |
|
160 //To hold the current property name |
|
161 HBufC8* ipPropertyName; |
|
162 |
|
163 CSenFilterStateNode* iRoot; |
|
164 |
|
165 RFileLogger iLog; |
|
166 |
|
167 }; // end class CSenFilterFragment |
|
168 |
|
169 |
|
170 // ------------------------------------------ |
|
171 // |
|
172 // Declaration of class CSenFilterNewProperty |
|
173 // |
|
174 // ------------------------------------------ |
|
175 |
|
176 class CSenFilterNewProperty : public CBase, MSenFilterAction |
|
177 { |
|
178 |
|
179 public: // Constructors and Destructors |
|
180 |
|
181 IMPORT_C CSenFilterNewProperty(MSenFilterCollector& aCollector); |
|
182 |
|
183 |
|
184 IMPORT_C ~CSenFilterNewProperty(); |
|
185 |
|
186 |
|
187 public: |
|
188 |
|
189 IMPORT_C void PerformL(const TDesC8& aEvent, |
|
190 const RAttributeArray& aAttributes); |
|
191 |
|
192 |
|
193 private: |
|
194 |
|
195 /** |
|
196 * File logger. |
|
197 * |
|
198 */ |
|
199 RFileLogger* Log() const; |
|
200 |
|
201 |
|
202 private: |
|
203 |
|
204 MSenFilterCollector* ipCol; |
|
205 |
|
206 RFileLogger iLog; |
|
207 |
|
208 }; // end class CSenFilterNewProperty |
|
209 |
|
210 |
|
211 // ------------------------------------------ |
|
212 // |
|
213 // Declaration of class CSenFilterPutProperty |
|
214 // |
|
215 // ------------------------------------------ |
|
216 |
|
217 class CSenFilterPutProperty : public CBase, MSenFilterAction |
|
218 { |
|
219 |
|
220 public: // Constructors and Destructors |
|
221 |
|
222 CSenFilterPutProperty(MSenFilterCollector& aCollector); |
|
223 |
|
224 |
|
225 ~CSenFilterPutProperty(); |
|
226 |
|
227 |
|
228 public: |
|
229 |
|
230 void SetPropertyValueL(const TDesC8& aPropertyValue); |
|
231 |
|
232 |
|
233 void PerformL(const TDesC8& aEvent, |
|
234 const RAttributeArray& aAttributes); |
|
235 |
|
236 |
|
237 private: |
|
238 |
|
239 /** |
|
240 * File logger. |
|
241 * |
|
242 */ |
|
243 RFileLogger* Log() const; |
|
244 |
|
245 |
|
246 private: |
|
247 |
|
248 HBufC8* ipPropertyValue; |
|
249 MSenFilterCollector* ipCol; |
|
250 |
|
251 RFileLogger iLog; |
|
252 |
|
253 }; // end class CSenFilterPutProperty |
|
254 |
|
255 |
|
256 #endif // C_SEN_FILTER_FRAGMENT_H |
|
257 |