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