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