|
1 /**************************************************************************** |
|
2 ** |
|
3 ** Copyright (C) 2009 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 "basicNamespace.h" |
|
44 |
|
45 QT_BEGIN_NAMESPACE |
|
46 |
|
47 using namespace BasicNamespace; |
|
48 |
|
49 Basic::Token Basic::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 Basic::Token Basic::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 Basic::Token Basic::classifier14(const QChar *data) |
|
192 |
|
193 { |
|
194 |
|
195 static const unsigned short string[] = |
|
196 { |
|
197 99, 111, 108, 111, 110, 58, 105, 110, 58, 110, 97, 109, 101, 58 |
|
198 }; |
|
199 if(memcmp(&data[0], &string, sizeof(QChar) * 14) == 0) |
|
200 |
|
201 |
|
202 return ColonInName; |
|
203 |
|
204 |
|
205 return NoKeyword; |
|
206 } |
|
207 Basic::Token Basic::classifier44(const QChar *data) |
|
208 |
|
209 { |
|
210 |
|
211 static const unsigned short string[] = |
|
212 { |
|
213 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 |
|
214 }; |
|
215 if(memcmp(&data[0], &string, sizeof(QChar) * 44) == 0) |
|
216 |
|
217 |
|
218 return AReallyLongTokenIFreakinMeanItUKnowUKnowKnow; |
|
219 |
|
220 |
|
221 return NoKeyword; |
|
222 } |
|
223 Basic::Token Basic::toToken(const QChar *data, int length) |
|
224 { |
|
225 switch(length) |
|
226 { |
|
227 |
|
228 case 3: |
|
229 return classifier3(data); |
|
230 |
|
231 |
|
232 case 4: |
|
233 return classifier4(data); |
|
234 |
|
235 |
|
236 case 14: |
|
237 return classifier14(data); |
|
238 |
|
239 |
|
240 case 44: |
|
241 return classifier44(data); |
|
242 |
|
243 |
|
244 default: |
|
245 return NoKeyword; |
|
246 } |
|
247 } |
|
248 |
|
249 |
|
250 QString Basic::toString(Token token) |
|
251 { |
|
252 const unsigned short *data = 0; |
|
253 int length = 0; |
|
254 |
|
255 switch(token) |
|
256 { |
|
257 |
|
258 case AReallyLongTokenIFreakinMeanItUKnowUKnowKnow: |
|
259 { |
|
260 static const unsigned short staticallyStoredAReallyLongTokenIFreakinMeanItUKnowUKnowKnow[] = |
|
261 { |
|
262 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 |
|
263 }; |
|
264 data = staticallyStoredAReallyLongTokenIFreakinMeanItUKnowUKnowKnow; |
|
265 length = 44; |
|
266 break; |
|
267 } |
|
268 |
|
269 case ColonInName: |
|
270 { |
|
271 static const unsigned short staticallyStoredColonInName[] = |
|
272 { |
|
273 99, 111, 108, 111, 110, 58, 105, 110, 58, 110, 97, 109, 101, 58, 0 |
|
274 }; |
|
275 data = staticallyStoredColonInName; |
|
276 length = 14; |
|
277 break; |
|
278 } |
|
279 |
|
280 case FFFF: |
|
281 { |
|
282 static const unsigned short staticallyStoredFFFF[] = |
|
283 { |
|
284 70, 70, 70, 70, 0 |
|
285 }; |
|
286 data = staticallyStoredFFFF; |
|
287 length = 4; |
|
288 break; |
|
289 } |
|
290 |
|
291 case FFFG: |
|
292 { |
|
293 static const unsigned short staticallyStoredFFFG[] = |
|
294 { |
|
295 70, 70, 70, 71, 0 |
|
296 }; |
|
297 data = staticallyStoredFFFG; |
|
298 length = 4; |
|
299 break; |
|
300 } |
|
301 |
|
302 case FFGF: |
|
303 { |
|
304 static const unsigned short staticallyStoredFFGF[] = |
|
305 { |
|
306 70, 70, 71, 70, 0 |
|
307 }; |
|
308 data = staticallyStoredFFGF; |
|
309 length = 4; |
|
310 break; |
|
311 } |
|
312 |
|
313 case FFGG: |
|
314 { |
|
315 static const unsigned short staticallyStoredFFGG[] = |
|
316 { |
|
317 70, 70, 71, 71, 0 |
|
318 }; |
|
319 data = staticallyStoredFFGG; |
|
320 length = 4; |
|
321 break; |
|
322 } |
|
323 |
|
324 case FFLM: |
|
325 { |
|
326 static const unsigned short staticallyStoredFFLM[] = |
|
327 { |
|
328 70, 70, 76, 77, 0 |
|
329 }; |
|
330 data = staticallyStoredFFLM; |
|
331 length = 4; |
|
332 break; |
|
333 } |
|
334 |
|
335 case _: |
|
336 { |
|
337 static const unsigned short staticallyStored_[] = |
|
338 { |
|
339 97, 98, 99, 0 |
|
340 }; |
|
341 data = staticallyStored_; |
|
342 length = 3; |
|
343 break; |
|
344 } |
|
345 |
|
346 case _111: |
|
347 { |
|
348 static const unsigned short staticallyStored_111[] = |
|
349 { |
|
350 100, 101, 102, 0 |
|
351 }; |
|
352 data = staticallyStored_111; |
|
353 length = 3; |
|
354 break; |
|
355 } |
|
356 |
|
357 case wobbly: |
|
358 { |
|
359 static const unsigned short staticallyStoredwobbly[] = |
|
360 { |
|
361 103, 104, 105, 0 |
|
362 }; |
|
363 data = staticallyStoredwobbly; |
|
364 length = 3; |
|
365 break; |
|
366 } |
|
367 |
|
368 default: |
|
369 /* It's either the default token, or an undefined enum |
|
370 * value. We silence a compiler warning, and return the |
|
371 * empty string. */ |
|
372 ; |
|
373 } |
|
374 |
|
375 union |
|
376 { |
|
377 const unsigned short *data; |
|
378 const QChar *asQChar; |
|
379 } converter; |
|
380 converter.data = data; |
|
381 |
|
382 return QString::fromRawData(converter.asQChar, length); |
|
383 } |
|
384 |
|
385 QT_END_NAMESPACE |
|
386 |