Differential D24817 Diff 68400 src/scripting/qtbindings/generated_cpp/com_trolltech_qt_core/qtscript_QHistoryState.cpp
Changeset View
Changeset View
Standalone View
Standalone View
src/scripting/qtbindings/generated_cpp/com_trolltech_qt_core/qtscript_QHistoryState.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 <qhistorystate.h> | ||||
10 | #include <QVariant> | ||||
11 | #include <qabstractstate.h> | ||||
12 | #include <qbytearray.h> | ||||
13 | #include <qcoreevent.h> | ||||
14 | #include <qhistorystate.h> | ||||
15 | #include <qlist.h> | ||||
16 | #include <qobject.h> | ||||
17 | #include <qstate.h> | ||||
18 | #include <qstatemachine.h> | ||||
19 | | ||||
20 | #include "qtscriptshell_QHistoryState.h" | ||||
21 | | ||||
22 | static const char * const qtscript_QHistoryState_function_names[] = { | ||||
23 | "QHistoryState" | ||||
24 | // static | ||||
25 | // prototype | ||||
26 | , "toString" | ||||
27 | }; | ||||
28 | | ||||
29 | static const char * const qtscript_QHistoryState_function_signatures[] = { | ||||
30 | "HistoryType type, QState parent\nQState parent" | ||||
31 | // static | ||||
32 | // prototype | ||||
33 | "" | ||||
34 | }; | ||||
35 | | ||||
36 | static const int qtscript_QHistoryState_function_lengths[] = { | ||||
37 | 2 | ||||
38 | // static | ||||
39 | // prototype | ||||
40 | , 0 | ||||
41 | }; | ||||
42 | | ||||
43 | static QScriptValue qtscript_QHistoryState_throw_ambiguity_error_helper( | ||||
44 | QScriptContext *context, const char *functionName, const char *signatures) | ||||
45 | { | ||||
46 | QStringList lines = QString::fromLatin1(signatures).split(QLatin1Char('\n')); | ||||
47 | QStringList fullSignatures; | ||||
48 | for (int i = 0; i < lines.size(); ++i) | ||||
49 | fullSignatures.append(QString::fromLatin1("%0(%1)").arg(functionName).arg(lines.at(i))); | ||||
50 | return context->throwError(QString::fromLatin1("QHistoryState::%0(): could not find a function match; candidates are:\n%1") | ||||
51 | .arg(functionName).arg(fullSignatures.join(QLatin1String("\n")))); | ||||
52 | } | ||||
53 | | ||||
54 | static const QMetaObject *qtscript_QHistoryState_metaObject() | ||||
55 | { | ||||
56 | return &QHistoryState::staticMetaObject; | ||||
57 | } | ||||
58 | | ||||
59 | Q_DECLARE_METATYPE(QHistoryState*) | ||||
60 | Q_DECLARE_METATYPE(QtScriptShell_QHistoryState*) | ||||
61 | Q_DECLARE_METATYPE(QHistoryState::HistoryType) | ||||
62 | Q_DECLARE_METATYPE(QState*) | ||||
63 | Q_DECLARE_METATYPE(QAbstractState*) | ||||
64 | | ||||
65 | static QScriptValue qtscript_create_enum_class_helper( | ||||
66 | QScriptEngine *engine, | ||||
67 | QScriptEngine::FunctionSignature construct, | ||||
68 | QScriptEngine::FunctionSignature valueOf, | ||||
69 | QScriptEngine::FunctionSignature toString) | ||||
70 | { | ||||
71 | QScriptValue proto = engine->newObject(); | ||||
72 | proto.setProperty(QString::fromLatin1("valueOf"), | ||||
73 | engine->newFunction(valueOf), QScriptValue::SkipInEnumeration); | ||||
74 | proto.setProperty(QString::fromLatin1("toString"), | ||||
75 | engine->newFunction(toString), QScriptValue::SkipInEnumeration); | ||||
76 | return engine->newFunction(construct, proto, 1); | ||||
77 | } | ||||
78 | | ||||
79 | // | ||||
80 | // QHistoryState::HistoryType | ||||
81 | // | ||||
82 | | ||||
83 | static const QHistoryState::HistoryType qtscript_QHistoryState_HistoryType_values[] = { | ||||
84 | QHistoryState::ShallowHistory | ||||
85 | , QHistoryState::DeepHistory | ||||
86 | }; | ||||
87 | | ||||
88 | static const char * const qtscript_QHistoryState_HistoryType_keys[] = { | ||||
89 | "ShallowHistory" | ||||
90 | , "DeepHistory" | ||||
91 | }; | ||||
92 | | ||||
93 | static QString qtscript_QHistoryState_HistoryType_toStringHelper(QHistoryState::HistoryType value) | ||||
94 | { | ||||
95 | const QMetaObject *meta = qtscript_QHistoryState_metaObject(); | ||||
96 | int idx = meta->indexOfEnumerator("HistoryType"); | ||||
97 | Q_ASSERT(idx != -1); | ||||
98 | QMetaEnum menum = meta->enumerator(idx); | ||||
99 | return QString::fromLatin1(menum.valueToKey(value)); | ||||
100 | } | ||||
101 | | ||||
102 | static QScriptValue qtscript_QHistoryState_HistoryType_toScriptValue(QScriptEngine *engine, const QHistoryState::HistoryType &value) | ||||
103 | { | ||||
104 | QScriptValue clazz = engine->globalObject().property(QString::fromLatin1("QHistoryState")); | ||||
105 | return clazz.property(qtscript_QHistoryState_HistoryType_toStringHelper(value)); | ||||
106 | } | ||||
107 | | ||||
108 | static void qtscript_QHistoryState_HistoryType_fromScriptValue(const QScriptValue &value, QHistoryState::HistoryType &out) | ||||
109 | { | ||||
110 | out = qvariant_cast<QHistoryState::HistoryType>(value.toVariant()); | ||||
111 | } | ||||
112 | | ||||
113 | static QScriptValue qtscript_construct_QHistoryState_HistoryType(QScriptContext *context, QScriptEngine *engine) | ||||
114 | { | ||||
115 | int arg = context->argument(0).toInt32(); | ||||
116 | const QMetaObject *meta = qtscript_QHistoryState_metaObject(); | ||||
117 | int idx = meta->indexOfEnumerator("HistoryType"); | ||||
118 | Q_ASSERT(idx != -1); | ||||
119 | QMetaEnum menum = meta->enumerator(idx); | ||||
120 | if (menum.valueToKey(arg) != 0) | ||||
121 | return qScriptValueFromValue(engine, static_cast<QHistoryState::HistoryType>(arg)); | ||||
122 | return context->throwError(QString::fromLatin1("HistoryType(): invalid enum value (%0)").arg(arg)); | ||||
123 | } | ||||
124 | | ||||
125 | static QScriptValue qtscript_QHistoryState_HistoryType_valueOf(QScriptContext *context, QScriptEngine *engine) | ||||
126 | { | ||||
127 | QHistoryState::HistoryType value = qscriptvalue_cast<QHistoryState::HistoryType>(context->thisObject()); | ||||
128 | return QScriptValue(engine, static_cast<int>(value)); | ||||
129 | } | ||||
130 | | ||||
131 | static QScriptValue qtscript_QHistoryState_HistoryType_toString(QScriptContext *context, QScriptEngine *engine) | ||||
132 | { | ||||
133 | QHistoryState::HistoryType value = qscriptvalue_cast<QHistoryState::HistoryType>(context->thisObject()); | ||||
134 | return QScriptValue(engine, qtscript_QHistoryState_HistoryType_toStringHelper(value)); | ||||
135 | } | ||||
136 | | ||||
137 | static QScriptValue qtscript_create_QHistoryState_HistoryType_class(QScriptEngine *engine, QScriptValue &clazz) | ||||
138 | { | ||||
139 | QScriptValue ctor = qtscript_create_enum_class_helper( | ||||
140 | engine, qtscript_construct_QHistoryState_HistoryType, | ||||
141 | qtscript_QHistoryState_HistoryType_valueOf, qtscript_QHistoryState_HistoryType_toString); | ||||
142 | qScriptRegisterMetaType<QHistoryState::HistoryType>(engine, qtscript_QHistoryState_HistoryType_toScriptValue, | ||||
143 | qtscript_QHistoryState_HistoryType_fromScriptValue, ctor.property(QString::fromLatin1("prototype"))); | ||||
144 | for (int i = 0; i < 2; ++i) { | ||||
145 | clazz.setProperty(QString::fromLatin1(qtscript_QHistoryState_HistoryType_keys[i]), | ||||
146 | engine->newVariant(qVariantFromValue(qtscript_QHistoryState_HistoryType_values[i])), | ||||
147 | QScriptValue::ReadOnly | QScriptValue::Undeletable); | ||||
148 | } | ||||
149 | return ctor; | ||||
150 | } | ||||
151 | | ||||
152 | // | ||||
153 | // QHistoryState | ||||
154 | // | ||||
155 | | ||||
156 | static QScriptValue qtscript_QHistoryState_prototype_call(QScriptContext *context, QScriptEngine *) | ||||
157 | { | ||||
158 | #if QT_VERSION > 0x040400 | ||||
159 | Q_ASSERT(context->callee().isFunction()); | ||||
160 | uint _id = context->callee().data().toUInt32(); | ||||
161 | #else | ||||
162 | uint _id; | ||||
163 | if (context->callee().isFunction()) | ||||
164 | _id = context->callee().data().toUInt32(); | ||||
165 | else | ||||
166 | _id = 0xBABE0000 + 0; | ||||
167 | #endif | ||||
168 | Q_ASSERT((_id & 0xFFFF0000) == 0xBABE0000); | ||||
169 | _id &= 0x0000FFFF; | ||||
170 | QHistoryState* _q_self = qscriptvalue_cast<QHistoryState*>(context->thisObject()); | ||||
171 | if (!_q_self) { | ||||
172 | return context->throwError(QScriptContext::TypeError, | ||||
173 | QString::fromLatin1("QHistoryState.%0(): this object is not a QHistoryState") | ||||
174 | .arg(qtscript_QHistoryState_function_names[_id+1])); | ||||
175 | } | ||||
176 | | ||||
177 | switch (_id) { | ||||
178 | case 0: { | ||||
179 | QString result = QString::fromLatin1("QHistoryState"); | ||||
180 | return QScriptValue(context->engine(), result); | ||||
181 | } | ||||
182 | | ||||
183 | default: | ||||
184 | Q_ASSERT(false); | ||||
185 | } | ||||
186 | return qtscript_QHistoryState_throw_ambiguity_error_helper(context, | ||||
187 | qtscript_QHistoryState_function_names[_id+1], | ||||
188 | qtscript_QHistoryState_function_signatures[_id+1]); | ||||
189 | } | ||||
190 | | ||||
191 | static QScriptValue qtscript_QHistoryState_static_call(QScriptContext *context, QScriptEngine *) | ||||
192 | { | ||||
193 | uint _id = context->callee().data().toUInt32(); | ||||
194 | Q_ASSERT((_id & 0xFFFF0000) == 0xBABE0000); | ||||
195 | _id &= 0x0000FFFF; | ||||
196 | switch (_id) { | ||||
197 | case 0: | ||||
198 | if (context->thisObject().strictlyEquals(context->engine()->globalObject())) { | ||||
199 | return context->throwError(QString::fromLatin1("QHistoryState(): Did you forget to construct with 'new'?")); | ||||
200 | } | ||||
201 | if (context->argumentCount() == 0) { | ||||
202 | QtScriptShell_QHistoryState* _q_cpp_result = new QtScriptShell_QHistoryState(); | ||||
203 | QScriptValue _q_result = context->engine()->newQObject(context->thisObject(), (QHistoryState*)_q_cpp_result, QScriptEngine::AutoOwnership); | ||||
204 | _q_cpp_result->__qtscript_self = _q_result; | ||||
205 | return _q_result; | ||||
206 | } else if (context->argumentCount() == 1) { | ||||
207 | if ((qMetaTypeId<QHistoryState::HistoryType>() == context->argument(0).toVariant().userType())) { | ||||
208 | QHistoryState::HistoryType _q_arg0 = qscriptvalue_cast<QHistoryState::HistoryType>(context->argument(0)); | ||||
209 | QtScriptShell_QHistoryState* _q_cpp_result = new QtScriptShell_QHistoryState(_q_arg0); | ||||
210 | QScriptValue _q_result = context->engine()->newQObject(context->thisObject(), (QHistoryState*)_q_cpp_result, QScriptEngine::AutoOwnership); | ||||
211 | _q_cpp_result->__qtscript_self = _q_result; | ||||
212 | return _q_result; | ||||
213 | } else if (qscriptvalue_cast<QState*>(context->argument(0))) { | ||||
214 | QState* _q_arg0 = qscriptvalue_cast<QState*>(context->argument(0)); | ||||
215 | QtScriptShell_QHistoryState* _q_cpp_result = new QtScriptShell_QHistoryState(_q_arg0); | ||||
216 | QScriptValue _q_result = context->engine()->newQObject(context->thisObject(), (QHistoryState*)_q_cpp_result, QScriptEngine::AutoOwnership); | ||||
217 | _q_cpp_result->__qtscript_self = _q_result; | ||||
218 | return _q_result; | ||||
219 | } | ||||
220 | } else if (context->argumentCount() == 2) { | ||||
221 | QHistoryState::HistoryType _q_arg0 = qscriptvalue_cast<QHistoryState::HistoryType>(context->argument(0)); | ||||
222 | QState* _q_arg1 = qscriptvalue_cast<QState*>(context->argument(1)); | ||||
223 | QtScriptShell_QHistoryState* _q_cpp_result = new QtScriptShell_QHistoryState(_q_arg0, _q_arg1); | ||||
224 | QScriptValue _q_result = context->engine()->newQObject(context->thisObject(), (QHistoryState*)_q_cpp_result, QScriptEngine::AutoOwnership); | ||||
225 | _q_cpp_result->__qtscript_self = _q_result; | ||||
226 | return _q_result; | ||||
227 | } | ||||
228 | break; | ||||
229 | | ||||
230 | default: | ||||
231 | Q_ASSERT(false); | ||||
232 | } | ||||
233 | return qtscript_QHistoryState_throw_ambiguity_error_helper(context, | ||||
234 | qtscript_QHistoryState_function_names[_id], | ||||
235 | qtscript_QHistoryState_function_signatures[_id]); | ||||
236 | } | ||||
237 | | ||||
238 | static QScriptValue qtscript_QHistoryState_toScriptValue(QScriptEngine *engine, QHistoryState* const &in) | ||||
239 | { | ||||
240 | return engine->newQObject(in, QScriptEngine::QtOwnership, QScriptEngine::PreferExistingWrapperObject); | ||||
241 | } | ||||
242 | | ||||
243 | static void qtscript_QHistoryState_fromScriptValue(const QScriptValue &value, QHistoryState* &out) | ||||
244 | { | ||||
245 | out = qobject_cast<QHistoryState*>(value.toQObject()); | ||||
246 | } | ||||
247 | | ||||
248 | QScriptValue qtscript_create_QHistoryState_class(QScriptEngine *engine) | ||||
249 | { | ||||
250 | engine->setDefaultPrototype(qMetaTypeId<QHistoryState*>(), QScriptValue()); | ||||
251 | QScriptValue proto = engine->newVariant(qVariantFromValue((QHistoryState*)0)); | ||||
252 | proto.setPrototype(engine->defaultPrototype(qMetaTypeId<QAbstractState*>())); | ||||
253 | | ||||
254 | qScriptRegisterMetaType<QHistoryState*>(engine, qtscript_QHistoryState_toScriptValue, | ||||
255 | qtscript_QHistoryState_fromScriptValue, proto); | ||||
256 | | ||||
257 | QScriptValue ctor = engine->newFunction(qtscript_QHistoryState_static_call, proto, qtscript_QHistoryState_function_lengths[0]); | ||||
258 | ctor.setData(QScriptValue(engine, uint(0xBABE0000 + 0))); | ||||
259 | | ||||
260 | ctor.setProperty(QString::fromLatin1("HistoryType"), | ||||
261 | qtscript_create_QHistoryState_HistoryType_class(engine, ctor)); | ||||
262 | return ctor; | ||||
263 | } |