1 /****************************************************************************
3 ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
4 ** Contact: http://www.qt-project.org/
6 ** This file is part of the QtDeclarative module of the Qt Toolkit.
8 ** $QT_BEGIN_LICENSE:LGPL$
9 ** GNU Lesser General Public License Usage
10 ** This file may be used under the terms of the GNU Lesser General Public
11 ** License version 2.1 as published by the Free Software Foundation and
12 ** appearing in the file LICENSE.LGPL included in the packaging of this
13 ** file. Please review the following information to ensure the GNU Lesser
14 ** General Public License version 2.1 requirements will be met:
15 ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
17 ** In addition, as a special exception, Nokia gives you certain additional
18 ** rights. These rights are described in the Nokia Qt LGPL Exception
19 ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
21 ** GNU General Public License Usage
22 ** Alternatively, this file may be used under the terms of the GNU General
23 ** Public License version 3.0 as published by the Free Software Foundation
24 ** and appearing in the file LICENSE.GPL included in the packaging of this
25 ** file. Please review the following information to ensure the GNU General
26 ** Public License version 3.0 requirements will be met:
27 ** http://www.gnu.org/copyleft/gpl.html.
30 ** Alternatively, this file may be used in accordance with the terms and
31 ** conditions contained in a signed written agreement between you and Nokia.
40 ****************************************************************************/
42 #ifndef QDECLARATIVEDIRPARSER_P_H
43 #define QDECLARATIVEDIRPARSER_P_H
49 // This file is not part of the Qt API. It exists purely as an
50 // implementation detail. This header file may change from version to
51 // version without notice, or even be removed.
56 #include <QtCore/QUrl>
57 #include <QtCore/QHash>
61 class QDeclarativeError;
62 class QDeclarativeDirParser
64 Q_DISABLE_COPY(QDeclarativeDirParser)
67 QDeclarativeDirParser();
68 ~QDeclarativeDirParser();
71 void setUrl(const QUrl &url);
73 QString fileSource() const;
74 void setFileSource(const QString &filePath);
76 QString source() const;
77 void setSource(const QString &source);
79 bool isParsed() const;
82 bool hasError() const;
83 QList<QDeclarativeError> errors(const QString &uri) const;
89 Plugin(const QString &name, const QString &path)
90 : name(name), path(path) {}
99 : majorVersion(0), minorVersion(0), internal(false) {}
101 Component(const QString &typeName, const QString &fileName, int majorVersion, int minorVersion)
102 : typeName(typeName), fileName(fileName), majorVersion(majorVersion), minorVersion(minorVersion),
115 : majorVersion(0), minorVersion(0) {}
117 Script(const QString &nameSpace, const QString &fileName, int majorVersion, int minorVersion)
118 : nameSpace(nameSpace), fileName(fileName), majorVersion(majorVersion), minorVersion(minorVersion) {}
126 QList<Component> components() const;
127 QList<Script> scripts() const;
128 QList<Plugin> plugins() const;
134 TypeInfo(const QString &fileName)
135 : fileName(fileName) {}
140 QList<TypeInfo> typeInfos() const;
144 void reportError(int line, int column, const QString &message);
147 QList<QDeclarativeError> _errors;
150 QString _filePathSouce;
151 QList<Component> _components;
152 QList<Script> _scripts;
153 QList<Plugin> _plugins;
155 QList<TypeInfo> _typeInfos;
157 unsigned _isParsed: 1;
160 typedef QList<QDeclarativeDirParser::Component> QDeclarativeDirComponents;
161 typedef QList<QDeclarativeDirParser::Script> QDeclarativeDirScripts;
166 #endif // QDECLARATIVEDIRPARSER_P_H