Differential D24817 Diff 68400 src/scripting/qtbindings/generated_cpp/com_trolltech_qt_core/qtscript_QBitArray.cpp
Changeset View
Changeset View
Standalone View
Standalone View
src/scripting/qtbindings/generated_cpp/com_trolltech_qt_core/qtscript_QBitArray.cpp
- This file was added.
1 | #include <QtScript/QScriptEngine> | ||||
---|---|---|---|---|---|
2 | #include <QtScript/QScriptContext> | ||||
3 | #include <QtScript/QScriptValue> | ||||
4 | #include <QtCore/QStringList> | ||||
5 | #include <QtCore/QDebug> | ||||
6 | #include <qmetaobject.h> | ||||
7 | #include <__package_shared.h> | ||||
8 | | ||||
9 | #include <qbitarray.h> | ||||
10 | #include <QVariant> | ||||
11 | #include <qbitarray.h> | ||||
12 | | ||||
13 | static const char * const qtscript_QBitArray_function_names[] = { | ||||
14 | "QBitArray" | ||||
15 | // static | ||||
16 | // prototype | ||||
17 | , "at" | ||||
18 | , "clear" | ||||
19 | , "clearBit" | ||||
20 | , "count" | ||||
21 | , "fill" | ||||
22 | , "isEmpty" | ||||
23 | , "isNull" | ||||
24 | , "operator_and_assign" | ||||
25 | , "operator_assign" | ||||
26 | , "equals" | ||||
27 | , "operator_negate" | ||||
28 | , "operator_or_assign" | ||||
29 | , "operator_xor_assign" | ||||
30 | , "resize" | ||||
31 | , "setBit" | ||||
32 | , "size" | ||||
33 | , "swap" | ||||
34 | , "testBit" | ||||
35 | , "toggleBit" | ||||
36 | , "truncate" | ||||
37 | , "toString" | ||||
38 | }; | ||||
39 | | ||||
40 | static const char * const qtscript_QBitArray_function_signatures[] = { | ||||
41 | "\nQBitArray other\nint size, bool val" | ||||
42 | // static | ||||
43 | // prototype | ||||
44 | , "int i" | ||||
45 | , "" | ||||
46 | , "int i" | ||||
47 | , "\nbool on" | ||||
48 | , "bool val, int first, int last\nbool val, int size" | ||||
49 | , "" | ||||
50 | , "" | ||||
51 | , "QBitArray arg__1" | ||||
52 | , "QBitArray other" | ||||
53 | , "QBitArray other" | ||||
54 | , "" | ||||
55 | , "QBitArray arg__1" | ||||
56 | , "QBitArray arg__1" | ||||
57 | , "int size" | ||||
58 | , "int i\nint i, bool val" | ||||
59 | , "" | ||||
60 | , "QBitArray other" | ||||
61 | , "int i" | ||||
62 | , "int i" | ||||
63 | , "int pos" | ||||
64 | "" | ||||
65 | }; | ||||
66 | | ||||
67 | static const int qtscript_QBitArray_function_lengths[] = { | ||||
68 | 2 | ||||
69 | // static | ||||
70 | // prototype | ||||
71 | , 1 | ||||
72 | , 0 | ||||
73 | , 1 | ||||
74 | , 1 | ||||
75 | , 3 | ||||
76 | , 0 | ||||
77 | , 0 | ||||
78 | , 1 | ||||
79 | , 1 | ||||
80 | , 1 | ||||
81 | , 0 | ||||
82 | , 1 | ||||
83 | , 1 | ||||
84 | , 1 | ||||
85 | , 2 | ||||
86 | , 0 | ||||
87 | , 1 | ||||
88 | , 1 | ||||
89 | , 1 | ||||
90 | , 1 | ||||
91 | , 0 | ||||
92 | }; | ||||
93 | | ||||
94 | static QScriptValue qtscript_QBitArray_throw_ambiguity_error_helper( | ||||
95 | QScriptContext *context, const char *functionName, const char *signatures) | ||||
96 | { | ||||
97 | QStringList lines = QString::fromLatin1(signatures).split(QLatin1Char('\n')); | ||||
98 | QStringList fullSignatures; | ||||
99 | for (int i = 0; i < lines.size(); ++i) | ||||
100 | fullSignatures.append(QString::fromLatin1("%0(%1)").arg(functionName).arg(lines.at(i))); | ||||
101 | return context->throwError(QString::fromLatin1("QBitArray::%0(): could not find a function match; candidates are:\n%1") | ||||
102 | .arg(functionName).arg(fullSignatures.join(QLatin1String("\n")))); | ||||
103 | } | ||||
104 | | ||||
105 | Q_DECLARE_METATYPE(QBitArray*) | ||||
106 | | ||||
107 | // | ||||
108 | // QBitArray | ||||
109 | // | ||||
110 | | ||||
111 | static QScriptValue qtscript_QBitArray_prototype_call(QScriptContext *context, QScriptEngine *) | ||||
112 | { | ||||
113 | #if QT_VERSION > 0x040400 | ||||
114 | Q_ASSERT(context->callee().isFunction()); | ||||
115 | uint _id = context->callee().data().toUInt32(); | ||||
116 | #else | ||||
117 | uint _id; | ||||
118 | if (context->callee().isFunction()) | ||||
119 | _id = context->callee().data().toUInt32(); | ||||
120 | else | ||||
121 | _id = 0xBABE0000 + 20; | ||||
122 | #endif | ||||
123 | Q_ASSERT((_id & 0xFFFF0000) == 0xBABE0000); | ||||
124 | _id &= 0x0000FFFF; | ||||
125 | QBitArray* _q_self = qscriptvalue_cast<QBitArray*>(context->thisObject()); | ||||
126 | if (!_q_self) { | ||||
127 | return context->throwError(QScriptContext::TypeError, | ||||
128 | QString::fromLatin1("QBitArray.%0(): this object is not a QBitArray") | ||||
129 | .arg(qtscript_QBitArray_function_names[_id+1])); | ||||
130 | } | ||||
131 | | ||||
132 | switch (_id) { | ||||
133 | case 0: | ||||
134 | if (context->argumentCount() == 1) { | ||||
135 | | ||||
136 | // TEMPLATE - core.convert_int_arg_and_check_range - START | ||||
137 | int _q_arg0 = context->argument(0).toInt32(); | ||||
138 | if ((_q_arg0 < 0) || (_q_self->size() < _q_arg0)) { | ||||
139 | return context->throwError(QScriptContext::RangeError, | ||||
140 | QString::fromLatin1("QBitArray::at(): index out of range")); | ||||
141 | } | ||||
142 | // TEMPLATE - core.convert_int_arg_and_check_range - END | ||||
143 | bool _q_result = _q_self->at(_q_arg0); | ||||
144 | return QScriptValue(context->engine(), _q_result); | ||||
145 | } | ||||
146 | break; | ||||
147 | | ||||
148 | case 1: | ||||
149 | if (context->argumentCount() == 0) { | ||||
150 | _q_self->clear(); | ||||
151 | return context->engine()->undefinedValue(); | ||||
152 | } | ||||
153 | break; | ||||
154 | | ||||
155 | case 2: | ||||
156 | if (context->argumentCount() == 1) { | ||||
157 | | ||||
158 | // TEMPLATE - core.convert_int_arg_and_check_range - START | ||||
159 | int _q_arg0 = context->argument(0).toInt32(); | ||||
160 | if ((_q_arg0 < 0) || (_q_self->size() < _q_arg0)) { | ||||
161 | return context->throwError(QScriptContext::RangeError, | ||||
162 | QString::fromLatin1("QBitArray::clearBit(): index out of range")); | ||||
163 | } | ||||
164 | // TEMPLATE - core.convert_int_arg_and_check_range - END | ||||
165 | _q_self->clearBit(_q_arg0); | ||||
166 | return context->engine()->undefinedValue(); | ||||
167 | } | ||||
168 | break; | ||||
169 | | ||||
170 | case 3: | ||||
171 | if (context->argumentCount() == 0) { | ||||
172 | int _q_result = _q_self->count(); | ||||
173 | return QScriptValue(context->engine(), _q_result); | ||||
174 | } | ||||
175 | if (context->argumentCount() == 1) { | ||||
176 | bool _q_arg0 = context->argument(0).toBoolean(); | ||||
177 | int _q_result = _q_self->count(_q_arg0); | ||||
178 | return QScriptValue(context->engine(), _q_result); | ||||
179 | } | ||||
180 | break; | ||||
181 | | ||||
182 | case 4: | ||||
183 | if (context->argumentCount() == 1) { | ||||
184 | bool _q_arg0 = context->argument(0).toBoolean(); | ||||
185 | bool _q_result = _q_self->fill(_q_arg0); | ||||
186 | return QScriptValue(context->engine(), _q_result); | ||||
187 | } | ||||
188 | if (context->argumentCount() == 2) { | ||||
189 | bool _q_arg0 = context->argument(0).toBoolean(); | ||||
190 | int _q_arg1 = context->argument(1).toInt32(); | ||||
191 | bool _q_result = _q_self->fill(_q_arg0, _q_arg1); | ||||
192 | return QScriptValue(context->engine(), _q_result); | ||||
193 | } | ||||
194 | if (context->argumentCount() == 3) { | ||||
195 | bool _q_arg0 = context->argument(0).toBoolean(); | ||||
196 | int _q_arg1 = context->argument(1).toInt32(); | ||||
197 | int _q_arg2 = context->argument(2).toInt32(); | ||||
198 | _q_self->fill(_q_arg0, _q_arg1, _q_arg2); | ||||
199 | return context->engine()->undefinedValue(); | ||||
200 | } | ||||
201 | break; | ||||
202 | | ||||
203 | case 5: | ||||
204 | if (context->argumentCount() == 0) { | ||||
205 | bool _q_result = _q_self->isEmpty(); | ||||
206 | return QScriptValue(context->engine(), _q_result); | ||||
207 | } | ||||
208 | break; | ||||
209 | | ||||
210 | case 6: | ||||
211 | if (context->argumentCount() == 0) { | ||||
212 | bool _q_result = _q_self->isNull(); | ||||
213 | return QScriptValue(context->engine(), _q_result); | ||||
214 | } | ||||
215 | break; | ||||
216 | | ||||
217 | case 7: | ||||
218 | if (context->argumentCount() == 1) { | ||||
219 | QBitArray _q_arg0 = qscriptvalue_cast<QBitArray>(context->argument(0)); | ||||
220 | _q_self->operator&=(_q_arg0); | ||||
221 | return context->thisObject(); | ||||
222 | } | ||||
223 | break; | ||||
224 | | ||||
225 | case 8: | ||||
226 | if (context->argumentCount() == 1) { | ||||
227 | QBitArray _q_arg0 = qscriptvalue_cast<QBitArray>(context->argument(0)); | ||||
228 | _q_self->operator=(_q_arg0); | ||||
229 | return context->thisObject(); | ||||
230 | } | ||||
231 | break; | ||||
232 | | ||||
233 | case 9: | ||||
234 | if (context->argumentCount() == 1) { | ||||
235 | QBitArray _q_arg0 = qscriptvalue_cast<QBitArray>(context->argument(0)); | ||||
236 | bool _q_result = _q_self->operator==(_q_arg0); | ||||
237 | return QScriptValue(context->engine(), _q_result); | ||||
238 | } | ||||
239 | break; | ||||
240 | | ||||
241 | case 10: | ||||
242 | if (context->argumentCount() == 0) { | ||||
243 | QBitArray _q_result = _q_self->operator~(); | ||||
244 | return qScriptValueFromValue(context->engine(), _q_result); | ||||
245 | } | ||||
246 | break; | ||||
247 | | ||||
248 | case 11: | ||||
249 | if (context->argumentCount() == 1) { | ||||
250 | QBitArray _q_arg0 = qscriptvalue_cast<QBitArray>(context->argument(0)); | ||||
251 | _q_self->operator|=(_q_arg0); | ||||
252 | return context->thisObject(); | ||||
253 | } | ||||
254 | break; | ||||
255 | | ||||
256 | case 12: | ||||
257 | if (context->argumentCount() == 1) { | ||||
258 | QBitArray _q_arg0 = qscriptvalue_cast<QBitArray>(context->argument(0)); | ||||
259 | _q_self->operator^=(_q_arg0); | ||||
260 | return context->thisObject(); | ||||
261 | } | ||||
262 | break; | ||||
263 | | ||||
264 | case 13: | ||||
265 | if (context->argumentCount() == 1) { | ||||
266 | int _q_arg0 = context->argument(0).toInt32(); | ||||
267 | _q_self->resize(_q_arg0); | ||||
268 | return context->engine()->undefinedValue(); | ||||
269 | } | ||||
270 | break; | ||||
271 | | ||||
272 | case 14: | ||||
273 | if (context->argumentCount() == 1) { | ||||
274 | | ||||
275 | // TEMPLATE - core.convert_int_arg_and_check_range - START | ||||
276 | int _q_arg0 = context->argument(0).toInt32(); | ||||
277 | if ((_q_arg0 < 0) || (_q_self->size() < _q_arg0)) { | ||||
278 | return context->throwError(QScriptContext::RangeError, | ||||
279 | QString::fromLatin1("QBitArray::setBit(): index out of range")); | ||||
280 | } | ||||
281 | // TEMPLATE - core.convert_int_arg_and_check_range - END | ||||
282 | _q_self->setBit(_q_arg0); | ||||
283 | return context->engine()->undefinedValue(); | ||||
284 | } | ||||
285 | if (context->argumentCount() == 2) { | ||||
286 | | ||||
287 | // TEMPLATE - core.convert_int_arg_and_check_range - START | ||||
288 | int _q_arg0 = context->argument(0).toInt32(); | ||||
289 | if ((_q_arg0 < 0) || (_q_self->size() < _q_arg0)) { | ||||
290 | return context->throwError(QScriptContext::RangeError, | ||||
291 | QString::fromLatin1("QBitArray::setBit(): index out of range")); | ||||
292 | } | ||||
293 | // TEMPLATE - core.convert_int_arg_and_check_range - END | ||||
294 | bool _q_arg1 = context->argument(1).toBoolean(); | ||||
295 | _q_self->setBit(_q_arg0, _q_arg1); | ||||
296 | return context->engine()->undefinedValue(); | ||||
297 | } | ||||
298 | break; | ||||
299 | | ||||
300 | case 15: | ||||
301 | if (context->argumentCount() == 0) { | ||||
302 | int _q_result = _q_self->size(); | ||||
303 | return QScriptValue(context->engine(), _q_result); | ||||
304 | } | ||||
305 | break; | ||||
306 | | ||||
307 | case 16: | ||||
308 | if (context->argumentCount() == 1) { | ||||
309 | QBitArray _q_arg0 = qscriptvalue_cast<QBitArray>(context->argument(0)); | ||||
310 | _q_self->swap(_q_arg0); | ||||
311 | return context->engine()->undefinedValue(); | ||||
312 | } | ||||
313 | break; | ||||
314 | | ||||
315 | case 17: | ||||
316 | if (context->argumentCount() == 1) { | ||||
317 | | ||||
318 | // TEMPLATE - core.convert_int_arg_and_check_range - START | ||||
319 | int _q_arg0 = context->argument(0).toInt32(); | ||||
320 | if ((_q_arg0 < 0) || (_q_self->size() < _q_arg0)) { | ||||
321 | return context->throwError(QScriptContext::RangeError, | ||||
322 | QString::fromLatin1("QBitArray::testBit(): index out of range")); | ||||
323 | } | ||||
324 | // TEMPLATE - core.convert_int_arg_and_check_range - END | ||||
325 | bool _q_result = _q_self->testBit(_q_arg0); | ||||
326 | return QScriptValue(context->engine(), _q_result); | ||||
327 | } | ||||
328 | break; | ||||
329 | | ||||
330 | case 18: | ||||
331 | if (context->argumentCount() == 1) { | ||||
332 | | ||||
333 | // TEMPLATE - core.convert_int_arg_and_check_range - START | ||||
334 | int _q_arg0 = context->argument(0).toInt32(); | ||||
335 | if ((_q_arg0 < 0) || (_q_self->size() < _q_arg0)) { | ||||
336 | return context->throwError(QScriptContext::RangeError, | ||||
337 | QString::fromLatin1("QBitArray::toggleBit(): index out of range")); | ||||
338 | } | ||||
339 | // TEMPLATE - core.convert_int_arg_and_check_range - END | ||||
340 | bool _q_result = _q_self->toggleBit(_q_arg0); | ||||
341 | return QScriptValue(context->engine(), _q_result); | ||||
342 | } | ||||
343 | break; | ||||
344 | | ||||
345 | case 19: | ||||
346 | if (context->argumentCount() == 1) { | ||||
347 | int _q_arg0 = context->argument(0).toInt32(); | ||||
348 | _q_self->truncate(_q_arg0); | ||||
349 | return context->engine()->undefinedValue(); | ||||
350 | } | ||||
351 | break; | ||||
352 | | ||||
353 | case 20: { | ||||
354 | QString result; | ||||
355 | QDebug d(&result); | ||||
356 | d << *_q_self; | ||||
357 | return QScriptValue(context->engine(), result); | ||||
358 | } | ||||
359 | | ||||
360 | default: | ||||
361 | Q_ASSERT(false); | ||||
362 | } | ||||
363 | return qtscript_QBitArray_throw_ambiguity_error_helper(context, | ||||
364 | qtscript_QBitArray_function_names[_id+1], | ||||
365 | qtscript_QBitArray_function_signatures[_id+1]); | ||||
366 | } | ||||
367 | | ||||
368 | static QScriptValue qtscript_QBitArray_static_call(QScriptContext *context, QScriptEngine *) | ||||
369 | { | ||||
370 | uint _id = context->callee().data().toUInt32(); | ||||
371 | Q_ASSERT((_id & 0xFFFF0000) == 0xBABE0000); | ||||
372 | _id &= 0x0000FFFF; | ||||
373 | switch (_id) { | ||||
374 | case 0: | ||||
375 | if (context->thisObject().strictlyEquals(context->engine()->globalObject())) { | ||||
376 | return context->throwError(QString::fromLatin1("QBitArray(): Did you forget to construct with 'new'?")); | ||||
377 | } | ||||
378 | if (context->argumentCount() == 0) { | ||||
379 | QBitArray _q_cpp_result; | ||||
380 | QScriptValue _q_result = context->engine()->newVariant(context->thisObject(), qVariantFromValue(_q_cpp_result)); | ||||
381 | return _q_result; | ||||
382 | } else if (context->argumentCount() == 1) { | ||||
383 | if ((qMetaTypeId<QBitArray>() == context->argument(0).toVariant().userType())) { | ||||
384 | QBitArray _q_arg0 = qscriptvalue_cast<QBitArray>(context->argument(0)); | ||||
385 | QBitArray _q_cpp_result(_q_arg0); | ||||
386 | QScriptValue _q_result = context->engine()->newVariant(context->thisObject(), qVariantFromValue(_q_cpp_result)); | ||||
387 | return _q_result; | ||||
388 | } else if (context->argument(0).isNumber()) { | ||||
389 | int _q_arg0 = context->argument(0).toInt32(); | ||||
390 | QBitArray _q_cpp_result(_q_arg0); | ||||
391 | QScriptValue _q_result = context->engine()->newVariant(context->thisObject(), qVariantFromValue(_q_cpp_result)); | ||||
392 | return _q_result; | ||||
393 | } | ||||
394 | } else if (context->argumentCount() == 2) { | ||||
395 | int _q_arg0 = context->argument(0).toInt32(); | ||||
396 | bool _q_arg1 = context->argument(1).toBoolean(); | ||||
397 | QBitArray _q_cpp_result(_q_arg0, _q_arg1); | ||||
398 | QScriptValue _q_result = context->engine()->newVariant(context->thisObject(), qVariantFromValue(_q_cpp_result)); | ||||
399 | return _q_result; | ||||
400 | } | ||||
401 | break; | ||||
402 | | ||||
403 | default: | ||||
404 | Q_ASSERT(false); | ||||
405 | } | ||||
406 | return qtscript_QBitArray_throw_ambiguity_error_helper(context, | ||||
407 | qtscript_QBitArray_function_names[_id], | ||||
408 | qtscript_QBitArray_function_signatures[_id]); | ||||
409 | } | ||||
410 | | ||||
411 | QScriptValue qtscript_create_QBitArray_class(QScriptEngine *engine) | ||||
412 | { | ||||
413 | engine->setDefaultPrototype(qMetaTypeId<QBitArray*>(), QScriptValue()); | ||||
414 | QScriptValue proto = engine->newVariant(qVariantFromValue((QBitArray*)0)); | ||||
415 | for (int i = 0; i < 21; ++i) { | ||||
416 | QScriptValue fun = engine->newFunction(qtscript_QBitArray_prototype_call, qtscript_QBitArray_function_lengths[i+1]); | ||||
417 | fun.setData(QScriptValue(engine, uint(0xBABE0000 + i))); | ||||
418 | proto.setProperty(QString::fromLatin1(qtscript_QBitArray_function_names[i+1]), | ||||
419 | fun, QScriptValue::SkipInEnumeration); | ||||
420 | } | ||||
421 | | ||||
422 | engine->setDefaultPrototype(qMetaTypeId<QBitArray>(), proto); | ||||
423 | engine->setDefaultPrototype(qMetaTypeId<QBitArray*>(), proto); | ||||
424 | | ||||
425 | QScriptValue ctor = engine->newFunction(qtscript_QBitArray_static_call, proto, qtscript_QBitArray_function_lengths[0]); | ||||
426 | ctor.setData(QScriptValue(engine, uint(0xBABE0000 + 0))); | ||||
427 | | ||||
428 | return ctor; | ||||
429 | } |