Differential D24817 Diff 68400 src/scripting/qtbindings/generated_cpp/com_trolltech_qt_core/qtscript_QDate.cpp
Changeset View
Changeset View
Standalone View
Standalone View
src/scripting/qtbindings/generated_cpp/com_trolltech_qt_core/qtscript_QDate.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 <qdatetime.h> | ||||
10 | #include <QVariant> | ||||
11 | #include <qdatetime.h> | ||||
12 | | ||||
13 | static const char * const qtscript_QDate_function_names[] = { | ||||
14 | "QDate" | ||||
15 | // static | ||||
16 | , "currentDate" | ||||
17 | , "fromJulianDay" | ||||
18 | , "fromString" | ||||
19 | , "isLeapYear" | ||||
20 | , "isValid" | ||||
21 | , "longDayName" | ||||
22 | , "longMonthName" | ||||
23 | , "shortDayName" | ||||
24 | , "shortMonthName" | ||||
25 | // prototype | ||||
26 | , "addDays" | ||||
27 | , "addMonths" | ||||
28 | , "addYears" | ||||
29 | , "day" | ||||
30 | , "dayOfWeek" | ||||
31 | , "dayOfYear" | ||||
32 | , "daysInMonth" | ||||
33 | , "daysInYear" | ||||
34 | , "daysTo" | ||||
35 | , "getDate" | ||||
36 | , "isNull" | ||||
37 | , "isValid" | ||||
38 | , "month" | ||||
39 | , "equals" | ||||
40 | , "operator_less" | ||||
41 | , "setDate" | ||||
42 | , "toJulianDay" | ||||
43 | , "toString" | ||||
44 | , "weekNumber" | ||||
45 | , "year" | ||||
46 | }; | ||||
47 | | ||||
48 | static const char * const qtscript_QDate_function_signatures[] = { | ||||
49 | "\nint y, int m, int d" | ||||
50 | // static | ||||
51 | , "" | ||||
52 | , "qint64 jd" | ||||
53 | , "String s, DateFormat f\nString s, String format" | ||||
54 | , "int year" | ||||
55 | , "int y, int m, int d" | ||||
56 | , "int weekday, MonthNameType type" | ||||
57 | , "int month, MonthNameType type" | ||||
58 | , "int weekday, MonthNameType type" | ||||
59 | , "int month, MonthNameType type" | ||||
60 | // prototype | ||||
61 | , "qint64 days" | ||||
62 | , "int months" | ||||
63 | , "int years" | ||||
64 | , "" | ||||
65 | , "" | ||||
66 | , "" | ||||
67 | , "" | ||||
68 | , "" | ||||
69 | , "QDate arg__1" | ||||
70 | , "int year, int month, int day" | ||||
71 | , "" | ||||
72 | , "" | ||||
73 | , "" | ||||
74 | , "QDate other" | ||||
75 | , "QDate other" | ||||
76 | , "int year, int month, int day" | ||||
77 | , "" | ||||
78 | , "DateFormat f\nString format" | ||||
79 | , "int yearNum" | ||||
80 | , "" | ||||
81 | }; | ||||
82 | | ||||
83 | static const int qtscript_QDate_function_lengths[] = { | ||||
84 | 3 | ||||
85 | // static | ||||
86 | , 0 | ||||
87 | , 1 | ||||
88 | , 2 | ||||
89 | , 1 | ||||
90 | , 3 | ||||
91 | , 2 | ||||
92 | , 2 | ||||
93 | , 2 | ||||
94 | , 2 | ||||
95 | // prototype | ||||
96 | , 1 | ||||
97 | , 1 | ||||
98 | , 1 | ||||
99 | , 0 | ||||
100 | , 0 | ||||
101 | , 0 | ||||
102 | , 0 | ||||
103 | , 0 | ||||
104 | , 1 | ||||
105 | , 3 | ||||
106 | , 0 | ||||
107 | , 0 | ||||
108 | , 0 | ||||
109 | , 1 | ||||
110 | , 1 | ||||
111 | , 3 | ||||
112 | , 0 | ||||
113 | , 1 | ||||
114 | , 1 | ||||
115 | , 0 | ||||
116 | }; | ||||
117 | | ||||
118 | static QScriptValue qtscript_QDate_throw_ambiguity_error_helper( | ||||
119 | QScriptContext *context, const char *functionName, const char *signatures) | ||||
120 | { | ||||
121 | QStringList lines = QString::fromLatin1(signatures).split(QLatin1Char('\n')); | ||||
122 | QStringList fullSignatures; | ||||
123 | for (int i = 0; i < lines.size(); ++i) | ||||
124 | fullSignatures.append(QString::fromLatin1("%0(%1)").arg(functionName).arg(lines.at(i))); | ||||
125 | return context->throwError(QString::fromLatin1("QDate::%0(): could not find a function match; candidates are:\n%1") | ||||
126 | .arg(functionName).arg(fullSignatures.join(QLatin1String("\n")))); | ||||
127 | } | ||||
128 | | ||||
129 | Q_DECLARE_METATYPE(QDate*) | ||||
130 | Q_DECLARE_METATYPE(QDate::MonthNameType) | ||||
131 | Q_DECLARE_METATYPE(int*) | ||||
132 | Q_DECLARE_METATYPE(Qt::DateFormat) | ||||
133 | | ||||
134 | static QScriptValue qtscript_create_enum_class_helper( | ||||
135 | QScriptEngine *engine, | ||||
136 | QScriptEngine::FunctionSignature construct, | ||||
137 | QScriptEngine::FunctionSignature valueOf, | ||||
138 | QScriptEngine::FunctionSignature toString) | ||||
139 | { | ||||
140 | QScriptValue proto = engine->newObject(); | ||||
141 | proto.setProperty(QString::fromLatin1("valueOf"), | ||||
142 | engine->newFunction(valueOf), QScriptValue::SkipInEnumeration); | ||||
143 | proto.setProperty(QString::fromLatin1("toString"), | ||||
144 | engine->newFunction(toString), QScriptValue::SkipInEnumeration); | ||||
145 | return engine->newFunction(construct, proto, 1); | ||||
146 | } | ||||
147 | | ||||
148 | // | ||||
149 | // QDate::MonthNameType | ||||
150 | // | ||||
151 | | ||||
152 | static const QDate::MonthNameType qtscript_QDate_MonthNameType_values[] = { | ||||
153 | QDate::DateFormat | ||||
154 | , QDate::StandaloneFormat | ||||
155 | }; | ||||
156 | | ||||
157 | static const char * const qtscript_QDate_MonthNameType_keys[] = { | ||||
158 | "DateFormat" | ||||
159 | , "StandaloneFormat" | ||||
160 | }; | ||||
161 | | ||||
162 | static QString qtscript_QDate_MonthNameType_toStringHelper(QDate::MonthNameType value) | ||||
163 | { | ||||
164 | if ((value >= QDate::DateFormat) && (value <= QDate::StandaloneFormat)) | ||||
165 | return qtscript_QDate_MonthNameType_keys[static_cast<int>(value)-static_cast<int>(QDate::DateFormat)]; | ||||
166 | return QString(); | ||||
167 | } | ||||
168 | | ||||
169 | static QScriptValue qtscript_QDate_MonthNameType_toScriptValue(QScriptEngine *engine, const QDate::MonthNameType &value) | ||||
170 | { | ||||
171 | QScriptValue clazz = engine->globalObject().property(QString::fromLatin1("QDate")); | ||||
172 | return clazz.property(qtscript_QDate_MonthNameType_toStringHelper(value)); | ||||
173 | } | ||||
174 | | ||||
175 | static void qtscript_QDate_MonthNameType_fromScriptValue(const QScriptValue &value, QDate::MonthNameType &out) | ||||
176 | { | ||||
177 | out = qvariant_cast<QDate::MonthNameType>(value.toVariant()); | ||||
178 | } | ||||
179 | | ||||
180 | static QScriptValue qtscript_construct_QDate_MonthNameType(QScriptContext *context, QScriptEngine *engine) | ||||
181 | { | ||||
182 | int arg = context->argument(0).toInt32(); | ||||
183 | if ((arg >= QDate::DateFormat) && (arg <= QDate::StandaloneFormat)) | ||||
184 | return qScriptValueFromValue(engine, static_cast<QDate::MonthNameType>(arg)); | ||||
185 | return context->throwError(QString::fromLatin1("MonthNameType(): invalid enum value (%0)").arg(arg)); | ||||
186 | } | ||||
187 | | ||||
188 | static QScriptValue qtscript_QDate_MonthNameType_valueOf(QScriptContext *context, QScriptEngine *engine) | ||||
189 | { | ||||
190 | QDate::MonthNameType value = qscriptvalue_cast<QDate::MonthNameType>(context->thisObject()); | ||||
191 | return QScriptValue(engine, static_cast<int>(value)); | ||||
192 | } | ||||
193 | | ||||
194 | static QScriptValue qtscript_QDate_MonthNameType_toString(QScriptContext *context, QScriptEngine *engine) | ||||
195 | { | ||||
196 | QDate::MonthNameType value = qscriptvalue_cast<QDate::MonthNameType>(context->thisObject()); | ||||
197 | return QScriptValue(engine, qtscript_QDate_MonthNameType_toStringHelper(value)); | ||||
198 | } | ||||
199 | | ||||
200 | static QScriptValue qtscript_create_QDate_MonthNameType_class(QScriptEngine *engine, QScriptValue &clazz) | ||||
201 | { | ||||
202 | QScriptValue ctor = qtscript_create_enum_class_helper( | ||||
203 | engine, qtscript_construct_QDate_MonthNameType, | ||||
204 | qtscript_QDate_MonthNameType_valueOf, qtscript_QDate_MonthNameType_toString); | ||||
205 | qScriptRegisterMetaType<QDate::MonthNameType>(engine, qtscript_QDate_MonthNameType_toScriptValue, | ||||
206 | qtscript_QDate_MonthNameType_fromScriptValue, ctor.property(QString::fromLatin1("prototype"))); | ||||
207 | for (int i = 0; i < 2; ++i) { | ||||
208 | clazz.setProperty(QString::fromLatin1(qtscript_QDate_MonthNameType_keys[i]), | ||||
209 | engine->newVariant(qVariantFromValue(qtscript_QDate_MonthNameType_values[i])), | ||||
210 | QScriptValue::ReadOnly | QScriptValue::Undeletable); | ||||
211 | } | ||||
212 | return ctor; | ||||
213 | } | ||||
214 | | ||||
215 | // | ||||
216 | // QDate | ||||
217 | // | ||||
218 | | ||||
219 | static QScriptValue qtscript_QDate_prototype_call(QScriptContext *context, QScriptEngine *) | ||||
220 | { | ||||
221 | #if QT_VERSION > 0x040400 | ||||
222 | Q_ASSERT(context->callee().isFunction()); | ||||
223 | uint _id = context->callee().data().toUInt32(); | ||||
224 | #else | ||||
225 | uint _id; | ||||
226 | if (context->callee().isFunction()) | ||||
227 | _id = context->callee().data().toUInt32(); | ||||
228 | else | ||||
229 | _id = 0xBABE0000 + 20; | ||||
230 | #endif | ||||
231 | Q_ASSERT((_id & 0xFFFF0000) == 0xBABE0000); | ||||
232 | _id &= 0x0000FFFF; | ||||
233 | QDate* _q_self = qscriptvalue_cast<QDate*>(context->thisObject()); | ||||
234 | if (!_q_self) { | ||||
235 | return context->throwError(QScriptContext::TypeError, | ||||
236 | QString::fromLatin1("QDate.%0(): this object is not a QDate") | ||||
237 | .arg(qtscript_QDate_function_names[_id+10])); | ||||
238 | } | ||||
239 | | ||||
240 | switch (_id) { | ||||
241 | case 0: | ||||
242 | if (context->argumentCount() == 1) { | ||||
243 | qint64 _q_arg0 = qscriptvalue_cast<qint64>(context->argument(0)); | ||||
244 | QDate _q_result = _q_self->addDays(_q_arg0); | ||||
245 | return qScriptValueFromValue(context->engine(), _q_result); | ||||
246 | } | ||||
247 | break; | ||||
248 | | ||||
249 | case 1: | ||||
250 | if (context->argumentCount() == 1) { | ||||
251 | int _q_arg0 = context->argument(0).toInt32(); | ||||
252 | QDate _q_result = _q_self->addMonths(_q_arg0); | ||||
253 | return qScriptValueFromValue(context->engine(), _q_result); | ||||
254 | } | ||||
255 | break; | ||||
256 | | ||||
257 | case 2: | ||||
258 | if (context->argumentCount() == 1) { | ||||
259 | int _q_arg0 = context->argument(0).toInt32(); | ||||
260 | QDate _q_result = _q_self->addYears(_q_arg0); | ||||
261 | return qScriptValueFromValue(context->engine(), _q_result); | ||||
262 | } | ||||
263 | break; | ||||
264 | | ||||
265 | case 3: | ||||
266 | if (context->argumentCount() == 0) { | ||||
267 | int _q_result = _q_self->day(); | ||||
268 | return QScriptValue(context->engine(), _q_result); | ||||
269 | } | ||||
270 | break; | ||||
271 | | ||||
272 | case 4: | ||||
273 | if (context->argumentCount() == 0) { | ||||
274 | int _q_result = _q_self->dayOfWeek(); | ||||
275 | return QScriptValue(context->engine(), _q_result); | ||||
276 | } | ||||
277 | break; | ||||
278 | | ||||
279 | case 5: | ||||
280 | if (context->argumentCount() == 0) { | ||||
281 | int _q_result = _q_self->dayOfYear(); | ||||
282 | return QScriptValue(context->engine(), _q_result); | ||||
283 | } | ||||
284 | break; | ||||
285 | | ||||
286 | case 6: | ||||
287 | if (context->argumentCount() == 0) { | ||||
288 | int _q_result = _q_self->daysInMonth(); | ||||
289 | return QScriptValue(context->engine(), _q_result); | ||||
290 | } | ||||
291 | break; | ||||
292 | | ||||
293 | case 7: | ||||
294 | if (context->argumentCount() == 0) { | ||||
295 | int _q_result = _q_self->daysInYear(); | ||||
296 | return QScriptValue(context->engine(), _q_result); | ||||
297 | } | ||||
298 | break; | ||||
299 | | ||||
300 | case 8: | ||||
301 | if (context->argumentCount() == 1) { | ||||
302 | QDate _q_arg0 = qscriptvalue_cast<QDate>(context->argument(0)); | ||||
303 | qint64 _q_result = _q_self->daysTo(_q_arg0); | ||||
304 | return qScriptValueFromValue(context->engine(), _q_result); | ||||
305 | } | ||||
306 | break; | ||||
307 | | ||||
308 | case 9: | ||||
309 | if (context->argumentCount() == 3) { | ||||
310 | int* _q_arg0 = qscriptvalue_cast<int*>(context->argument(0)); | ||||
311 | int* _q_arg1 = qscriptvalue_cast<int*>(context->argument(1)); | ||||
312 | int* _q_arg2 = qscriptvalue_cast<int*>(context->argument(2)); | ||||
313 | _q_self->getDate(_q_arg0, _q_arg1, _q_arg2); | ||||
314 | return context->engine()->undefinedValue(); | ||||
315 | } | ||||
316 | break; | ||||
317 | | ||||
318 | case 10: | ||||
319 | if (context->argumentCount() == 0) { | ||||
320 | bool _q_result = _q_self->isNull(); | ||||
321 | return QScriptValue(context->engine(), _q_result); | ||||
322 | } | ||||
323 | break; | ||||
324 | | ||||
325 | case 11: | ||||
326 | if (context->argumentCount() == 0) { | ||||
327 | bool _q_result = _q_self->isValid(); | ||||
328 | return QScriptValue(context->engine(), _q_result); | ||||
329 | } | ||||
330 | break; | ||||
331 | | ||||
332 | case 12: | ||||
333 | if (context->argumentCount() == 0) { | ||||
334 | int _q_result = _q_self->month(); | ||||
335 | return QScriptValue(context->engine(), _q_result); | ||||
336 | } | ||||
337 | break; | ||||
338 | | ||||
339 | case 13: | ||||
340 | if (context->argumentCount() == 1) { | ||||
341 | QDate _q_arg0 = qscriptvalue_cast<QDate>(context->argument(0)); | ||||
342 | bool _q_result = _q_self->operator==(_q_arg0); | ||||
343 | return QScriptValue(context->engine(), _q_result); | ||||
344 | } | ||||
345 | break; | ||||
346 | | ||||
347 | case 14: | ||||
348 | if (context->argumentCount() == 1) { | ||||
349 | QDate _q_arg0 = qscriptvalue_cast<QDate>(context->argument(0)); | ||||
350 | bool _q_result = _q_self->operator<(_q_arg0); | ||||
351 | return QScriptValue(context->engine(), _q_result); | ||||
352 | } | ||||
353 | break; | ||||
354 | | ||||
355 | case 15: | ||||
356 | if (context->argumentCount() == 3) { | ||||
357 | int _q_arg0 = context->argument(0).toInt32(); | ||||
358 | int _q_arg1 = context->argument(1).toInt32(); | ||||
359 | int _q_arg2 = context->argument(2).toInt32(); | ||||
360 | bool _q_result = _q_self->setDate(_q_arg0, _q_arg1, _q_arg2); | ||||
361 | return QScriptValue(context->engine(), _q_result); | ||||
362 | } | ||||
363 | break; | ||||
364 | | ||||
365 | case 16: | ||||
366 | if (context->argumentCount() == 0) { | ||||
367 | qint64 _q_result = _q_self->toJulianDay(); | ||||
368 | return qScriptValueFromValue(context->engine(), _q_result); | ||||
369 | } | ||||
370 | break; | ||||
371 | | ||||
372 | case 17: | ||||
373 | if (context->argumentCount() == 0) { | ||||
374 | QString _q_result = _q_self->toString(); | ||||
375 | return QScriptValue(context->engine(), _q_result); | ||||
376 | } | ||||
377 | if (context->argumentCount() == 1) { | ||||
378 | if ((qMetaTypeId<Qt::DateFormat>() == context->argument(0).toVariant().userType())) { | ||||
379 | Qt::DateFormat _q_arg0 = qscriptvalue_cast<Qt::DateFormat>(context->argument(0)); | ||||
380 | QString _q_result = _q_self->toString(_q_arg0); | ||||
381 | return QScriptValue(context->engine(), _q_result); | ||||
382 | } else if (context->argument(0).isString()) { | ||||
383 | QString _q_arg0 = context->argument(0).toString(); | ||||
384 | QString _q_result = _q_self->toString(_q_arg0); | ||||
385 | return QScriptValue(context->engine(), _q_result); | ||||
386 | } | ||||
387 | } | ||||
388 | break; | ||||
389 | | ||||
390 | case 18: | ||||
391 | if (context->argumentCount() == 0) { | ||||
392 | int _q_result = _q_self->weekNumber(); | ||||
393 | return QScriptValue(context->engine(), _q_result); | ||||
394 | } | ||||
395 | if (context->argumentCount() == 1) { | ||||
396 | int* _q_arg0 = qscriptvalue_cast<int*>(context->argument(0)); | ||||
397 | int _q_result = _q_self->weekNumber(_q_arg0); | ||||
398 | return QScriptValue(context->engine(), _q_result); | ||||
399 | } | ||||
400 | break; | ||||
401 | | ||||
402 | case 19: | ||||
403 | if (context->argumentCount() == 0) { | ||||
404 | int _q_result = _q_self->year(); | ||||
405 | return QScriptValue(context->engine(), _q_result); | ||||
406 | } | ||||
407 | break; | ||||
408 | | ||||
409 | default: | ||||
410 | Q_ASSERT(false); | ||||
411 | } | ||||
412 | return qtscript_QDate_throw_ambiguity_error_helper(context, | ||||
413 | qtscript_QDate_function_names[_id+10], | ||||
414 | qtscript_QDate_function_signatures[_id+10]); | ||||
415 | } | ||||
416 | | ||||
417 | static QScriptValue qtscript_QDate_static_call(QScriptContext *context, QScriptEngine *) | ||||
418 | { | ||||
419 | uint _id = context->callee().data().toUInt32(); | ||||
420 | Q_ASSERT((_id & 0xFFFF0000) == 0xBABE0000); | ||||
421 | _id &= 0x0000FFFF; | ||||
422 | switch (_id) { | ||||
423 | case 0: | ||||
424 | if (context->thisObject().strictlyEquals(context->engine()->globalObject())) { | ||||
425 | return context->throwError(QString::fromLatin1("QDate(): Did you forget to construct with 'new'?")); | ||||
426 | } | ||||
427 | if (context->argumentCount() == 0) { | ||||
428 | QDate _q_cpp_result; | ||||
429 | QScriptValue _q_result = context->engine()->newVariant(context->thisObject(), qVariantFromValue(_q_cpp_result)); | ||||
430 | return _q_result; | ||||
431 | } else if (context->argumentCount() == 3) { | ||||
432 | int _q_arg0 = context->argument(0).toInt32(); | ||||
433 | int _q_arg1 = context->argument(1).toInt32(); | ||||
434 | int _q_arg2 = context->argument(2).toInt32(); | ||||
435 | QDate _q_cpp_result(_q_arg0, _q_arg1, _q_arg2); | ||||
436 | QScriptValue _q_result = context->engine()->newVariant(context->thisObject(), qVariantFromValue(_q_cpp_result)); | ||||
437 | return _q_result; | ||||
438 | } | ||||
439 | break; | ||||
440 | | ||||
441 | case 1: | ||||
442 | if (context->argumentCount() == 0) { | ||||
443 | QDate _q_result = QDate::currentDate(); | ||||
444 | return qScriptValueFromValue(context->engine(), _q_result); | ||||
445 | } | ||||
446 | break; | ||||
447 | | ||||
448 | case 2: | ||||
449 | if (context->argumentCount() == 1) { | ||||
450 | qint64 _q_arg0 = qscriptvalue_cast<qint64>(context->argument(0)); | ||||
451 | QDate _q_result = QDate::fromJulianDay(_q_arg0); | ||||
452 | return qScriptValueFromValue(context->engine(), _q_result); | ||||
453 | } | ||||
454 | break; | ||||
455 | | ||||
456 | case 3: | ||||
457 | if (context->argumentCount() == 1) { | ||||
458 | QString _q_arg0 = context->argument(0).toString(); | ||||
459 | QDate _q_result = QDate::fromString(_q_arg0); | ||||
460 | return qScriptValueFromValue(context->engine(), _q_result); | ||||
461 | } | ||||
462 | if (context->argumentCount() == 2) { | ||||
463 | if (context->argument(0).isString() | ||||
464 | && (qMetaTypeId<Qt::DateFormat>() == context->argument(1).toVariant().userType())) { | ||||
465 | QString _q_arg0 = context->argument(0).toString(); | ||||
466 | Qt::DateFormat _q_arg1 = qscriptvalue_cast<Qt::DateFormat>(context->argument(1)); | ||||
467 | QDate _q_result = QDate::fromString(_q_arg0, _q_arg1); | ||||
468 | return qScriptValueFromValue(context->engine(), _q_result); | ||||
469 | } else if (context->argument(0).isString() | ||||
470 | && context->argument(1).isString()) { | ||||
471 | QString _q_arg0 = context->argument(0).toString(); | ||||
472 | QString _q_arg1 = context->argument(1).toString(); | ||||
473 | QDate _q_result = QDate::fromString(_q_arg0, _q_arg1); | ||||
474 | return qScriptValueFromValue(context->engine(), _q_result); | ||||
475 | } | ||||
476 | } | ||||
477 | break; | ||||
478 | | ||||
479 | case 4: | ||||
480 | if (context->argumentCount() == 1) { | ||||
481 | int _q_arg0 = context->argument(0).toInt32(); | ||||
482 | bool _q_result = QDate::isLeapYear(_q_arg0); | ||||
483 | return QScriptValue(context->engine(), _q_result); | ||||
484 | } | ||||
485 | break; | ||||
486 | | ||||
487 | case 5: | ||||
488 | if (context->argumentCount() == 3) { | ||||
489 | int _q_arg0 = context->argument(0).toInt32(); | ||||
490 | int _q_arg1 = context->argument(1).toInt32(); | ||||
491 | int _q_arg2 = context->argument(2).toInt32(); | ||||
492 | bool _q_result = QDate::isValid(_q_arg0, _q_arg1, _q_arg2); | ||||
493 | return QScriptValue(context->engine(), _q_result); | ||||
494 | } | ||||
495 | break; | ||||
496 | | ||||
497 | case 6: | ||||
498 | if (context->argumentCount() == 1) { | ||||
499 | int _q_arg0 = context->argument(0).toInt32(); | ||||
500 | QString _q_result = QDate::longDayName(_q_arg0); | ||||
501 | return QScriptValue(context->engine(), _q_result); | ||||
502 | } | ||||
503 | if (context->argumentCount() == 2) { | ||||
504 | int _q_arg0 = context->argument(0).toInt32(); | ||||
505 | QDate::MonthNameType _q_arg1 = qscriptvalue_cast<QDate::MonthNameType>(context->argument(1)); | ||||
506 | QString _q_result = QDate::longDayName(_q_arg0, _q_arg1); | ||||
507 | return QScriptValue(context->engine(), _q_result); | ||||
508 | } | ||||
509 | break; | ||||
510 | | ||||
511 | case 7: | ||||
512 | if (context->argumentCount() == 1) { | ||||
513 | int _q_arg0 = context->argument(0).toInt32(); | ||||
514 | QString _q_result = QDate::longMonthName(_q_arg0); | ||||
515 | return QScriptValue(context->engine(), _q_result); | ||||
516 | } | ||||
517 | if (context->argumentCount() == 2) { | ||||
518 | int _q_arg0 = context->argument(0).toInt32(); | ||||
519 | QDate::MonthNameType _q_arg1 = qscriptvalue_cast<QDate::MonthNameType>(context->argument(1)); | ||||
520 | QString _q_result = QDate::longMonthName(_q_arg0, _q_arg1); | ||||
521 | return QScriptValue(context->engine(), _q_result); | ||||
522 | } | ||||
523 | break; | ||||
524 | | ||||
525 | case 8: | ||||
526 | if (context->argumentCount() == 1) { | ||||
527 | int _q_arg0 = context->argument(0).toInt32(); | ||||
528 | QString _q_result = QDate::shortDayName(_q_arg0); | ||||
529 | return QScriptValue(context->engine(), _q_result); | ||||
530 | } | ||||
531 | if (context->argumentCount() == 2) { | ||||
532 | int _q_arg0 = context->argument(0).toInt32(); | ||||
533 | QDate::MonthNameType _q_arg1 = qscriptvalue_cast<QDate::MonthNameType>(context->argument(1)); | ||||
534 | QString _q_result = QDate::shortDayName(_q_arg0, _q_arg1); | ||||
535 | return QScriptValue(context->engine(), _q_result); | ||||
536 | } | ||||
537 | break; | ||||
538 | | ||||
539 | case 9: | ||||
540 | if (context->argumentCount() == 1) { | ||||
541 | int _q_arg0 = context->argument(0).toInt32(); | ||||
542 | QString _q_result = QDate::shortMonthName(_q_arg0); | ||||
543 | return QScriptValue(context->engine(), _q_result); | ||||
544 | } | ||||
545 | if (context->argumentCount() == 2) { | ||||
546 | int _q_arg0 = context->argument(0).toInt32(); | ||||
547 | QDate::MonthNameType _q_arg1 = qscriptvalue_cast<QDate::MonthNameType>(context->argument(1)); | ||||
548 | QString _q_result = QDate::shortMonthName(_q_arg0, _q_arg1); | ||||
549 | return QScriptValue(context->engine(), _q_result); | ||||
550 | } | ||||
551 | break; | ||||
552 | | ||||
553 | default: | ||||
554 | Q_ASSERT(false); | ||||
555 | } | ||||
556 | return qtscript_QDate_throw_ambiguity_error_helper(context, | ||||
557 | qtscript_QDate_function_names[_id], | ||||
558 | qtscript_QDate_function_signatures[_id]); | ||||
559 | } | ||||
560 | | ||||
561 | QScriptValue qtscript_create_QDate_class(QScriptEngine *engine) | ||||
562 | { | ||||
563 | engine->setDefaultPrototype(qMetaTypeId<QDate*>(), QScriptValue()); | ||||
564 | QScriptValue proto = engine->newVariant(qVariantFromValue((QDate*)0)); | ||||
565 | for (int i = 0; i < 20; ++i) { | ||||
566 | QScriptValue fun = engine->newFunction(qtscript_QDate_prototype_call, qtscript_QDate_function_lengths[i+10]); | ||||
567 | fun.setData(QScriptValue(engine, uint(0xBABE0000 + i))); | ||||
568 | proto.setProperty(QString::fromLatin1(qtscript_QDate_function_names[i+10]), | ||||
569 | fun, QScriptValue::SkipInEnumeration); | ||||
570 | } | ||||
571 | | ||||
572 | engine->setDefaultPrototype(qMetaTypeId<QDate>(), proto); | ||||
573 | engine->setDefaultPrototype(qMetaTypeId<QDate*>(), proto); | ||||
574 | | ||||
575 | QScriptValue ctor = engine->newFunction(qtscript_QDate_static_call, proto, qtscript_QDate_function_lengths[0]); | ||||
576 | ctor.setData(QScriptValue(engine, uint(0xBABE0000 + 0))); | ||||
577 | for (int i = 0; i < 9; ++i) { | ||||
578 | QScriptValue fun = engine->newFunction(qtscript_QDate_static_call, | ||||
579 | qtscript_QDate_function_lengths[i+1]); | ||||
580 | fun.setData(QScriptValue(engine, uint(0xBABE0000 + i+1))); | ||||
581 | ctor.setProperty(QString::fromLatin1(qtscript_QDate_function_names[i+1]), | ||||
582 | fun, QScriptValue::SkipInEnumeration); | ||||
583 | } | ||||
584 | | ||||
585 | ctor.setProperty(QString::fromLatin1("MonthNameType"), | ||||
586 | qtscript_create_QDate_MonthNameType_class(engine, ctor)); | ||||
587 | return ctor; | ||||
588 | } |