Differential D24817 Diff 68400 src/scripting/qtbindings/generated_cpp/com_trolltech_qt_core/qtscript_QSize.cpp
Changeset View
Changeset View
Standalone View
Standalone View
src/scripting/qtbindings/generated_cpp/com_trolltech_qt_core/qtscript_QSize.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 <qsize.h> | ||||
10 | #include <QVariant> | ||||
11 | #include <qsize.h> | ||||
12 | | ||||
13 | static const char * const qtscript_QSize_function_names[] = { | ||||
14 | "QSize" | ||||
15 | // static | ||||
16 | // prototype | ||||
17 | , "boundedTo" | ||||
18 | , "expandedTo" | ||||
19 | , "height" | ||||
20 | , "isEmpty" | ||||
21 | , "isNull" | ||||
22 | , "isValid" | ||||
23 | , "operator_add_assign" | ||||
24 | , "operator_divide_assign" | ||||
25 | , "equals" | ||||
26 | , "operator_multiply_assign" | ||||
27 | , "operator_subtract_assign" | ||||
28 | , "scale" | ||||
29 | , "scaled" | ||||
30 | , "setHeight" | ||||
31 | , "setWidth" | ||||
32 | , "transpose" | ||||
33 | , "transposed" | ||||
34 | , "width" | ||||
35 | , "toString" | ||||
36 | }; | ||||
37 | | ||||
38 | static const char * const qtscript_QSize_function_signatures[] = { | ||||
39 | "\nint w, int h" | ||||
40 | // static | ||||
41 | // prototype | ||||
42 | , "QSize arg__1" | ||||
43 | , "QSize arg__1" | ||||
44 | , "" | ||||
45 | , "" | ||||
46 | , "" | ||||
47 | , "" | ||||
48 | , "QSize arg__1" | ||||
49 | , "qreal c" | ||||
50 | , "QSize s2" | ||||
51 | , "qreal c" | ||||
52 | , "QSize arg__1" | ||||
53 | , "QSize s, AspectRatioMode mode\nint w, int h, AspectRatioMode mode" | ||||
54 | , "QSize s, AspectRatioMode mode\nint w, int h, AspectRatioMode mode" | ||||
55 | , "int h" | ||||
56 | , "int w" | ||||
57 | , "" | ||||
58 | , "" | ||||
59 | , "" | ||||
60 | "" | ||||
61 | }; | ||||
62 | | ||||
63 | static const int qtscript_QSize_function_lengths[] = { | ||||
64 | 2 | ||||
65 | // static | ||||
66 | // prototype | ||||
67 | , 1 | ||||
68 | , 1 | ||||
69 | , 0 | ||||
70 | , 0 | ||||
71 | , 0 | ||||
72 | , 0 | ||||
73 | , 1 | ||||
74 | , 1 | ||||
75 | , 1 | ||||
76 | , 1 | ||||
77 | , 1 | ||||
78 | , 3 | ||||
79 | , 3 | ||||
80 | , 1 | ||||
81 | , 1 | ||||
82 | , 0 | ||||
83 | , 0 | ||||
84 | , 0 | ||||
85 | , 0 | ||||
86 | }; | ||||
87 | | ||||
88 | static QScriptValue qtscript_QSize_throw_ambiguity_error_helper( | ||||
89 | QScriptContext *context, const char *functionName, const char *signatures) | ||||
90 | { | ||||
91 | QStringList lines = QString::fromLatin1(signatures).split(QLatin1Char('\n')); | ||||
92 | QStringList fullSignatures; | ||||
93 | for (int i = 0; i < lines.size(); ++i) | ||||
94 | fullSignatures.append(QString::fromLatin1("%0(%1)").arg(functionName).arg(lines.at(i))); | ||||
95 | return context->throwError(QString::fromLatin1("QSize::%0(): could not find a function match; candidates are:\n%1") | ||||
96 | .arg(functionName).arg(fullSignatures.join(QLatin1String("\n")))); | ||||
97 | } | ||||
98 | | ||||
99 | Q_DECLARE_METATYPE(QSize*) | ||||
100 | Q_DECLARE_METATYPE(Qt::AspectRatioMode) | ||||
101 | | ||||
102 | // | ||||
103 | // QSize | ||||
104 | // | ||||
105 | | ||||
106 | static QScriptValue qtscript_QSize_prototype_call(QScriptContext *context, QScriptEngine *) | ||||
107 | { | ||||
108 | #if QT_VERSION > 0x040400 | ||||
109 | Q_ASSERT(context->callee().isFunction()); | ||||
110 | uint _id = context->callee().data().toUInt32(); | ||||
111 | #else | ||||
112 | uint _id; | ||||
113 | if (context->callee().isFunction()) | ||||
114 | _id = context->callee().data().toUInt32(); | ||||
115 | else | ||||
116 | _id = 0xBABE0000 + 18; | ||||
117 | #endif | ||||
118 | Q_ASSERT((_id & 0xFFFF0000) == 0xBABE0000); | ||||
119 | _id &= 0x0000FFFF; | ||||
120 | QSize* _q_self = qscriptvalue_cast<QSize*>(context->thisObject()); | ||||
121 | if (!_q_self) { | ||||
122 | return context->throwError(QScriptContext::TypeError, | ||||
123 | QString::fromLatin1("QSize.%0(): this object is not a QSize") | ||||
124 | .arg(qtscript_QSize_function_names[_id+1])); | ||||
125 | } | ||||
126 | | ||||
127 | switch (_id) { | ||||
128 | case 0: | ||||
129 | if (context->argumentCount() == 1) { | ||||
130 | QSize _q_arg0 = qscriptvalue_cast<QSize>(context->argument(0)); | ||||
131 | QSize _q_result = _q_self->boundedTo(_q_arg0); | ||||
132 | return qScriptValueFromValue(context->engine(), _q_result); | ||||
133 | } | ||||
134 | break; | ||||
135 | | ||||
136 | case 1: | ||||
137 | if (context->argumentCount() == 1) { | ||||
138 | QSize _q_arg0 = qscriptvalue_cast<QSize>(context->argument(0)); | ||||
139 | QSize _q_result = _q_self->expandedTo(_q_arg0); | ||||
140 | return qScriptValueFromValue(context->engine(), _q_result); | ||||
141 | } | ||||
142 | break; | ||||
143 | | ||||
144 | case 2: | ||||
145 | if (context->argumentCount() == 0) { | ||||
146 | int _q_result = _q_self->height(); | ||||
147 | return QScriptValue(context->engine(), _q_result); | ||||
148 | } | ||||
149 | break; | ||||
150 | | ||||
151 | case 3: | ||||
152 | if (context->argumentCount() == 0) { | ||||
153 | bool _q_result = _q_self->isEmpty(); | ||||
154 | return QScriptValue(context->engine(), _q_result); | ||||
155 | } | ||||
156 | break; | ||||
157 | | ||||
158 | case 4: | ||||
159 | if (context->argumentCount() == 0) { | ||||
160 | bool _q_result = _q_self->isNull(); | ||||
161 | return QScriptValue(context->engine(), _q_result); | ||||
162 | } | ||||
163 | break; | ||||
164 | | ||||
165 | case 5: | ||||
166 | if (context->argumentCount() == 0) { | ||||
167 | bool _q_result = _q_self->isValid(); | ||||
168 | return QScriptValue(context->engine(), _q_result); | ||||
169 | } | ||||
170 | break; | ||||
171 | | ||||
172 | case 6: | ||||
173 | if (context->argumentCount() == 1) { | ||||
174 | QSize _q_arg0 = qscriptvalue_cast<QSize>(context->argument(0)); | ||||
175 | QSize& _q_result = _q_self->operator+=(_q_arg0); | ||||
176 | return qScriptValueFromValue(context->engine(), _q_result); | ||||
177 | } | ||||
178 | break; | ||||
179 | | ||||
180 | case 7: | ||||
181 | if (context->argumentCount() == 1) { | ||||
182 | qreal _q_arg0 = qscriptvalue_cast<qreal>(context->argument(0)); | ||||
183 | QSize& _q_result = _q_self->operator/=(_q_arg0); | ||||
184 | return qScriptValueFromValue(context->engine(), _q_result); | ||||
185 | } | ||||
186 | break; | ||||
187 | | ||||
188 | case 8: | ||||
189 | if (context->argumentCount() == 1) { | ||||
190 | QSize _q_arg0 = qscriptvalue_cast<QSize>(context->argument(0)); | ||||
191 | bool _q_result = operator==(*_q_self, _q_arg0); | ||||
192 | return QScriptValue(context->engine(), _q_result); | ||||
193 | } | ||||
194 | break; | ||||
195 | | ||||
196 | case 9: | ||||
197 | if (context->argumentCount() == 1) { | ||||
198 | qreal _q_arg0 = qscriptvalue_cast<qreal>(context->argument(0)); | ||||
199 | QSize& _q_result = _q_self->operator*=(_q_arg0); | ||||
200 | return qScriptValueFromValue(context->engine(), _q_result); | ||||
201 | } | ||||
202 | break; | ||||
203 | | ||||
204 | case 10: | ||||
205 | if (context->argumentCount() == 1) { | ||||
206 | QSize _q_arg0 = qscriptvalue_cast<QSize>(context->argument(0)); | ||||
207 | QSize& _q_result = _q_self->operator-=(_q_arg0); | ||||
208 | return qScriptValueFromValue(context->engine(), _q_result); | ||||
209 | } | ||||
210 | break; | ||||
211 | | ||||
212 | case 11: | ||||
213 | if (context->argumentCount() == 2) { | ||||
214 | QSize _q_arg0 = qscriptvalue_cast<QSize>(context->argument(0)); | ||||
215 | Qt::AspectRatioMode _q_arg1 = qscriptvalue_cast<Qt::AspectRatioMode>(context->argument(1)); | ||||
216 | _q_self->scale(_q_arg0, _q_arg1); | ||||
217 | return context->engine()->undefinedValue(); | ||||
218 | } | ||||
219 | if (context->argumentCount() == 3) { | ||||
220 | int _q_arg0 = context->argument(0).toInt32(); | ||||
221 | int _q_arg1 = context->argument(1).toInt32(); | ||||
222 | Qt::AspectRatioMode _q_arg2 = qscriptvalue_cast<Qt::AspectRatioMode>(context->argument(2)); | ||||
223 | _q_self->scale(_q_arg0, _q_arg1, _q_arg2); | ||||
224 | return context->engine()->undefinedValue(); | ||||
225 | } | ||||
226 | break; | ||||
227 | | ||||
228 | case 12: | ||||
229 | if (context->argumentCount() == 2) { | ||||
230 | QSize _q_arg0 = qscriptvalue_cast<QSize>(context->argument(0)); | ||||
231 | Qt::AspectRatioMode _q_arg1 = qscriptvalue_cast<Qt::AspectRatioMode>(context->argument(1)); | ||||
232 | QSize _q_result = _q_self->scaled(_q_arg0, _q_arg1); | ||||
233 | return qScriptValueFromValue(context->engine(), _q_result); | ||||
234 | } | ||||
235 | if (context->argumentCount() == 3) { | ||||
236 | int _q_arg0 = context->argument(0).toInt32(); | ||||
237 | int _q_arg1 = context->argument(1).toInt32(); | ||||
238 | Qt::AspectRatioMode _q_arg2 = qscriptvalue_cast<Qt::AspectRatioMode>(context->argument(2)); | ||||
239 | QSize _q_result = _q_self->scaled(_q_arg0, _q_arg1, _q_arg2); | ||||
240 | return qScriptValueFromValue(context->engine(), _q_result); | ||||
241 | } | ||||
242 | break; | ||||
243 | | ||||
244 | case 13: | ||||
245 | if (context->argumentCount() == 1) { | ||||
246 | int _q_arg0 = context->argument(0).toInt32(); | ||||
247 | _q_self->setHeight(_q_arg0); | ||||
248 | return context->engine()->undefinedValue(); | ||||
249 | } | ||||
250 | break; | ||||
251 | | ||||
252 | case 14: | ||||
253 | if (context->argumentCount() == 1) { | ||||
254 | int _q_arg0 = context->argument(0).toInt32(); | ||||
255 | _q_self->setWidth(_q_arg0); | ||||
256 | return context->engine()->undefinedValue(); | ||||
257 | } | ||||
258 | break; | ||||
259 | | ||||
260 | case 15: | ||||
261 | if (context->argumentCount() == 0) { | ||||
262 | _q_self->transpose(); | ||||
263 | return context->engine()->undefinedValue(); | ||||
264 | } | ||||
265 | break; | ||||
266 | | ||||
267 | case 16: | ||||
268 | if (context->argumentCount() == 0) { | ||||
269 | QSize _q_result = _q_self->transposed(); | ||||
270 | return qScriptValueFromValue(context->engine(), _q_result); | ||||
271 | } | ||||
272 | break; | ||||
273 | | ||||
274 | case 17: | ||||
275 | if (context->argumentCount() == 0) { | ||||
276 | int _q_result = _q_self->width(); | ||||
277 | return QScriptValue(context->engine(), _q_result); | ||||
278 | } | ||||
279 | break; | ||||
280 | | ||||
281 | case 18: { | ||||
282 | QString result; | ||||
283 | QDebug d(&result); | ||||
284 | d << *_q_self; | ||||
285 | return QScriptValue(context->engine(), result); | ||||
286 | } | ||||
287 | | ||||
288 | default: | ||||
289 | Q_ASSERT(false); | ||||
290 | } | ||||
291 | return qtscript_QSize_throw_ambiguity_error_helper(context, | ||||
292 | qtscript_QSize_function_names[_id+1], | ||||
293 | qtscript_QSize_function_signatures[_id+1]); | ||||
294 | } | ||||
295 | | ||||
296 | static QScriptValue qtscript_QSize_static_call(QScriptContext *context, QScriptEngine *) | ||||
297 | { | ||||
298 | uint _id = context->callee().data().toUInt32(); | ||||
299 | Q_ASSERT((_id & 0xFFFF0000) == 0xBABE0000); | ||||
300 | _id &= 0x0000FFFF; | ||||
301 | switch (_id) { | ||||
302 | case 0: | ||||
303 | if (context->thisObject().strictlyEquals(context->engine()->globalObject())) { | ||||
304 | return context->throwError(QString::fromLatin1("QSize(): Did you forget to construct with 'new'?")); | ||||
305 | } | ||||
306 | if (context->argumentCount() == 0) { | ||||
307 | QSize _q_cpp_result; | ||||
308 | QScriptValue _q_result = context->engine()->newVariant(context->thisObject(), qVariantFromValue(_q_cpp_result)); | ||||
309 | return _q_result; | ||||
310 | } else if (context->argumentCount() == 2) { | ||||
311 | int _q_arg0 = context->argument(0).toInt32(); | ||||
312 | int _q_arg1 = context->argument(1).toInt32(); | ||||
313 | QSize _q_cpp_result(_q_arg0, _q_arg1); | ||||
314 | QScriptValue _q_result = context->engine()->newVariant(context->thisObject(), qVariantFromValue(_q_cpp_result)); | ||||
315 | return _q_result; | ||||
316 | } | ||||
317 | break; | ||||
318 | | ||||
319 | default: | ||||
320 | Q_ASSERT(false); | ||||
321 | } | ||||
322 | return qtscript_QSize_throw_ambiguity_error_helper(context, | ||||
323 | qtscript_QSize_function_names[_id], | ||||
324 | qtscript_QSize_function_signatures[_id]); | ||||
325 | } | ||||
326 | | ||||
327 | QScriptValue qtscript_create_QSize_class(QScriptEngine *engine) | ||||
328 | { | ||||
329 | engine->setDefaultPrototype(qMetaTypeId<QSize*>(), QScriptValue()); | ||||
330 | QScriptValue proto = engine->newVariant(qVariantFromValue((QSize*)0)); | ||||
331 | for (int i = 0; i < 19; ++i) { | ||||
332 | QScriptValue fun = engine->newFunction(qtscript_QSize_prototype_call, qtscript_QSize_function_lengths[i+1]); | ||||
333 | fun.setData(QScriptValue(engine, uint(0xBABE0000 + i))); | ||||
334 | proto.setProperty(QString::fromLatin1(qtscript_QSize_function_names[i+1]), | ||||
335 | fun, QScriptValue::SkipInEnumeration); | ||||
336 | } | ||||
337 | | ||||
338 | engine->setDefaultPrototype(qMetaTypeId<QSize>(), proto); | ||||
339 | engine->setDefaultPrototype(qMetaTypeId<QSize*>(), proto); | ||||
340 | | ||||
341 | QScriptValue ctor = engine->newFunction(qtscript_QSize_static_call, proto, qtscript_QSize_function_lengths[0]); | ||||
342 | ctor.setData(QScriptValue(engine, uint(0xBABE0000 + 0))); | ||||
343 | | ||||
344 | return ctor; | ||||
345 | } |