Differential D24817 Diff 68400 src/scripting/qtbindings/generated_cpp/com_trolltech_qt_core/qtscript_QTemporaryFile.cpp
Changeset View
Changeset View
Standalone View
Standalone View
src/scripting/qtbindings/generated_cpp/com_trolltech_qt_core/qtscript_QTemporaryFile.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 <qtemporaryfile.h> | ||||
10 | #include <QVariant> | ||||
11 | #include <qbytearray.h> | ||||
12 | #include <qcoreevent.h> | ||||
13 | #include <qfile.h> | ||||
14 | #include <qlist.h> | ||||
15 | #include <qobject.h> | ||||
16 | #include <qtemporaryfile.h> | ||||
17 | | ||||
18 | #include "qtscriptshell_QTemporaryFile.h" | ||||
19 | | ||||
20 | static const char * const qtscript_QTemporaryFile_function_names[] = { | ||||
21 | "QTemporaryFile" | ||||
22 | // static | ||||
23 | , "createLocalFile" | ||||
24 | , "createNativeFile" | ||||
25 | // prototype | ||||
26 | , "autoRemove" | ||||
27 | , "fileTemplate" | ||||
28 | , "open" | ||||
29 | , "setAutoRemove" | ||||
30 | , "setFileTemplate" | ||||
31 | , "uniqueFilename" | ||||
32 | , "toString" | ||||
33 | }; | ||||
34 | | ||||
35 | static const char * const qtscript_QTemporaryFile_function_signatures[] = { | ||||
36 | "\nQObject parent\nString templateName\nString templateName, QObject parent" | ||||
37 | // static | ||||
38 | , "QFile file\nString fileName" | ||||
39 | , "QFile file\nString fileName" | ||||
40 | // prototype | ||||
41 | , "" | ||||
42 | , "" | ||||
43 | , "" | ||||
44 | , "bool b" | ||||
45 | , "String name" | ||||
46 | , "" | ||||
47 | "" | ||||
48 | }; | ||||
49 | | ||||
50 | static const int qtscript_QTemporaryFile_function_lengths[] = { | ||||
51 | 2 | ||||
52 | // static | ||||
53 | , 1 | ||||
54 | , 1 | ||||
55 | // prototype | ||||
56 | , 0 | ||||
57 | , 0 | ||||
58 | , 0 | ||||
59 | , 1 | ||||
60 | , 1 | ||||
61 | , 0 | ||||
62 | , 0 | ||||
63 | }; | ||||
64 | | ||||
65 | static QScriptValue qtscript_QTemporaryFile_throw_ambiguity_error_helper( | ||||
66 | QScriptContext *context, const char *functionName, const char *signatures) | ||||
67 | { | ||||
68 | QStringList lines = QString::fromLatin1(signatures).split(QLatin1Char('\n')); | ||||
69 | QStringList fullSignatures; | ||||
70 | for (int i = 0; i < lines.size(); ++i) | ||||
71 | fullSignatures.append(QString::fromLatin1("%0(%1)").arg(functionName).arg(lines.at(i))); | ||||
72 | return context->throwError(QString::fromLatin1("QTemporaryFile::%0(): could not find a function match; candidates are:\n%1") | ||||
73 | .arg(functionName).arg(fullSignatures.join(QLatin1String("\n")))); | ||||
74 | } | ||||
75 | | ||||
76 | Q_DECLARE_METATYPE(QTemporaryFile*) | ||||
77 | Q_DECLARE_METATYPE(QtScriptShell_QTemporaryFile*) | ||||
78 | Q_DECLARE_METATYPE(QFile*) | ||||
79 | | ||||
80 | // | ||||
81 | // QTemporaryFile | ||||
82 | // | ||||
83 | | ||||
84 | static QScriptValue qtscript_QTemporaryFile_prototype_call(QScriptContext *context, QScriptEngine *) | ||||
85 | { | ||||
86 | #if QT_VERSION > 0x040400 | ||||
87 | Q_ASSERT(context->callee().isFunction()); | ||||
88 | uint _id = context->callee().data().toUInt32(); | ||||
89 | #else | ||||
90 | uint _id; | ||||
91 | if (context->callee().isFunction()) | ||||
92 | _id = context->callee().data().toUInt32(); | ||||
93 | else | ||||
94 | _id = 0xBABE0000 + 6; | ||||
95 | #endif | ||||
96 | Q_ASSERT((_id & 0xFFFF0000) == 0xBABE0000); | ||||
97 | _id &= 0x0000FFFF; | ||||
98 | QTemporaryFile* _q_self = qscriptvalue_cast<QTemporaryFile*>(context->thisObject()); | ||||
99 | if (!_q_self) { | ||||
100 | return context->throwError(QScriptContext::TypeError, | ||||
101 | QString::fromLatin1("QTemporaryFile.%0(): this object is not a QTemporaryFile") | ||||
102 | .arg(qtscript_QTemporaryFile_function_names[_id+3])); | ||||
103 | } | ||||
104 | | ||||
105 | switch (_id) { | ||||
106 | case 0: | ||||
107 | if (context->argumentCount() == 0) { | ||||
108 | bool _q_result = _q_self->autoRemove(); | ||||
109 | return QScriptValue(context->engine(), _q_result); | ||||
110 | } | ||||
111 | break; | ||||
112 | | ||||
113 | case 1: | ||||
114 | if (context->argumentCount() == 0) { | ||||
115 | QString _q_result = _q_self->fileTemplate(); | ||||
116 | return QScriptValue(context->engine(), _q_result); | ||||
117 | } | ||||
118 | break; | ||||
119 | | ||||
120 | case 2: | ||||
121 | if (context->argumentCount() == 0) { | ||||
122 | bool _q_result = _q_self->open(); | ||||
123 | return QScriptValue(context->engine(), _q_result); | ||||
124 | } | ||||
125 | break; | ||||
126 | | ||||
127 | case 3: | ||||
128 | if (context->argumentCount() == 1) { | ||||
129 | bool _q_arg0 = context->argument(0).toBoolean(); | ||||
130 | _q_self->setAutoRemove(_q_arg0); | ||||
131 | return context->engine()->undefinedValue(); | ||||
132 | } | ||||
133 | break; | ||||
134 | | ||||
135 | case 4: | ||||
136 | if (context->argumentCount() == 1) { | ||||
137 | QString _q_arg0 = context->argument(0).toString(); | ||||
138 | _q_self->setFileTemplate(_q_arg0); | ||||
139 | return context->engine()->undefinedValue(); | ||||
140 | } | ||||
141 | break; | ||||
142 | | ||||
143 | case 5: | ||||
144 | if (context->argumentCount() == 0) { | ||||
145 | QString _q_result = _q_self->fileName(); | ||||
146 | return QScriptValue(context->engine(), _q_result); | ||||
147 | } | ||||
148 | break; | ||||
149 | | ||||
150 | case 6: { | ||||
151 | QString result = QString::fromLatin1("QTemporaryFile"); | ||||
152 | return QScriptValue(context->engine(), result); | ||||
153 | } | ||||
154 | | ||||
155 | default: | ||||
156 | Q_ASSERT(false); | ||||
157 | } | ||||
158 | return qtscript_QTemporaryFile_throw_ambiguity_error_helper(context, | ||||
159 | qtscript_QTemporaryFile_function_names[_id+3], | ||||
160 | qtscript_QTemporaryFile_function_signatures[_id+3]); | ||||
161 | } | ||||
162 | | ||||
163 | static QScriptValue qtscript_QTemporaryFile_static_call(QScriptContext *context, QScriptEngine *) | ||||
164 | { | ||||
165 | uint _id = context->callee().data().toUInt32(); | ||||
166 | Q_ASSERT((_id & 0xFFFF0000) == 0xBABE0000); | ||||
167 | _id &= 0x0000FFFF; | ||||
168 | switch (_id) { | ||||
169 | case 0: | ||||
170 | if (context->thisObject().strictlyEquals(context->engine()->globalObject())) { | ||||
171 | return context->throwError(QString::fromLatin1("QTemporaryFile(): Did you forget to construct with 'new'?")); | ||||
172 | } | ||||
173 | if (context->argumentCount() == 0) { | ||||
174 | QtScriptShell_QTemporaryFile* _q_cpp_result = new QtScriptShell_QTemporaryFile(); | ||||
175 | QScriptValue _q_result = context->engine()->newQObject(context->thisObject(), (QTemporaryFile*)_q_cpp_result, QScriptEngine::AutoOwnership); | ||||
176 | _q_cpp_result->__qtscript_self = _q_result; | ||||
177 | return _q_result; | ||||
178 | } else if (context->argumentCount() == 1) { | ||||
179 | if (context->argument(0).isQObject()) { | ||||
180 | QObject* _q_arg0 = context->argument(0).toQObject(); | ||||
181 | QtScriptShell_QTemporaryFile* _q_cpp_result = new QtScriptShell_QTemporaryFile(_q_arg0); | ||||
182 | QScriptValue _q_result = context->engine()->newQObject(context->thisObject(), (QTemporaryFile*)_q_cpp_result, QScriptEngine::AutoOwnership); | ||||
183 | _q_cpp_result->__qtscript_self = _q_result; | ||||
184 | return _q_result; | ||||
185 | } else if (context->argument(0).isString()) { | ||||
186 | QString _q_arg0 = context->argument(0).toString(); | ||||
187 | QtScriptShell_QTemporaryFile* _q_cpp_result = new QtScriptShell_QTemporaryFile(_q_arg0); | ||||
188 | QScriptValue _q_result = context->engine()->newQObject(context->thisObject(), (QTemporaryFile*)_q_cpp_result, QScriptEngine::AutoOwnership); | ||||
189 | _q_cpp_result->__qtscript_self = _q_result; | ||||
190 | return _q_result; | ||||
191 | } | ||||
192 | } else if (context->argumentCount() == 2) { | ||||
193 | QString _q_arg0 = context->argument(0).toString(); | ||||
194 | QObject* _q_arg1 = context->argument(1).toQObject(); | ||||
195 | QtScriptShell_QTemporaryFile* _q_cpp_result = new QtScriptShell_QTemporaryFile(_q_arg0, _q_arg1); | ||||
196 | QScriptValue _q_result = context->engine()->newQObject(context->thisObject(), (QTemporaryFile*)_q_cpp_result, QScriptEngine::AutoOwnership); | ||||
197 | _q_cpp_result->__qtscript_self = _q_result; | ||||
198 | return _q_result; | ||||
199 | } | ||||
200 | break; | ||||
201 | | ||||
202 | case 1: | ||||
203 | if (context->argumentCount() == 1) { | ||||
204 | if (qscriptvalue_cast<QFile*>(context->argument(0))) { | ||||
205 | | ||||
206 | QFile & _q_arg0 = *qscriptvalue_cast<QFile*>(context->argument(0)); | ||||
207 | QTemporaryFile* _q_result = QTemporaryFile::createLocalFile(_q_arg0); | ||||
208 | return qScriptValueFromValue(context->engine(), _q_result); | ||||
209 | } else if (context->argument(0).isString()) { | ||||
210 | QString _q_arg0 = context->argument(0).toString(); | ||||
211 | QTemporaryFile* _q_result = QTemporaryFile::createLocalFile(_q_arg0); | ||||
212 | return qScriptValueFromValue(context->engine(), _q_result); | ||||
213 | } | ||||
214 | } | ||||
215 | break; | ||||
216 | | ||||
217 | case 2: | ||||
218 | if (context->argumentCount() == 1) { | ||||
219 | if (qscriptvalue_cast<QFile*>(context->argument(0))) { | ||||
220 | | ||||
221 | QFile & _q_arg0 = *qscriptvalue_cast<QFile*>(context->argument(0)); | ||||
222 | QTemporaryFile* _q_result = QTemporaryFile::createNativeFile(_q_arg0); | ||||
223 | return qScriptValueFromValue(context->engine(), _q_result); | ||||
224 | } else if (context->argument(0).isString()) { | ||||
225 | QString _q_arg0 = context->argument(0).toString(); | ||||
226 | QTemporaryFile* _q_result = QTemporaryFile::createNativeFile(_q_arg0); | ||||
227 | return qScriptValueFromValue(context->engine(), _q_result); | ||||
228 | } | ||||
229 | } | ||||
230 | break; | ||||
231 | | ||||
232 | default: | ||||
233 | Q_ASSERT(false); | ||||
234 | } | ||||
235 | return qtscript_QTemporaryFile_throw_ambiguity_error_helper(context, | ||||
236 | qtscript_QTemporaryFile_function_names[_id], | ||||
237 | qtscript_QTemporaryFile_function_signatures[_id]); | ||||
238 | } | ||||
239 | | ||||
240 | static QScriptValue qtscript_QTemporaryFile_toScriptValue(QScriptEngine *engine, QTemporaryFile* const &in) | ||||
241 | { | ||||
242 | return engine->newQObject(in, QScriptEngine::QtOwnership, QScriptEngine::PreferExistingWrapperObject); | ||||
243 | } | ||||
244 | | ||||
245 | static void qtscript_QTemporaryFile_fromScriptValue(const QScriptValue &value, QTemporaryFile* &out) | ||||
246 | { | ||||
247 | out = qobject_cast<QTemporaryFile*>(value.toQObject()); | ||||
248 | } | ||||
249 | | ||||
250 | QScriptValue qtscript_create_QTemporaryFile_class(QScriptEngine *engine) | ||||
251 | { | ||||
252 | engine->setDefaultPrototype(qMetaTypeId<QTemporaryFile*>(), QScriptValue()); | ||||
253 | QScriptValue proto = engine->newVariant(qVariantFromValue((QTemporaryFile*)0)); | ||||
254 | proto.setPrototype(engine->defaultPrototype(qMetaTypeId<QFile*>())); | ||||
255 | for (int i = 0; i < 7; ++i) { | ||||
256 | QScriptValue fun = engine->newFunction(qtscript_QTemporaryFile_prototype_call, qtscript_QTemporaryFile_function_lengths[i+3]); | ||||
257 | fun.setData(QScriptValue(engine, uint(0xBABE0000 + i))); | ||||
258 | proto.setProperty(QString::fromLatin1(qtscript_QTemporaryFile_function_names[i+3]), | ||||
259 | fun, QScriptValue::SkipInEnumeration); | ||||
260 | } | ||||
261 | | ||||
262 | qScriptRegisterMetaType<QTemporaryFile*>(engine, qtscript_QTemporaryFile_toScriptValue, | ||||
263 | qtscript_QTemporaryFile_fromScriptValue, proto); | ||||
264 | | ||||
265 | QScriptValue ctor = engine->newFunction(qtscript_QTemporaryFile_static_call, proto, qtscript_QTemporaryFile_function_lengths[0]); | ||||
266 | ctor.setData(QScriptValue(engine, uint(0xBABE0000 + 0))); | ||||
267 | for (int i = 0; i < 2; ++i) { | ||||
268 | QScriptValue fun = engine->newFunction(qtscript_QTemporaryFile_static_call, | ||||
269 | qtscript_QTemporaryFile_function_lengths[i+1]); | ||||
270 | fun.setData(QScriptValue(engine, uint(0xBABE0000 + i+1))); | ||||
271 | ctor.setProperty(QString::fromLatin1(qtscript_QTemporaryFile_function_names[i+1]), | ||||
272 | fun, QScriptValue::SkipInEnumeration); | ||||
273 | } | ||||
274 | | ||||
275 | return ctor; | ||||
276 | } |