|
1 /**************************************************************************** |
|
2 ** |
|
3 ** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). |
|
4 ** All rights reserved. |
|
5 ** Contact: Nokia Corporation (qt-info@nokia.com) |
|
6 ** |
|
7 ** This file is part of the test suite of the Qt Toolkit. |
|
8 ** |
|
9 ** $QT_BEGIN_LICENSE:LGPL$ |
|
10 ** No Commercial Usage |
|
11 ** This file contains pre-release code and may not be distributed. |
|
12 ** You may use this file in accordance with the terms and conditions |
|
13 ** contained in the Technology Preview License Agreement accompanying |
|
14 ** this package. |
|
15 ** |
|
16 ** GNU Lesser General Public License Usage |
|
17 ** Alternatively, this file may be used under the terms of the GNU Lesser |
|
18 ** General Public License version 2.1 as published by the Free Software |
|
19 ** Foundation and appearing in the file LICENSE.LGPL included in the |
|
20 ** packaging of this file. Please review the following information to |
|
21 ** ensure the GNU Lesser General Public License version 2.1 requirements |
|
22 ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. |
|
23 ** |
|
24 ** In addition, as a special exception, Nokia gives you certain additional |
|
25 ** rights. These rights are described in the Nokia Qt LGPL Exception |
|
26 ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. |
|
27 ** |
|
28 ** If you have questions regarding the use of this file, please contact |
|
29 ** Nokia at qt-info@nokia.com. |
|
30 ** |
|
31 ** |
|
32 ** |
|
33 ** |
|
34 ** |
|
35 ** |
|
36 ** |
|
37 ** |
|
38 ** $QT_END_LICENSE$ |
|
39 ** |
|
40 ****************************************************************************/ |
|
41 /* NOTE: This file is AUTO GENERATED by qtokenautomaton2cpp.xsl. */ |
|
42 |
|
43 #include "withNamespace.h" |
|
44 |
|
45 QT_BEGIN_NAMESPACE |
|
46 |
|
47 using namespace TheNamespace; |
|
48 |
|
49 WithNamespace::Token WithNamespace::classifier3(const QChar *data) |
|
50 |
|
51 { |
|
52 if (data[0] == 100) |
|
53 |
|
54 |
|
55 { |
|
56 |
|
57 static const unsigned short string[] = |
|
58 { |
|
59 101, 102 |
|
60 }; |
|
61 if(memcmp(&data[1], &string, sizeof(QChar) * 2) == 0) |
|
62 |
|
63 |
|
64 return _111; |
|
65 |
|
66 } |
|
67 |
|
68 else if (data[0] == 97) |
|
69 |
|
70 |
|
71 { |
|
72 |
|
73 static const unsigned short string[] = |
|
74 { |
|
75 98, 99 |
|
76 }; |
|
77 if(memcmp(&data[1], &string, sizeof(QChar) * 2) == 0) |
|
78 |
|
79 |
|
80 return _; |
|
81 |
|
82 } |
|
83 |
|
84 else if (data[0] == 103) |
|
85 |
|
86 |
|
87 { |
|
88 |
|
89 static const unsigned short string[] = |
|
90 { |
|
91 104, 105 |
|
92 }; |
|
93 if(memcmp(&data[1], &string, sizeof(QChar) * 2) == 0) |
|
94 |
|
95 |
|
96 return wobbly; |
|
97 |
|
98 } |
|
99 |
|
100 |
|
101 |
|
102 return NoKeyword; |
|
103 } |
|
104 WithNamespace::Token WithNamespace::classifier4(const QChar *data) |
|
105 |
|
106 { |
|
107 if (data[0] == 70) |
|
108 |
|
109 |
|
110 { |
|
111 if (data[1] == 70) |
|
112 |
|
113 |
|
114 { |
|
115 if (data[2] == 70) |
|
116 |
|
117 |
|
118 { |
|
119 if (data[3] == 70) |
|
120 |
|
121 |
|
122 { |
|
123 |
|
124 |
|
125 return FFFF; |
|
126 |
|
127 } |
|
128 |
|
129 else if (data[3] == 71) |
|
130 |
|
131 |
|
132 { |
|
133 |
|
134 |
|
135 return FFFG; |
|
136 |
|
137 } |
|
138 |
|
139 |
|
140 } |
|
141 |
|
142 else if (data[2] == 71) |
|
143 |
|
144 |
|
145 { |
|
146 if (data[3] == 70) |
|
147 |
|
148 |
|
149 { |
|
150 |
|
151 |
|
152 return FFGF; |
|
153 |
|
154 } |
|
155 |
|
156 else if (data[3] == 71) |
|
157 |
|
158 |
|
159 { |
|
160 |
|
161 |
|
162 return FFGG; |
|
163 |
|
164 } |
|
165 |
|
166 |
|
167 } |
|
168 |
|
169 else if (data[2] == 76) |
|
170 |
|
171 |
|
172 { |
|
173 |
|
174 if(data[3] == 77) |
|
175 |
|
176 |
|
177 return FFLM; |
|
178 |
|
179 } |
|
180 |
|
181 |
|
182 } |
|
183 |
|
184 |
|
185 } |
|
186 |
|
187 |
|
188 |
|
189 return NoKeyword; |
|
190 } |
|
191 WithNamespace::Token WithNamespace::classifier14(const QChar *data) |
|
192 |
|
193 { |
|
194 if (data[0] == 119) |
|
195 |
|
196 |
|
197 { |
|
198 |
|
199 static const unsigned short string[] = |
|
200 { |
|
201 101, 45, 104, 97, 118, 101, 45, 100, 97, 115, 104, 101, 115 |
|
202 }; |
|
203 if(memcmp(&data[1], &string, sizeof(QChar) * 13) == 0) |
|
204 |
|
205 |
|
206 return WeHaveDashes; |
|
207 |
|
208 } |
|
209 |
|
210 else if (data[0] == 99) |
|
211 |
|
212 |
|
213 { |
|
214 |
|
215 static const unsigned short string[] = |
|
216 { |
|
217 111, 108, 111, 110, 58, 105, 110, 58, 110, 97, 109, 101, 58 |
|
218 }; |
|
219 if(memcmp(&data[1], &string, sizeof(QChar) * 13) == 0) |
|
220 |
|
221 |
|
222 return ColonInName; |
|
223 |
|
224 } |
|
225 |
|
226 |
|
227 |
|
228 return NoKeyword; |
|
229 } |
|
230 WithNamespace::Token WithNamespace::classifier15(const QChar *data) |
|
231 |
|
232 { |
|
233 |
|
234 static const unsigned short string[] = |
|
235 { |
|
236 119, 101, 45, 104, 97, 118, 101, 45, 100, 97, 115, 104, 101, 115, 45 |
|
237 }; |
|
238 if(memcmp(&data[0], &string, sizeof(QChar) * 15) == 0) |
|
239 |
|
240 |
|
241 return WeHaveDashes2; |
|
242 |
|
243 |
|
244 return NoKeyword; |
|
245 } |
|
246 WithNamespace::Token WithNamespace::classifier44(const QChar *data) |
|
247 |
|
248 { |
|
249 |
|
250 static const unsigned short string[] = |
|
251 { |
|
252 97, 82, 101, 97, 108, 108, 121, 76, 111, 110, 103, 84, 111, 107, 101, 110, 73, 70, 114, 101, 97, 107, 105, 110, 77, 101, 97, 110, 73, 116, 85, 75, 110, 111, 119, 85, 75, 110, 111, 119, 75, 110, 111, 119 |
|
253 }; |
|
254 if(memcmp(&data[0], &string, sizeof(QChar) * 44) == 0) |
|
255 |
|
256 |
|
257 return AReallyLongTokenIFreakinMeanItUKnowUKnowKnow; |
|
258 |
|
259 |
|
260 return NoKeyword; |
|
261 } |
|
262 WithNamespace::Token WithNamespace::toToken(const QChar *data, int length) |
|
263 { |
|
264 switch(length) |
|
265 { |
|
266 |
|
267 case 3: |
|
268 return classifier3(data); |
|
269 |
|
270 |
|
271 case 4: |
|
272 return classifier4(data); |
|
273 |
|
274 |
|
275 case 14: |
|
276 return classifier14(data); |
|
277 |
|
278 |
|
279 case 15: |
|
280 return classifier15(data); |
|
281 |
|
282 |
|
283 case 44: |
|
284 return classifier44(data); |
|
285 |
|
286 |
|
287 default: |
|
288 return NoKeyword; |
|
289 } |
|
290 } |
|
291 |
|
292 |
|
293 QString WithNamespace::toString(Token token) |
|
294 { |
|
295 const unsigned short *data = 0; |
|
296 int length = 0; |
|
297 |
|
298 switch(token) |
|
299 { |
|
300 |
|
301 case AReallyLongTokenIFreakinMeanItUKnowUKnowKnow: |
|
302 { |
|
303 static const unsigned short staticallyStoredAReallyLongTokenIFreakinMeanItUKnowUKnowKnow[] = |
|
304 { |
|
305 97, 82, 101, 97, 108, 108, 121, 76, 111, 110, 103, 84, 111, 107, 101, 110, 73, 70, 114, 101, 97, 107, 105, 110, 77, 101, 97, 110, 73, 116, 85, 75, 110, 111, 119, 85, 75, 110, 111, 119, 75, 110, 111, 119, 0 |
|
306 }; |
|
307 data = staticallyStoredAReallyLongTokenIFreakinMeanItUKnowUKnowKnow; |
|
308 length = 44; |
|
309 break; |
|
310 } |
|
311 |
|
312 case ColonInName: |
|
313 { |
|
314 static const unsigned short staticallyStoredColonInName[] = |
|
315 { |
|
316 99, 111, 108, 111, 110, 58, 105, 110, 58, 110, 97, 109, 101, 58, 0 |
|
317 }; |
|
318 data = staticallyStoredColonInName; |
|
319 length = 14; |
|
320 break; |
|
321 } |
|
322 |
|
323 case FFFF: |
|
324 { |
|
325 static const unsigned short staticallyStoredFFFF[] = |
|
326 { |
|
327 70, 70, 70, 70, 0 |
|
328 }; |
|
329 data = staticallyStoredFFFF; |
|
330 length = 4; |
|
331 break; |
|
332 } |
|
333 |
|
334 case FFFG: |
|
335 { |
|
336 static const unsigned short staticallyStoredFFFG[] = |
|
337 { |
|
338 70, 70, 70, 71, 0 |
|
339 }; |
|
340 data = staticallyStoredFFFG; |
|
341 length = 4; |
|
342 break; |
|
343 } |
|
344 |
|
345 case FFGF: |
|
346 { |
|
347 static const unsigned short staticallyStoredFFGF[] = |
|
348 { |
|
349 70, 70, 71, 70, 0 |
|
350 }; |
|
351 data = staticallyStoredFFGF; |
|
352 length = 4; |
|
353 break; |
|
354 } |
|
355 |
|
356 case FFGG: |
|
357 { |
|
358 static const unsigned short staticallyStoredFFGG[] = |
|
359 { |
|
360 70, 70, 71, 71, 0 |
|
361 }; |
|
362 data = staticallyStoredFFGG; |
|
363 length = 4; |
|
364 break; |
|
365 } |
|
366 |
|
367 case FFLM: |
|
368 { |
|
369 static const unsigned short staticallyStoredFFLM[] = |
|
370 { |
|
371 70, 70, 76, 77, 0 |
|
372 }; |
|
373 data = staticallyStoredFFLM; |
|
374 length = 4; |
|
375 break; |
|
376 } |
|
377 |
|
378 case WeHaveDashes: |
|
379 { |
|
380 static const unsigned short staticallyStoredWeHaveDashes[] = |
|
381 { |
|
382 119, 101, 45, 104, 97, 118, 101, 45, 100, 97, 115, 104, 101, 115, 0 |
|
383 }; |
|
384 data = staticallyStoredWeHaveDashes; |
|
385 length = 14; |
|
386 break; |
|
387 } |
|
388 |
|
389 case WeHaveDashes2: |
|
390 { |
|
391 static const unsigned short staticallyStoredWeHaveDashes2[] = |
|
392 { |
|
393 119, 101, 45, 104, 97, 118, 101, 45, 100, 97, 115, 104, 101, 115, 45, 0 |
|
394 }; |
|
395 data = staticallyStoredWeHaveDashes2; |
|
396 length = 15; |
|
397 break; |
|
398 } |
|
399 |
|
400 case _: |
|
401 { |
|
402 static const unsigned short staticallyStored_[] = |
|
403 { |
|
404 97, 98, 99, 0 |
|
405 }; |
|
406 data = staticallyStored_; |
|
407 length = 3; |
|
408 break; |
|
409 } |
|
410 |
|
411 case _111: |
|
412 { |
|
413 static const unsigned short staticallyStored_111[] = |
|
414 { |
|
415 100, 101, 102, 0 |
|
416 }; |
|
417 data = staticallyStored_111; |
|
418 length = 3; |
|
419 break; |
|
420 } |
|
421 |
|
422 case wobbly: |
|
423 { |
|
424 static const unsigned short staticallyStoredwobbly[] = |
|
425 { |
|
426 103, 104, 105, 0 |
|
427 }; |
|
428 data = staticallyStoredwobbly; |
|
429 length = 3; |
|
430 break; |
|
431 } |
|
432 |
|
433 default: |
|
434 /* It's either the default token, or an undefined enum |
|
435 * value. We silence a compiler warning, and return the |
|
436 * empty string. */ |
|
437 ; |
|
438 } |
|
439 |
|
440 union |
|
441 { |
|
442 const unsigned short *data; |
|
443 const QChar *asQChar; |
|
444 } converter; |
|
445 converter.data = data; |
|
446 |
|
447 return QString::fromRawData(converter.asQChar, length); |
|
448 } |
|
449 |
|
450 QT_END_NAMESPACE |
|
451 |