Differential D24817 Diff 68400 src/scripting/qtbindings/generated_cpp/com_trolltech_qt_core/qtscript_QTimerEvent.cpp
Changeset View
Changeset View
Standalone View
Standalone View
src/scripting/qtbindings/generated_cpp/com_trolltech_qt_core/qtscript_QTimerEvent.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 <qcoreevent.h> | ||||
10 | #include <QVariant> | ||||
11 | #include <qcoreevent.h> | ||||
12 | | ||||
13 | #include "qtscriptshell_QTimerEvent.h" | ||||
14 | | ||||
15 | static const char * const qtscript_QTimerEvent_function_names[] = { | ||||
16 | "QTimerEvent" | ||||
17 | // static | ||||
18 | // prototype | ||||
19 | , "timerId" | ||||
20 | , "toString" | ||||
21 | }; | ||||
22 | | ||||
23 | static const char * const qtscript_QTimerEvent_function_signatures[] = { | ||||
24 | "int timerId" | ||||
25 | // static | ||||
26 | // prototype | ||||
27 | , "" | ||||
28 | "" | ||||
29 | }; | ||||
30 | | ||||
31 | static const int qtscript_QTimerEvent_function_lengths[] = { | ||||
32 | 1 | ||||
33 | // static | ||||
34 | // prototype | ||||
35 | , 0 | ||||
36 | , 0 | ||||
37 | }; | ||||
38 | | ||||
39 | static QScriptValue qtscript_QTimerEvent_throw_ambiguity_error_helper( | ||||
40 | QScriptContext *context, const char *functionName, const char *signatures) | ||||
41 | { | ||||
42 | QStringList lines = QString::fromLatin1(signatures).split(QLatin1Char('\n')); | ||||
43 | QStringList fullSignatures; | ||||
44 | for (int i = 0; i < lines.size(); ++i) | ||||
45 | fullSignatures.append(QString::fromLatin1("%0(%1)").arg(functionName).arg(lines.at(i))); | ||||
46 | return context->throwError(QString::fromLatin1("QTimerEvent::%0(): could not find a function match; candidates are:\n%1") | ||||
47 | .arg(functionName).arg(fullSignatures.join(QLatin1String("\n")))); | ||||
48 | } | ||||
49 | | ||||
50 | Q_DECLARE_METATYPE(QTimerEvent*) | ||||
51 | Q_DECLARE_METATYPE(QtScriptShell_QTimerEvent*) | ||||
52 | Q_DECLARE_METATYPE(QEvent*) | ||||
53 | | ||||
54 | // | ||||
55 | // QTimerEvent | ||||
56 | // | ||||
57 | | ||||
58 | static QScriptValue qtscript_QTimerEvent_prototype_call(QScriptContext *context, QScriptEngine *) | ||||
59 | { | ||||
60 | #if QT_VERSION > 0x040400 | ||||
61 | Q_ASSERT(context->callee().isFunction()); | ||||
62 | uint _id = context->callee().data().toUInt32(); | ||||
63 | #else | ||||
64 | uint _id; | ||||
65 | if (context->callee().isFunction()) | ||||
66 | _id = context->callee().data().toUInt32(); | ||||
67 | else | ||||
68 | _id = 0xBABE0000 + 1; | ||||
69 | #endif | ||||
70 | Q_ASSERT((_id & 0xFFFF0000) == 0xBABE0000); | ||||
71 | _id &= 0x0000FFFF; | ||||
72 | QTimerEvent* _q_self = qscriptvalue_cast<QTimerEvent*>(context->thisObject()); | ||||
73 | if (!_q_self) { | ||||
74 | return context->throwError(QScriptContext::TypeError, | ||||
75 | QString::fromLatin1("QTimerEvent.%0(): this object is not a QTimerEvent") | ||||
76 | .arg(qtscript_QTimerEvent_function_names[_id+1])); | ||||
77 | } | ||||
78 | | ||||
79 | switch (_id) { | ||||
80 | case 0: | ||||
81 | if (context->argumentCount() == 0) { | ||||
82 | int _q_result = _q_self->timerId(); | ||||
83 | return QScriptValue(context->engine(), _q_result); | ||||
84 | } | ||||
85 | break; | ||||
86 | | ||||
87 | case 1: { | ||||
88 | QString result = QString::fromLatin1("QTimerEvent"); | ||||
89 | return QScriptValue(context->engine(), result); | ||||
90 | } | ||||
91 | | ||||
92 | default: | ||||
93 | Q_ASSERT(false); | ||||
94 | } | ||||
95 | return qtscript_QTimerEvent_throw_ambiguity_error_helper(context, | ||||
96 | qtscript_QTimerEvent_function_names[_id+1], | ||||
97 | qtscript_QTimerEvent_function_signatures[_id+1]); | ||||
98 | } | ||||
99 | | ||||
100 | static QScriptValue qtscript_QTimerEvent_static_call(QScriptContext *context, QScriptEngine *) | ||||
101 | { | ||||
102 | uint _id = context->callee().data().toUInt32(); | ||||
103 | Q_ASSERT((_id & 0xFFFF0000) == 0xBABE0000); | ||||
104 | _id &= 0x0000FFFF; | ||||
105 | switch (_id) { | ||||
106 | case 0: | ||||
107 | if (context->thisObject().strictlyEquals(context->engine()->globalObject())) { | ||||
108 | return context->throwError(QString::fromLatin1("QTimerEvent(): Did you forget to construct with 'new'?")); | ||||
109 | } | ||||
110 | if (context->argumentCount() == 1) { | ||||
111 | int _q_arg0 = context->argument(0).toInt32(); | ||||
112 | QtScriptShell_QTimerEvent* _q_cpp_result = new QtScriptShell_QTimerEvent(_q_arg0); | ||||
113 | QScriptValue _q_result = context->engine()->newVariant(context->thisObject(), qVariantFromValue((QTimerEvent*)_q_cpp_result)); | ||||
114 | _q_cpp_result->__qtscript_self = _q_result; | ||||
115 | return _q_result; | ||||
116 | } | ||||
117 | break; | ||||
118 | | ||||
119 | default: | ||||
120 | Q_ASSERT(false); | ||||
121 | } | ||||
122 | return qtscript_QTimerEvent_throw_ambiguity_error_helper(context, | ||||
123 | qtscript_QTimerEvent_function_names[_id], | ||||
124 | qtscript_QTimerEvent_function_signatures[_id]); | ||||
125 | } | ||||
126 | | ||||
127 | QScriptValue qtscript_create_QTimerEvent_class(QScriptEngine *engine) | ||||
128 | { | ||||
129 | engine->setDefaultPrototype(qMetaTypeId<QTimerEvent*>(), QScriptValue()); | ||||
130 | QScriptValue proto = engine->newVariant(qVariantFromValue((QTimerEvent*)0)); | ||||
131 | proto.setPrototype(engine->defaultPrototype(qMetaTypeId<QEvent*>())); | ||||
132 | for (int i = 0; i < 2; ++i) { | ||||
133 | QScriptValue fun = engine->newFunction(qtscript_QTimerEvent_prototype_call, qtscript_QTimerEvent_function_lengths[i+1]); | ||||
134 | fun.setData(QScriptValue(engine, uint(0xBABE0000 + i))); | ||||
135 | proto.setProperty(QString::fromLatin1(qtscript_QTimerEvent_function_names[i+1]), | ||||
136 | fun, QScriptValue::SkipInEnumeration); | ||||
137 | } | ||||
138 | | ||||
139 | engine->setDefaultPrototype(qMetaTypeId<QTimerEvent*>(), proto); | ||||
140 | | ||||
141 | QScriptValue ctor = engine->newFunction(qtscript_QTimerEvent_static_call, proto, qtscript_QTimerEvent_function_lengths[0]); | ||||
142 | ctor.setData(QScriptValue(engine, uint(0xBABE0000 + 0))); | ||||
143 | | ||||
144 | return ctor; | ||||
145 | } |