|
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: smilparserold declaration |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 #ifndef PARSESMIL_H |
|
21 #define PARSESMIL_H |
|
22 |
|
23 // INCLUDES |
|
24 #include <e32base.h> |
|
25 #include <f32file.h> |
|
26 #include "smilpresentation.h" |
|
27 #include "parseelement.h" |
|
28 #include "smilobject.h" |
|
29 |
|
30 // FORWARD DECLARATIONS |
|
31 class CNode; |
|
32 class CResourceTestData; |
|
33 class CSmilAnchor; |
|
34 class CSmilTimeContainer; |
|
35 |
|
36 // CLASS DECLARATION |
|
37 |
|
38 /** |
|
39 * ?one_line_short_description. |
|
40 * ?other_description_lines |
|
41 */ |
|
42 class CParseSmil : public CBase |
|
43 { |
|
44 public: // Constructors and destructor |
|
45 |
|
46 |
|
47 /** |
|
48 * Two-phased constructor. |
|
49 */ |
|
50 static CParseSmil* NewL( RFile& aFile, CSmilPresentation* aPresentation, RFs& aSession ); |
|
51 |
|
52 /** |
|
53 * Destructor. |
|
54 */ |
|
55 virtual ~CParseSmil(); |
|
56 |
|
57 public: // New functions |
|
58 |
|
59 /** |
|
60 * Makes the syntax tree |
|
61 */ |
|
62 void MakeTreeL(); |
|
63 |
|
64 /** |
|
65 * This function carries out the actual parsing |
|
66 */ |
|
67 void DoParseL(); |
|
68 |
|
69 /** |
|
70 * Inserts a SMIL element into a node |
|
71 * @param TDesC8& aElement |
|
72 * @param CNode& aNode |
|
73 */ |
|
74 void FoundElementL( const TDesC8& aElement, CNode& aNode ); |
|
75 |
|
76 /** |
|
77 * Get the element node in the index given |
|
78 * @param TInt aIndex |
|
79 * @return CNode* pointer to the node |
|
80 */ |
|
81 inline CNode* Element( TInt aIndex ); |
|
82 |
|
83 /** |
|
84 * Return the number of elements in the syntax tree |
|
85 * @return TInt number of elements |
|
86 */ |
|
87 inline TInt ElementCount(); |
|
88 |
|
89 /** |
|
90 * Check that the elements match. |
|
91 */ |
|
92 void CheckMatchingL(); |
|
93 |
|
94 public: // Functions from base classes |
|
95 |
|
96 /** |
|
97 * From ?base_class ?member_description. |
|
98 * @param ?arg1 ?description |
|
99 * @return ?description |
|
100 */ |
|
101 |
|
102 protected: // New functions |
|
103 |
|
104 /** |
|
105 * ?member_description. |
|
106 * @param ?arg1 ?description |
|
107 * @return ?description |
|
108 */ |
|
109 |
|
110 protected: // Functions from base classes |
|
111 |
|
112 /** |
|
113 * From ?base_class ?member_description |
|
114 */ |
|
115 |
|
116 private: |
|
117 |
|
118 /** |
|
119 * By default EPOC constructor is private. |
|
120 */ |
|
121 void ConstructL(); |
|
122 |
|
123 /** |
|
124 * By default C++ constructor is private. |
|
125 */ |
|
126 CParseSmil( RFile& aFile, CSmilPresentation* aPresentation, RFs& aSession ); |
|
127 |
|
128 /** |
|
129 * Parses the <region> tag of the presentation |
|
130 * @param aPtr pointer to descriptor |
|
131 */ |
|
132 void ParseRegionInfoL( TPtrC8& aPtr ); |
|
133 |
|
134 /** |
|
135 * Parses the <smil> tag of the presentation |
|
136 * @param aPtr pointer to descriptor |
|
137 */ |
|
138 void ParseSmilInfo( TPtrC8& aPtr ); |
|
139 |
|
140 /** |
|
141 * Parses the <body> tag of the presentation |
|
142 * @param aPtr pointer to descriptor <- obsolete? |
|
143 */ |
|
144 TBool ParseSwitchL( TInt& aSkip, CSmilTimeContainer* aParent, CSmilAnchor* aAnchor ); |
|
145 |
|
146 /** |
|
147 * Parses the <body> tag of the presentation |
|
148 * @param aPtr pointer to descriptor <- obsolete? |
|
149 */ |
|
150 TBool EvaluateTestAttribute( const TInt aIndex, |
|
151 const TPtrC8& aValue, |
|
152 CResourceTestData& aTestData ); |
|
153 |
|
154 /** |
|
155 * Parses the <body> tag of the presentation |
|
156 * @param aPtr pointer to descriptor <- obsolete? |
|
157 */ |
|
158 void IsContainer( TMediaSmil& aMedia ); |
|
159 |
|
160 /** |
|
161 * Parses the <body> tag of the presentation |
|
162 * @param aPtr pointer to descriptor |
|
163 */ |
|
164 TBuf8<5> SelectEndingTag( const CSmilObject& aObject ); |
|
165 |
|
166 /** |
|
167 * Parses the <body> tag of the presentation |
|
168 * @param aPtr pointer to descriptor |
|
169 */ |
|
170 TBuf8<7> SelectEndingTag( const TMediaSmil aMedia ); |
|
171 |
|
172 /** |
|
173 * Parses the <body> tag of the presentation |
|
174 * @param aPtr pointer to descriptor |
|
175 */ |
|
176 TBuf8<7> SelectBeginTag( const TMediaSmil aMedia ); |
|
177 |
|
178 /** |
|
179 * Parses the <body> tag of the presentation |
|
180 * @param aPtr pointer to descriptor |
|
181 */ |
|
182 void ParseHypeReferenceL( TPtrC8& aPtr, CSmilAnchor* aReference ); |
|
183 |
|
184 /** |
|
185 * Parses the "I18n" collection of the presentation |
|
186 * @param aPtr pointer to descriptor |
|
187 */ |
|
188 void ParseI18n( TPtrC8& aPtr ); |
|
189 |
|
190 /** |
|
191 * Parses the "core" collection of the presentation |
|
192 * @param aPtr pointer to descriptor |
|
193 */ |
|
194 void ParseCore( TPtrC8& aPtr, CSmilObject* aObject ); |
|
195 |
|
196 /** |
|
197 * Parses the <root-layout> tag of the presentation |
|
198 * @param aPtr pointer to descriptor |
|
199 */ |
|
200 void ParseRootLayoutInfo( TPtrC8& aPtr ); |
|
201 |
|
202 /** |
|
203 * Parses the <root-layout> tag of the presentation |
|
204 * @param aPtr pointer to descriptor |
|
205 */ |
|
206 void ParseLayoutInfo( TPtrC8& aPtr ); |
|
207 |
|
208 /** |
|
209 * Parses the <img> and <text> tag of the presentation |
|
210 * @param aPtr pointer to descriptor |
|
211 * @param aObject media object |
|
212 */ |
|
213 void ParseObjectL( TPtrC8& aPtr, CSmilMedia* aObject ); |
|
214 |
|
215 /** |
|
216 * Parses the <ref> tag of the presentation |
|
217 * @param aPtr pointer to descriptor |
|
218 */ |
|
219 void ParseRef( TPtrC8& aPtr, CSmilMedia* aObject ); |
|
220 |
|
221 /** |
|
222 * Parses the <seq> tag of the presentation |
|
223 * @param aPtr pointer to descriptor |
|
224 */ |
|
225 void ParseContainerL( TPtrC8& aDes, CSmilTimeContainer* aContainer ); |
|
226 |
|
227 /** |
|
228 * Parses the <seq> tag of the presentation |
|
229 * @param aPtr pointer to descriptor |
|
230 */ |
|
231 void ParseTimingAttributes( TPtrC8& aPtr, CSmilObject* aObject ); |
|
232 |
|
233 /** |
|
234 * Parses the <seq> tag of the presentation |
|
235 * @param aPtr pointer to descriptor |
|
236 */ |
|
237 void ParseRestartAndFill( TPtrC8& aPtr, CSmilObject* aObject ); |
|
238 |
|
239 /** |
|
240 * Parses the <seq> tag of the presentation |
|
241 * @param aPtr pointer to descriptor |
|
242 */ |
|
243 void ParseEndSync( TPtrC8& aPtr, CSmilTimeContainer* aContainer ); |
|
244 |
|
245 /** |
|
246 * Searches for a text string located between "quotation marks". |
|
247 * @param aInt indicates the point where the reading starts |
|
248 * @param aPtr a pointer to the descriptor to search |
|
249 */ |
|
250 const TPtrC8 TraverseTextBuffer( TInt aInt, TPtrC8& aPtr ); |
|
251 |
|
252 /** |
|
253 * Searches for a text string located between "quotation marks". |
|
254 * @param aInt indicates the point where the reading starts |
|
255 * @param aPtr a pointer to the descriptor to search |
|
256 */ |
|
257 const TPtrC TraverseTextBuffer( TInt aInt, TPtr& aPtr ); |
|
258 |
|
259 /** |
|
260 * Searches for a text string located between "quotation marks", |
|
261 * and converts the string into the corresponding numeric value. |
|
262 * @param aInt indicates the point where the reading starts |
|
263 * @param aPtr a pointer to descriptor |
|
264 * @return the converted value as integer |
|
265 * or -1 if the search fails |
|
266 */ |
|
267 TInt TraverseDimension( TInt aInt, TPtrC8& aPtr ); |
|
268 |
|
269 /** |
|
270 * A tag was found. |
|
271 * @param TLex8 aLex |
|
272 * @param CNode* aParent |
|
273 */ |
|
274 void FoundTagL( TLex8 aLex, CNode* aParent ); |
|
275 |
|
276 /** |
|
277 * If FindTagL() finds a valid tag it calls this |
|
278 * to carry on with the processing |
|
279 * @param TLex8 aLex |
|
280 * @param CNode* aParent |
|
281 */ |
|
282 void ContinueL( TLex8 aLex, CNode* aParent ); |
|
283 |
|
284 /** |
|
285 * Find the start of the tag and check if it's a comment |
|
286 * @param TLex8 aLex |
|
287 * @return TPtrC8 - descriptor to a started tag |
|
288 */ |
|
289 const TPtrC8 FindStartOfTagL( TLex8 aLex ); |
|
290 |
|
291 /** |
|
292 * Check the validity of the element |
|
293 * @param TDesC8& aTag |
|
294 * @return TInt true or false |
|
295 */ |
|
296 TInt IsValid( const TDesC8& aTag ); |
|
297 |
|
298 /** |
|
299 * Walk through the presentation and check the |
|
300 * matching of the elements |
|
301 */ |
|
302 void WalkL(); |
|
303 |
|
304 /** |
|
305 * Read from file |
|
306 * @param TInt& aRet - error code |
|
307 * @return TLex8 - presentation |
|
308 */ |
|
309 TLex8 ReadNext( TInt& aRet ); |
|
310 |
|
311 private: // Data |
|
312 |
|
313 enum ParseState { |
|
314 EInitial, ESmil, EHead, EBody, ELayout |
|
315 }; |
|
316 |
|
317 RFile& iFile; |
|
318 CSmilPresentation* iPresentation; |
|
319 RFs& iSession; |
|
320 TInt iParse; |
|
321 HBufC8* iBuf; |
|
322 HBufC8* iBuffer; |
|
323 CNode* iNode; |
|
324 CArrayPtrFlat<CNode>* iArray; |
|
325 CSmilObject* iCurrent; |
|
326 |
|
327 ParseState iState; |
|
328 |
|
329 }; |
|
330 |
|
331 #include "parsesmil.inl" |
|
332 |
|
333 #endif // ?INCLUDE_H |
|
334 |
|
335 // End of File |
|
336 |