/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtDeclarative module of the Qt Toolkit.
**
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
-#include "private/qdeclarativecustomparser_p.h"
-#include "private/qdeclarativecustomparser_p_p.h"
+#include "qdeclarativecustomparser_p.h"
+#include "qdeclarativecustomparser_p_p.h"
-#include "private/qdeclarativeparser_p.h"
-#include "private/qdeclarativecompiler_p.h"
+#include "qdeclarativecompiler_p.h"
#include <QtCore/qdebug.h>
QT_BEGIN_NAMESPACE
-using namespace QDeclarativeParser;
+using namespace QDeclarativeScript;
/*!
\class QDeclarativeCustomParser
*/
QDeclarativeCustomParserNode
-QDeclarativeCustomParserNodePrivate::fromObject(QDeclarativeParser::Object *root)
+QDeclarativeCustomParserNodePrivate::fromObject(QDeclarativeScript::Object *root)
{
QDeclarativeCustomParserNode rootNode;
rootNode.d->name = root->typeName;
rootNode.d->location = root->location.start;
- for(QHash<QByteArray, Property *>::Iterator iter = root->properties.begin();
- iter != root->properties.end();
- ++iter) {
-
- Property *p = *iter;
-
+ for (Property *p = root->properties.first(); p; p = root->properties.next(p)) {
rootNode.d->properties << fromProperty(p);
}
}
QDeclarativeCustomParserProperty
-QDeclarativeCustomParserNodePrivate::fromProperty(QDeclarativeParser::Property *p)
+QDeclarativeCustomParserNodePrivate::fromProperty(QDeclarativeScript::Property *p)
{
QDeclarativeCustomParserProperty prop;
- prop.d->name = p->name;
- prop.d->isList = (p->values.count() > 1);
+ prop.d->name = p->name().toString();
+ prop.d->isList = p->values.isMany();
prop.d->location = p->location.start;
if (p->value) {
for (int ii = 0; ii < props.count(); ++ii)
prop.d->values << QVariant::fromValue(props.at(ii));
} else {
- for(int ii = 0; ii < p->values.count(); ++ii) {
- QDeclarativeParser::Value *v = p->values.at(ii);
- v->type = QDeclarativeParser::Value::Literal;
+ for (QDeclarativeScript::Value *v = p->values.first(); v; v = p->values.next(v)) {
+ v->type = QDeclarativeScript::Value::Literal;
if(v->object) {
QDeclarativeCustomParserNode node = fromObject(v->object);
delete d; d = 0;
}
-QByteArray QDeclarativeCustomParserNode::name() const
+QString QDeclarativeCustomParserNode::name() const
{
return d->name;
}
return d->properties;
}
-QDeclarativeParser::Location QDeclarativeCustomParserNode::location() const
+QDeclarativeScript::Location QDeclarativeCustomParserNode::location() const
{
return d->location;
}
delete d; d = 0;
}
-QByteArray QDeclarativeCustomParserProperty::name() const
+QString QDeclarativeCustomParserProperty::name() const
{
return d->name;
}
return d->isList;
}
-QDeclarativeParser::Location QDeclarativeCustomParserProperty::location() const
+QDeclarativeScript::Location QDeclarativeCustomParserProperty::location() const
{
return d->location;
}
Resolves \a name to a type, or 0 if it is not a type. This can be used
to type-check object nodes.
*/
-const QMetaObject *QDeclarativeCustomParser::resolveType(const QByteArray& name) const
+const QMetaObject *QDeclarativeCustomParser::resolveType(const QString& name) const
{
return compiler->resolveType(name);
}
/*!
- Rewrites \a expression and returns an identifier that can be
+ Rewrites \a value and returns an identifier that can be
used to construct the binding later. \a name
is used as the name of the rewritten function.
*/
-QDeclarativeBinding::Identifier QDeclarativeCustomParser::rewriteBinding(const QString& expression, const QByteArray& name)
+QDeclarativeBinding::Identifier QDeclarativeCustomParser::rewriteBinding(const QDeclarativeScript::Variant &value, const QString& name)
+{
+ return compiler->rewriteBinding(value, name);
+}
+
+/*!
+ Returns a rewritten \a handler. \a name
+ is used as the name of the rewritten function.
+*/
+QString QDeclarativeCustomParser::rewriteSignalHandler(const QString &handler, const QString &name)
{
- return compiler->rewriteBinding(expression, name);
+ return compiler->rewriteSignalHandler(handler, name);
}
QT_END_NAMESPACE