1
/*****************************************************************
2
* Unipro UGENE - Integrated Bioinformatics Suite
3
* Copyright (C) 2008 Unipro, Russia (http://ugene.unipro.ru)
6
* This source code is distributed under the terms of the
7
* GNU General Public License. See the files COPYING and LICENSE
9
*****************************************************************/
11
#include <QtScript/QScriptEngine>
12
#include <QtScript/QScriptContext>
13
#include <QtScript/QScriptValue>
14
#include <QtCore/QStringList>
15
#include <QtCore/QDebug>
16
#include <qmetaobject.h>
22
#include "qtscriptshell_QXmlDefaultHandler.h"
24
static const char * const qtscript_QXmlDefaultHandler_function_names[] = {
31
static const char * const qtscript_QXmlDefaultHandler_function_signatures[] = {
38
static QScriptValue qtscript_QXmlDefaultHandler_throw_ambiguity_error_helper(
39
QScriptContext *context, const char *functionName, const char *signatures)
41
QStringList lines = QString::fromLatin1(signatures).split(QLatin1Char('\n'));
42
QStringList fullSignatures;
43
for (int i = 0; i < lines.size(); ++i)
44
fullSignatures.append(QString::fromLatin1("%0(%1)").arg(functionName).arg(lines.at(i)));
45
return context->throwError(QString::fromLatin1("QFile::%0(): could not find a function match; candidates are:\n%1")
46
.arg(functionName).arg(fullSignatures.join(QLatin1String("\n"))));
49
Q_DECLARE_METATYPE(QXmlDefaultHandler*)
50
Q_DECLARE_METATYPE(QtScriptShell_QXmlDefaultHandler*)
51
Q_DECLARE_METATYPE(QXmlContentHandler*)
52
Q_DECLARE_METATYPE(QXmlErrorHandler*)
53
Q_DECLARE_METATYPE(QXmlDTDHandler*)
54
Q_DECLARE_METATYPE(QXmlEntityResolver*)
55
Q_DECLARE_METATYPE(QXmlLexicalHandler*)
56
Q_DECLARE_METATYPE(QXmlDeclHandler*)
62
static QScriptValue qtscript_QXmlDefaultHandler_prototype_call(QScriptContext *context, QScriptEngine *)
64
#if QT_VERSION > 0x040400
65
Q_ASSERT(context->callee().isFunction());
66
uint _id = context->callee().data().toUInt32();
69
if (context->callee().isFunction())
70
_id = context->callee().data().toUInt32();
74
Q_ASSERT((_id & 0xFFFF0000) == 0xBABE0000);
76
QXmlDefaultHandler* _q_self = qscriptvalue_cast<QXmlDefaultHandler*>(context->thisObject());
78
return context->throwError(QScriptContext::TypeError,
79
QString::fromLatin1("QXmlDefaultHandler.%0(): this object is not a QXmlDefaultHandler")
80
.arg(qtscript_QXmlDefaultHandler_function_names[_id+1]));
85
QString result = QString::fromLatin1("QXmlDefaultHandler");
86
return QScriptValue(context->engine(), result);
92
return qtscript_QXmlDefaultHandler_throw_ambiguity_error_helper(context,
93
qtscript_QXmlDefaultHandler_function_names[_id+1],
94
qtscript_QXmlDefaultHandler_function_signatures[_id+1]);
97
static QScriptValue qtscript_QXmlDefaultHandler_static_call(QScriptContext *context, QScriptEngine *)
99
uint _id = context->callee().data().toUInt32();
100
Q_ASSERT((_id & 0xFFFF0000) == 0xBABE0000);
104
if (context->thisObject().strictlyEquals(context->engine()->globalObject())) {
105
return context->throwError(QString::fromLatin1("QXmlDefaultHandler(): Did you forget to construct with 'new'?"));
107
if (context->argumentCount() == 0) {
108
QtScriptShell_QXmlDefaultHandler* _q_cpp_result = new QtScriptShell_QXmlDefaultHandler();
109
QScriptValue _q_result = context->engine()->newVariant(context->thisObject(), qVariantFromValue((QXmlDefaultHandler*)_q_cpp_result));
110
_q_cpp_result->__qtscript_self = _q_result;
118
return qtscript_QXmlDefaultHandler_throw_ambiguity_error_helper(context,
119
qtscript_QXmlDefaultHandler_function_names[_id],
120
qtscript_QXmlDefaultHandler_function_signatures[_id]);
123
QScriptValue qtscript_create_QXmlDefaultHandler_class(QScriptEngine *engine)
125
static const int function_lengths[] = {
131
engine->setDefaultPrototype(qMetaTypeId<QXmlDefaultHandler*>(), QScriptValue());
132
QScriptValue proto = engine->newVariant(qVariantFromValue((QXmlDefaultHandler*)0));
133
proto.setPrototype(engine->defaultPrototype(qMetaTypeId<QXmlContentHandler*>()));
134
proto.setProperty(QString::fromLatin1("__QXmlErrorHandler__"),
135
engine->defaultPrototype(qMetaTypeId<QXmlErrorHandler*>()),
136
QScriptValue::SkipInEnumeration);
137
proto.setProperty(QString::fromLatin1("__QXmlDTDHandler__"),
138
engine->defaultPrototype(qMetaTypeId<QXmlDTDHandler*>()),
139
QScriptValue::SkipInEnumeration);
140
proto.setProperty(QString::fromLatin1("__QXmlEntityResolver__"),
141
engine->defaultPrototype(qMetaTypeId<QXmlEntityResolver*>()),
142
QScriptValue::SkipInEnumeration);
143
proto.setProperty(QString::fromLatin1("__QXmlLexicalHandler__"),
144
engine->defaultPrototype(qMetaTypeId<QXmlLexicalHandler*>()),
145
QScriptValue::SkipInEnumeration);
146
proto.setProperty(QString::fromLatin1("__QXmlDeclHandler__"),
147
engine->defaultPrototype(qMetaTypeId<QXmlDeclHandler*>()),
148
QScriptValue::SkipInEnumeration);
150
engine->setDefaultPrototype(qMetaTypeId<QXmlDefaultHandler*>(), proto);
152
QScriptValue ctor = engine->newFunction(qtscript_QXmlDefaultHandler_static_call, proto, function_lengths[0]);
153
ctor.setData(QScriptValue(engine, uint(0xBABE0000 + 0)));