Differential D24817 Diff 68400 src/scripting/qtbindings/generated_cpp/com_trolltech_qt_core/qtscript_QByteArrayMatcher.cpp
Changeset View
Changeset View
Standalone View
Standalone View
src/scripting/qtbindings/generated_cpp/com_trolltech_qt_core/qtscript_QByteArrayMatcher.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 <qbytearraymatcher.h> | ||||
10 | #include <QVariant> | ||||
11 | #include <qbytearray.h> | ||||
12 | #include <qbytearraymatcher.h> | ||||
13 | | ||||
14 | static const char * const qtscript_QByteArrayMatcher_function_names[] = { | ||||
15 | "QByteArrayMatcher" | ||||
16 | // static | ||||
17 | // prototype | ||||
18 | , "indexIn" | ||||
19 | , "pattern" | ||||
20 | , "setPattern" | ||||
21 | , "toString" | ||||
22 | }; | ||||
23 | | ||||
24 | static const char * const qtscript_QByteArrayMatcher_function_signatures[] = { | ||||
25 | "\nQByteArray pattern\nQByteArrayMatcher other\nchar pattern, int length" | ||||
26 | // static | ||||
27 | // prototype | ||||
28 | , "QByteArray ba, int from\nchar str, int len, int from" | ||||
29 | , "" | ||||
30 | , "QByteArray pattern" | ||||
31 | "" | ||||
32 | }; | ||||
33 | | ||||
34 | static const int qtscript_QByteArrayMatcher_function_lengths[] = { | ||||
35 | 2 | ||||
36 | // static | ||||
37 | // prototype | ||||
38 | , 3 | ||||
39 | , 0 | ||||
40 | , 1 | ||||
41 | , 0 | ||||
42 | }; | ||||
43 | | ||||
44 | static QScriptValue qtscript_QByteArrayMatcher_throw_ambiguity_error_helper( | ||||
45 | QScriptContext *context, const char *functionName, const char *signatures) | ||||
46 | { | ||||
47 | QStringList lines = QString::fromLatin1(signatures).split(QLatin1Char('\n')); | ||||
48 | QStringList fullSignatures; | ||||
49 | for (int i = 0; i < lines.size(); ++i) | ||||
50 | fullSignatures.append(QString::fromLatin1("%0(%1)").arg(functionName).arg(lines.at(i))); | ||||
51 | return context->throwError(QString::fromLatin1("QByteArrayMatcher::%0(): could not find a function match; candidates are:\n%1") | ||||
52 | .arg(functionName).arg(fullSignatures.join(QLatin1String("\n")))); | ||||
53 | } | ||||
54 | | ||||
55 | Q_DECLARE_METATYPE(QByteArrayMatcher) | ||||
56 | Q_DECLARE_METATYPE(QByteArrayMatcher*) | ||||
57 | Q_DECLARE_METATYPE(const char*) | ||||
58 | | ||||
59 | // | ||||
60 | // QByteArrayMatcher | ||||
61 | // | ||||
62 | | ||||
63 | static QScriptValue qtscript_QByteArrayMatcher_prototype_call(QScriptContext *context, QScriptEngine *) | ||||
64 | { | ||||
65 | #if QT_VERSION > 0x040400 | ||||
66 | Q_ASSERT(context->callee().isFunction()); | ||||
67 | uint _id = context->callee().data().toUInt32(); | ||||
68 | #else | ||||
69 | uint _id; | ||||
70 | if (context->callee().isFunction()) | ||||
71 | _id = context->callee().data().toUInt32(); | ||||
72 | else | ||||
73 | _id = 0xBABE0000 + 3; | ||||
74 | #endif | ||||
75 | Q_ASSERT((_id & 0xFFFF0000) == 0xBABE0000); | ||||
76 | _id &= 0x0000FFFF; | ||||
77 | QByteArrayMatcher* _q_self = qscriptvalue_cast<QByteArrayMatcher*>(context->thisObject()); | ||||
78 | if (!_q_self) { | ||||
79 | return context->throwError(QScriptContext::TypeError, | ||||
80 | QString::fromLatin1("QByteArrayMatcher.%0(): this object is not a QByteArrayMatcher") | ||||
81 | .arg(qtscript_QByteArrayMatcher_function_names[_id+1])); | ||||
82 | } | ||||
83 | | ||||
84 | switch (_id) { | ||||
85 | case 0: | ||||
86 | if (context->argumentCount() == 1) { | ||||
87 | QByteArray _q_arg0 = qscriptvalue_cast<QByteArray>(context->argument(0)); | ||||
88 | int _q_result = _q_self->indexIn(_q_arg0); | ||||
89 | return QScriptValue(context->engine(), _q_result); | ||||
90 | } | ||||
91 | if (context->argumentCount() == 2) { | ||||
92 | if ((qMetaTypeId<QByteArray>() == context->argument(0).toVariant().userType()) | ||||
93 | && context->argument(1).isNumber()) { | ||||
94 | QByteArray _q_arg0 = qscriptvalue_cast<QByteArray>(context->argument(0)); | ||||
95 | int _q_arg1 = context->argument(1).toInt32(); | ||||
96 | int _q_result = _q_self->indexIn(_q_arg0, _q_arg1); | ||||
97 | return QScriptValue(context->engine(), _q_result); | ||||
98 | } else if (qscriptvalue_cast<const char*>(context->argument(0)) | ||||
99 | && context->argument(1).isNumber()) { | ||||
100 | const char* _q_arg0 = qscriptvalue_cast<const char*>(context->argument(0)); | ||||
101 | int _q_arg1 = context->argument(1).toInt32(); | ||||
102 | int _q_result = _q_self->indexIn(_q_arg0, _q_arg1); | ||||
103 | return QScriptValue(context->engine(), _q_result); | ||||
104 | } | ||||
105 | } | ||||
106 | if (context->argumentCount() == 3) { | ||||
107 | const char* _q_arg0 = qscriptvalue_cast<const char*>(context->argument(0)); | ||||
108 | int _q_arg1 = context->argument(1).toInt32(); | ||||
109 | int _q_arg2 = context->argument(2).toInt32(); | ||||
110 | int _q_result = _q_self->indexIn(_q_arg0, _q_arg1, _q_arg2); | ||||
111 | return QScriptValue(context->engine(), _q_result); | ||||
112 | } | ||||
113 | break; | ||||
114 | | ||||
115 | case 1: | ||||
116 | if (context->argumentCount() == 0) { | ||||
117 | QByteArray _q_result = _q_self->pattern(); | ||||
118 | return qScriptValueFromValue(context->engine(), _q_result); | ||||
119 | } | ||||
120 | break; | ||||
121 | | ||||
122 | case 2: | ||||
123 | if (context->argumentCount() == 1) { | ||||
124 | QByteArray _q_arg0 = qscriptvalue_cast<QByteArray>(context->argument(0)); | ||||
125 | _q_self->setPattern(_q_arg0); | ||||
126 | return context->engine()->undefinedValue(); | ||||
127 | } | ||||
128 | break; | ||||
129 | | ||||
130 | case 3: { | ||||
131 | QString result = QString::fromLatin1("QByteArrayMatcher"); | ||||
132 | return QScriptValue(context->engine(), result); | ||||
133 | } | ||||
134 | | ||||
135 | default: | ||||
136 | Q_ASSERT(false); | ||||
137 | } | ||||
138 | return qtscript_QByteArrayMatcher_throw_ambiguity_error_helper(context, | ||||
139 | qtscript_QByteArrayMatcher_function_names[_id+1], | ||||
140 | qtscript_QByteArrayMatcher_function_signatures[_id+1]); | ||||
141 | } | ||||
142 | | ||||
143 | static QScriptValue qtscript_QByteArrayMatcher_static_call(QScriptContext *context, QScriptEngine *) | ||||
144 | { | ||||
145 | uint _id = context->callee().data().toUInt32(); | ||||
146 | Q_ASSERT((_id & 0xFFFF0000) == 0xBABE0000); | ||||
147 | _id &= 0x0000FFFF; | ||||
148 | switch (_id) { | ||||
149 | case 0: | ||||
150 | if (context->thisObject().strictlyEquals(context->engine()->globalObject())) { | ||||
151 | return context->throwError(QString::fromLatin1("QByteArrayMatcher(): Did you forget to construct with 'new'?")); | ||||
152 | } | ||||
153 | if (context->argumentCount() == 0) { | ||||
154 | QByteArrayMatcher _q_cpp_result; | ||||
155 | QScriptValue _q_result = context->engine()->newVariant(context->thisObject(), qVariantFromValue(_q_cpp_result)); | ||||
156 | return _q_result; | ||||
157 | } else if (context->argumentCount() == 1) { | ||||
158 | if ((qMetaTypeId<QByteArray>() == context->argument(0).toVariant().userType())) { | ||||
159 | QByteArray _q_arg0 = qscriptvalue_cast<QByteArray>(context->argument(0)); | ||||
160 | QByteArrayMatcher _q_cpp_result(_q_arg0); | ||||
161 | QScriptValue _q_result = context->engine()->newVariant(context->thisObject(), qVariantFromValue(_q_cpp_result)); | ||||
162 | return _q_result; | ||||
163 | } else if ((qMetaTypeId<QByteArrayMatcher>() == context->argument(0).toVariant().userType())) { | ||||
164 | QByteArrayMatcher _q_arg0 = qscriptvalue_cast<QByteArrayMatcher>(context->argument(0)); | ||||
165 | QByteArrayMatcher _q_cpp_result(_q_arg0); | ||||
166 | QScriptValue _q_result = context->engine()->newVariant(context->thisObject(), qVariantFromValue(_q_cpp_result)); | ||||
167 | return _q_result; | ||||
168 | } | ||||
169 | } else if (context->argumentCount() == 2) { | ||||
170 | const char* _q_arg0 = qscriptvalue_cast<const char*>(context->argument(0)); | ||||
171 | int _q_arg1 = context->argument(1).toInt32(); | ||||
172 | QByteArrayMatcher _q_cpp_result(_q_arg0, _q_arg1); | ||||
173 | QScriptValue _q_result = context->engine()->newVariant(context->thisObject(), qVariantFromValue(_q_cpp_result)); | ||||
174 | return _q_result; | ||||
175 | } | ||||
176 | break; | ||||
177 | | ||||
178 | default: | ||||
179 | Q_ASSERT(false); | ||||
180 | } | ||||
181 | return qtscript_QByteArrayMatcher_throw_ambiguity_error_helper(context, | ||||
182 | qtscript_QByteArrayMatcher_function_names[_id], | ||||
183 | qtscript_QByteArrayMatcher_function_signatures[_id]); | ||||
184 | } | ||||
185 | | ||||
186 | QScriptValue qtscript_create_QByteArrayMatcher_class(QScriptEngine *engine) | ||||
187 | { | ||||
188 | engine->setDefaultPrototype(qMetaTypeId<QByteArrayMatcher*>(), QScriptValue()); | ||||
189 | QScriptValue proto = engine->newVariant(qVariantFromValue((QByteArrayMatcher*)0)); | ||||
190 | for (int i = 0; i < 4; ++i) { | ||||
191 | QScriptValue fun = engine->newFunction(qtscript_QByteArrayMatcher_prototype_call, qtscript_QByteArrayMatcher_function_lengths[i+1]); | ||||
192 | fun.setData(QScriptValue(engine, uint(0xBABE0000 + i))); | ||||
193 | proto.setProperty(QString::fromLatin1(qtscript_QByteArrayMatcher_function_names[i+1]), | ||||
194 | fun, QScriptValue::SkipInEnumeration); | ||||
195 | } | ||||
196 | | ||||
197 | engine->setDefaultPrototype(qMetaTypeId<QByteArrayMatcher>(), proto); | ||||
198 | engine->setDefaultPrototype(qMetaTypeId<QByteArrayMatcher*>(), proto); | ||||
199 | | ||||
200 | QScriptValue ctor = engine->newFunction(qtscript_QByteArrayMatcher_static_call, proto, qtscript_QByteArrayMatcher_function_lengths[0]); | ||||
201 | ctor.setData(QScriptValue(engine, uint(0xBABE0000 + 0))); | ||||
202 | | ||||
203 | return ctor; | ||||
204 | } |