Qt 4.8
qdeclarativescriptparser_p.h
Go to the documentation of this file.
1 /****************************************************************************
2 **
3 ** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
4 ** Contact: http://www.qt-project.org/legal
5 **
6 ** This file is part of the QtDeclarative module of the Qt Toolkit.
7 **
8 ** $QT_BEGIN_LICENSE:LGPL$
9 ** Commercial License Usage
10 ** Licensees holding valid commercial Qt licenses may use this file in
11 ** accordance with the commercial license agreement provided with the
12 ** Software or, alternatively, in accordance with the terms contained in
13 ** a written agreement between you and Digia. For licensing terms and
14 ** conditions see http://qt.digia.com/licensing. For further information
15 ** use the contact form at http://qt.digia.com/contact-us.
16 **
17 ** GNU Lesser General Public License Usage
18 ** Alternatively, this file may be used under the terms of the GNU Lesser
19 ** General Public License version 2.1 as published by the Free Software
20 ** Foundation and appearing in the file LICENSE.LGPL included in the
21 ** packaging of this file. Please review the following information to
22 ** ensure the GNU Lesser General Public License version 2.1 requirements
23 ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
24 **
25 ** In addition, as a special exception, Digia gives you certain additional
26 ** rights. These rights are described in the Digia Qt LGPL Exception
27 ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
28 **
29 ** GNU General Public License Usage
30 ** Alternatively, this file may be used under the terms of the GNU
31 ** General Public License version 3.0 as published by the Free Software
32 ** Foundation and appearing in the file LICENSE.GPL included in the
33 ** packaging of this file. Please review the following information to
34 ** ensure the GNU General Public License version 3.0 requirements will be
35 ** met: http://www.gnu.org/copyleft/gpl.html.
36 **
37 **
38 ** $QT_END_LICENSE$
39 **
40 ****************************************************************************/
41 #ifndef QDECLARATIVESCRIPTPARSER_P_H
42 #define QDECLARATIVESCRIPTPARSER_P_H
43 
44 //
45 // W A R N I N G
46 // -------------
47 //
48 // This file is not part of the Qt API. It exists purely as an
49 // implementation detail. This header file may change from version to
50 // version without notice, or even be removed.
51 //
52 // We mean it.
53 //
54 
55 #include "qdeclarativeerror.h"
56 #include "private/qdeclarativeparser_p.h"
57 
58 #include <QtCore/QList>
59 #include <QtCore/QUrl>
60 
62 
64 
65 QT_MODULE(Declarative)
66 
67 class QByteArray;
68 
71 {
72 public:
73  class Import
74  {
75  public:
77 
78  enum Type { Library, File, Script, Implicit }; //Implicit is only used internally
80 
84 
86  };
87 
89  {
90  public:
91  TypeReference(int typeId, const QString &typeName) : id(typeId), name(typeName) {}
92 
93  int id;
94  // type as it has been referenced in Qml
96  // objects in parse tree referencing the type
98  };
99 
102 
103  bool parse(const QByteArray &data, const QUrl &url = QUrl());
104 
106 
108  QList<Import> imports() const;
109 
110  void clear();
111 
113 
115  public:
117  : pragmas(QDeclarativeParser::Object::ScriptBlock::None) {}
118 
119  QDeclarativeParser::Object::ScriptBlock::Pragmas pragmas;
121  };
122 
123  static QDeclarativeParser::Object::ScriptBlock::Pragmas extractPragmas(QString &);
125 
126 
127 // ### private:
130 
131  void setScriptFile(const QString &filename) {_scriptFile = filename; }
132  QString scriptFile() const { return _scriptFile; }
133 
134 // ### private:
136 
142 };
143 
145 
147 
148 #endif // QDECLARATIVESCRIPTPARSER_P_H
#define QT_END_NAMESPACE
This macro expands to.
Definition: qglobal.h:90
#define QT_MODULE(x)
Definition: qglobal.h:2783
void setTree(QDeclarativeParser::Object *tree)
#define QT_BEGIN_HEADER
Definition: qglobal.h:136
QDeclarativeParser::LocationSpan location
QList< TypeReference * > referencedTypes() const
The QByteArray class provides an array of bytes.
Definition: qbytearray.h:135
QList< TypeReference * > _refTypes
QList< QDeclarativeError > errors() const
The QUrl class provides a convenient interface for working with URLs.
Definition: qurl.h:61
The QString class provides a Unicode character string.
Definition: qstring.h:83
static QDeclarativeParser::Object::ScriptBlock::Pragmas extractPragmas(QString &)
static JavaScriptMetaData extractMetaData(QString &)
#define QT_BEGIN_NAMESPACE
This macro expands to.
Definition: qglobal.h:89
const char * typeName
Definition: qmetatype.cpp:239
QList< QDeclarativeParser::Object * > refObjects
const char * name
TypeReference * findOrCreateType(const QString &name)
#define None
QList< QDeclarativeError > _errors
bool parse(const QByteArray &data, const QUrl &url=QUrl())
void setScriptFile(const QString &filename)
QDeclarativeScriptParserJsASTData * data
QDeclarativeParser::Object * root
TypeReference(int typeId, const QString &typeName)
QDeclarativeParser::Object::ScriptBlock::Pragmas pragmas
#define QT_END_HEADER
Definition: qglobal.h:137
QDeclarativeParser::Object * tree() const
The QList class is a template class that provides lists.
Definition: qdatastream.h:62