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