author | Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com> |
Mon, 03 May 2010 13:17:34 +0300 | |
changeset 19 | fcece45ef507 |
parent 18 | 2f34d5167611 |
permissions | -rw-r--r-- |
0 | 1 |
/**************************************************************************** |
2 |
** |
|
18
2f34d5167611
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
3 |
** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). |
0 | 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 "basic.h" |
|
44 |
||
45 |
QT_BEGIN_NAMESPACE |
|
46 |
||
47 |
Basic::Token Basic::classifier3(const QChar *data) |
|
48 |
||
49 |
{ |
|
50 |
if (data[0] == 100) |
|
51 |
||
52 |
||
53 |
{ |
|
54 |
||
55 |
static const unsigned short string[] = |
|
56 |
{ |
|
57 |
101, 102 |
|
58 |
}; |
|
59 |
if(memcmp(&data[1], &string, sizeof(QChar) * 2) == 0) |
|
60 |
||
61 |
||
62 |
return _111; |
|
63 |
||
64 |
} |
|
65 |
||
66 |
else if (data[0] == 97) |
|
67 |
||
68 |
||
69 |
{ |
|
70 |
||
71 |
static const unsigned short string[] = |
|
72 |
{ |
|
73 |
98, 99 |
|
74 |
}; |
|
75 |
if(memcmp(&data[1], &string, sizeof(QChar) * 2) == 0) |
|
76 |
||
77 |
||
78 |
return _; |
|
79 |
||
80 |
} |
|
81 |
||
82 |
else if (data[0] == 103) |
|
83 |
||
84 |
||
85 |
{ |
|
86 |
||
87 |
static const unsigned short string[] = |
|
88 |
{ |
|
89 |
104, 105 |
|
90 |
}; |
|
91 |
if(memcmp(&data[1], &string, sizeof(QChar) * 2) == 0) |
|
92 |
||
93 |
||
94 |
return wobbly; |
|
95 |
||
96 |
} |
|
97 |
||
98 |
||
99 |
||
100 |
return NoKeyword; |
|
101 |
} |
|
102 |
Basic::Token Basic::classifier4(const QChar *data) |
|
103 |
||
104 |
{ |
|
105 |
if (data[0] == 70) |
|
106 |
||
107 |
||
108 |
{ |
|
109 |
if (data[1] == 70) |
|
110 |
||
111 |
||
112 |
{ |
|
113 |
if (data[2] == 70) |
|
114 |
||
115 |
||
116 |
{ |
|
117 |
if (data[3] == 70) |
|
118 |
||
119 |
||
120 |
{ |
|
121 |
||
122 |
||
123 |
return FFFF; |
|
124 |
||
125 |
} |
|
126 |
||
127 |
else if (data[3] == 71) |
|
128 |
||
129 |
||
130 |
{ |
|
131 |
||
132 |
||
133 |
return FFFG; |
|
134 |
||
135 |
} |
|
136 |
||
137 |
||
138 |
} |
|
139 |
||
140 |
else if (data[2] == 71) |
|
141 |
||
142 |
||
143 |
{ |
|
144 |
if (data[3] == 70) |
|
145 |
||
146 |
||
147 |
{ |
|
148 |
||
149 |
||
150 |
return FFGF; |
|
151 |
||
152 |
} |
|
153 |
||
154 |
else if (data[3] == 71) |
|
155 |
||
156 |
||
157 |
{ |
|
158 |
||
159 |
||
160 |
return FFGG; |
|
161 |
||
162 |
} |
|
163 |
||
164 |
||
165 |
} |
|
166 |
||
167 |
else if (data[2] == 76) |
|
168 |
||
169 |
||
170 |
{ |
|
171 |
||
172 |
if(data[3] == 77) |
|
173 |
||
174 |
||
175 |
return FFLM; |
|
176 |
||
177 |
} |
|
178 |
||
179 |
||
180 |
} |
|
181 |
||
182 |
||
183 |
} |
|
184 |
||
185 |
||
186 |
||
187 |
return NoKeyword; |
|
188 |
} |
|
189 |
Basic::Token Basic::classifier9(const QChar *data) |
|
190 |
||
191 |
{ |
|
192 |
||
193 |
static const unsigned short string[] = |
|
194 |
{ |
|
195 |
111, 110, 101, 58, 99, 111, 108, 111, 110 |
|
196 |
}; |
|
197 |
if(memcmp(&data[0], &string, sizeof(QChar) * 9) == 0) |
|
198 |
||
199 |
||
200 |
return OneColon; |
|
201 |
||
202 |
||
203 |
return NoKeyword; |
|
204 |
} |
|
205 |
Basic::Token Basic::classifier14(const QChar *data) |
|
206 |
||
207 |
{ |
|
208 |
if (data[0] == 119) |
|
209 |
||
210 |
||
211 |
{ |
|
212 |
||
213 |
static const unsigned short string[] = |
|
214 |
{ |
|
215 |
101, 45, 104, 97, 118, 101, 45, 100, 97, 115, 104, 101, 115 |
|
216 |
}; |
|
217 |
if(memcmp(&data[1], &string, sizeof(QChar) * 13) == 0) |
|
218 |
||
219 |
||
220 |
return WeHaveDashes; |
|
221 |
||
222 |
} |
|
223 |
||
224 |
else if (data[0] == 99) |
|
225 |
||
226 |
||
227 |
{ |
|
228 |
||
229 |
static const unsigned short string[] = |
|
230 |
{ |
|
231 |
111, 108, 111, 110, 58, 105, 110, 58, 110, 97, 109, 101, 58 |
|
232 |
}; |
|
233 |
if(memcmp(&data[1], &string, sizeof(QChar) * 13) == 0) |
|
234 |
||
235 |
||
236 |
return ColonInName; |
|
237 |
||
238 |
} |
|
239 |
||
240 |
||
241 |
||
242 |
return NoKeyword; |
|
243 |
} |
|
244 |
Basic::Token Basic::classifier15(const QChar *data) |
|
245 |
||
246 |
{ |
|
247 |
||
248 |
static const unsigned short string[] = |
|
249 |
{ |
|
250 |
119, 101, 45, 104, 97, 118, 101, 45, 100, 97, 115, 104, 101, 115, 45 |
|
251 |
}; |
|
252 |
if(memcmp(&data[0], &string, sizeof(QChar) * 15) == 0) |
|
253 |
||
254 |
||
255 |
return WeHaveDashes2; |
|
256 |
||
257 |
||
258 |
return NoKeyword; |
|
259 |
} |
|
260 |
Basic::Token Basic::classifier44(const QChar *data) |
|
261 |
||
262 |
{ |
|
263 |
||
264 |
static const unsigned short string[] = |
|
265 |
{ |
|
266 |
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 |
|
267 |
}; |
|
268 |
if(memcmp(&data[0], &string, sizeof(QChar) * 44) == 0) |
|
269 |
||
270 |
||
271 |
return AReallyLongTokenIFreakinMeanItUKnowUKnowKnow; |
|
272 |
||
273 |
||
274 |
return NoKeyword; |
|
275 |
} |
|
276 |
Basic::Token Basic::toToken(const QChar *data, int length) |
|
277 |
{ |
|
278 |
switch(length) |
|
279 |
{ |
|
280 |
||
281 |
case 3: |
|
282 |
return classifier3(data); |
|
283 |
||
284 |
||
285 |
case 4: |
|
286 |
return classifier4(data); |
|
287 |
||
288 |
||
289 |
case 9: |
|
290 |
return classifier9(data); |
|
291 |
||
292 |
||
293 |
case 14: |
|
294 |
return classifier14(data); |
|
295 |
||
296 |
||
297 |
case 15: |
|
298 |
return classifier15(data); |
|
299 |
||
300 |
||
301 |
case 44: |
|
302 |
return classifier44(data); |
|
303 |
||
304 |
||
305 |
default: |
|
306 |
return NoKeyword; |
|
307 |
} |
|
308 |
} |
|
309 |
||
310 |
||
311 |
QString Basic::toString(Token token) |
|
312 |
{ |
|
313 |
const unsigned short *data = 0; |
|
314 |
int length = 0; |
|
315 |
||
316 |
switch(token) |
|
317 |
{ |
|
318 |
||
319 |
case AReallyLongTokenIFreakinMeanItUKnowUKnowKnow: |
|
320 |
{ |
|
321 |
static const unsigned short staticallyStoredAReallyLongTokenIFreakinMeanItUKnowUKnowKnow[] = |
|
322 |
{ |
|
323 |
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 |
|
324 |
}; |
|
325 |
data = staticallyStoredAReallyLongTokenIFreakinMeanItUKnowUKnowKnow; |
|
326 |
length = 44; |
|
327 |
break; |
|
328 |
} |
|
329 |
||
330 |
case ColonInName: |
|
331 |
{ |
|
332 |
static const unsigned short staticallyStoredColonInName[] = |
|
333 |
{ |
|
334 |
99, 111, 108, 111, 110, 58, 105, 110, 58, 110, 97, 109, 101, 58, 0 |
|
335 |
}; |
|
336 |
data = staticallyStoredColonInName; |
|
337 |
length = 14; |
|
338 |
break; |
|
339 |
} |
|
340 |
||
341 |
case FFFF: |
|
342 |
{ |
|
343 |
static const unsigned short staticallyStoredFFFF[] = |
|
344 |
{ |
|
345 |
70, 70, 70, 70, 0 |
|
346 |
}; |
|
347 |
data = staticallyStoredFFFF; |
|
348 |
length = 4; |
|
349 |
break; |
|
350 |
} |
|
351 |
||
352 |
case FFFG: |
|
353 |
{ |
|
354 |
static const unsigned short staticallyStoredFFFG[] = |
|
355 |
{ |
|
356 |
70, 70, 70, 71, 0 |
|
357 |
}; |
|
358 |
data = staticallyStoredFFFG; |
|
359 |
length = 4; |
|
360 |
break; |
|
361 |
} |
|
362 |
||
363 |
case FFGF: |
|
364 |
{ |
|
365 |
static const unsigned short staticallyStoredFFGF[] = |
|
366 |
{ |
|
367 |
70, 70, 71, 70, 0 |
|
368 |
}; |
|
369 |
data = staticallyStoredFFGF; |
|
370 |
length = 4; |
|
371 |
break; |
|
372 |
} |
|
373 |
||
374 |
case FFGG: |
|
375 |
{ |
|
376 |
static const unsigned short staticallyStoredFFGG[] = |
|
377 |
{ |
|
378 |
70, 70, 71, 71, 0 |
|
379 |
}; |
|
380 |
data = staticallyStoredFFGG; |
|
381 |
length = 4; |
|
382 |
break; |
|
383 |
} |
|
384 |
||
385 |
case FFLM: |
|
386 |
{ |
|
387 |
static const unsigned short staticallyStoredFFLM[] = |
|
388 |
{ |
|
389 |
70, 70, 76, 77, 0 |
|
390 |
}; |
|
391 |
data = staticallyStoredFFLM; |
|
392 |
length = 4; |
|
393 |
break; |
|
394 |
} |
|
395 |
||
396 |
case OneColon: |
|
397 |
{ |
|
398 |
static const unsigned short staticallyStoredOneColon[] = |
|
399 |
{ |
|
400 |
111, 110, 101, 58, 99, 111, 108, 111, 110, 0 |
|
401 |
}; |
|
402 |
data = staticallyStoredOneColon; |
|
403 |
length = 9; |
|
404 |
break; |
|
405 |
} |
|
406 |
||
407 |
case WeHaveDashes: |
|
408 |
{ |
|
409 |
static const unsigned short staticallyStoredWeHaveDashes[] = |
|
410 |
{ |
|
411 |
119, 101, 45, 104, 97, 118, 101, 45, 100, 97, 115, 104, 101, 115, 0 |
|
412 |
}; |
|
413 |
data = staticallyStoredWeHaveDashes; |
|
414 |
length = 14; |
|
415 |
break; |
|
416 |
} |
|
417 |
||
418 |
case WeHaveDashes2: |
|
419 |
{ |
|
420 |
static const unsigned short staticallyStoredWeHaveDashes2[] = |
|
421 |
{ |
|
422 |
119, 101, 45, 104, 97, 118, 101, 45, 100, 97, 115, 104, 101, 115, 45, 0 |
|
423 |
}; |
|
424 |
data = staticallyStoredWeHaveDashes2; |
|
425 |
length = 15; |
|
426 |
break; |
|
427 |
} |
|
428 |
||
429 |
case _: |
|
430 |
{ |
|
431 |
static const unsigned short staticallyStored_[] = |
|
432 |
{ |
|
433 |
97, 98, 99, 0 |
|
434 |
}; |
|
435 |
data = staticallyStored_; |
|
436 |
length = 3; |
|
437 |
break; |
|
438 |
} |
|
439 |
||
440 |
case _111: |
|
441 |
{ |
|
442 |
static const unsigned short staticallyStored_111[] = |
|
443 |
{ |
|
444 |
100, 101, 102, 0 |
|
445 |
}; |
|
446 |
data = staticallyStored_111; |
|
447 |
length = 3; |
|
448 |
break; |
|
449 |
} |
|
450 |
||
451 |
case wobbly: |
|
452 |
{ |
|
453 |
static const unsigned short staticallyStoredwobbly[] = |
|
454 |
{ |
|
455 |
103, 104, 105, 0 |
|
456 |
}; |
|
457 |
data = staticallyStoredwobbly; |
|
458 |
length = 3; |
|
459 |
break; |
|
460 |
} |
|
461 |
||
462 |
default: |
|
463 |
/* It's either the default token, or an undefined enum |
|
464 |
* value. We silence a compiler warning, and return the |
|
465 |
* empty string. */ |
|
466 |
; |
|
467 |
} |
|
468 |
||
469 |
union |
|
470 |
{ |
|
471 |
const unsigned short *data; |
|
472 |
const QChar *asQChar; |
|
473 |
} converter; |
|
474 |
converter.data = data; |
|
475 |
||
476 |
return QString::fromRawData(converter.asQChar, length); |
|
477 |
} |
|
478 |
||
479 |
QT_END_NAMESPACE |
|
480 |