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