Remove "All rights reserved" line from license headers.
[profile/ivi/qtdeclarative.git] / src / declarative / qml / qdeclarativecustomparser.cpp
index e80d911..7b0946b 100644 (file)
@@ -1,8 +1,7 @@
 /****************************************************************************
 **
-** 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
@@ -95,18 +94,13 @@ using namespace QDeclarativeParser;
 */
 
 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);
     }
 
@@ -117,11 +111,11 @@ QDeclarativeCustomParserNodePrivate::fromObject(QDeclarativeParser::Object *root
 }
 
 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) {
@@ -130,9 +124,8 @@ QDeclarativeCustomParserNodePrivate::fromProperty(QDeclarativeParser::Property *
         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);
@@ -171,7 +164,7 @@ QDeclarativeCustomParserNode::~QDeclarativeCustomParserNode()
     delete d; d = 0;
 }
 
-QByteArray QDeclarativeCustomParserNode::name() const
+QString QDeclarativeCustomParserNode::name() const
 {
     return d->name;
 }
@@ -181,7 +174,7 @@ QList<QDeclarativeCustomParserProperty> QDeclarativeCustomParserNode::properties
     return d->properties;
 }
 
-QDeclarativeParser::Location QDeclarativeCustomParserNode::location() const
+QDeclarativeScript::Location QDeclarativeCustomParserNode::location() const
 {
     return d->location;
 }
@@ -211,7 +204,7 @@ QDeclarativeCustomParserProperty::~QDeclarativeCustomParserProperty()
     delete d; d = 0;
 }
 
-QByteArray QDeclarativeCustomParserProperty::name() const
+QString QDeclarativeCustomParserProperty::name() const
 {
     return d->name;
 }
@@ -221,7 +214,7 @@ bool QDeclarativeCustomParserProperty::isList() const
     return d->isList;
 }
 
-QDeclarativeParser::Location QDeclarativeCustomParserProperty::location() const
+QDeclarativeScript::Location QDeclarativeCustomParserProperty::location() const
 {
     return d->location;
 }
@@ -299,19 +292,28 @@ int QDeclarativeCustomParser::evaluateEnum(const QByteArray& script) const
     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