| 
									
										
										
										
											2012-10-02 09:12:39 +02:00
										 |  |  | /****************************************************************************
 | 
					
						
							| 
									
										
										
										
											2010-03-18 12:06:43 +01:00
										 |  |  | ** | 
					
						
							| 
									
										
										
										
											2012-10-02 09:12:39 +02:00
										 |  |  | ** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). | 
					
						
							|  |  |  | ** Contact: http://www.qt-project.org/legal
 | 
					
						
							| 
									
										
										
										
											2010-03-18 12:06:43 +01:00
										 |  |  | ** | 
					
						
							| 
									
										
										
										
											2012-10-02 09:12:39 +02:00
										 |  |  | ** This file is part of Qt Creator. | 
					
						
							| 
									
										
										
										
											2010-03-18 12:06:43 +01:00
										 |  |  | ** | 
					
						
							| 
									
										
										
										
											2012-10-02 09:12:39 +02:00
										 |  |  | ** Commercial License Usage | 
					
						
							|  |  |  | ** Licensees holding valid commercial Qt licenses may use this file in | 
					
						
							|  |  |  | ** accordance with the commercial license agreement provided with the | 
					
						
							|  |  |  | ** Software or, alternatively, in accordance with the terms contained in | 
					
						
							|  |  |  | ** a written agreement between you and Digia.  For licensing terms and | 
					
						
							|  |  |  | ** conditions see http://qt.digia.com/licensing.  For further information
 | 
					
						
							|  |  |  | ** use the contact form at http://qt.digia.com/contact-us.
 | 
					
						
							| 
									
										
										
										
											2011-05-12 13:25:35 +02:00
										 |  |  | ** | 
					
						
							| 
									
										
										
										
											2010-03-18 12:06:43 +01:00
										 |  |  | ** GNU Lesser General Public License Usage | 
					
						
							| 
									
										
										
										
											2012-10-02 09:12:39 +02:00
										 |  |  | ** Alternatively, this file may be used under the terms of the GNU Lesser | 
					
						
							|  |  |  | ** General Public License version 2.1 as published by the Free Software | 
					
						
							|  |  |  | ** Foundation and appearing in the file LICENSE.LGPL included in the | 
					
						
							|  |  |  | ** packaging of this file.  Please review the following information to | 
					
						
							|  |  |  | ** ensure the GNU Lesser General Public License version 2.1 requirements | 
					
						
							|  |  |  | ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
 | 
					
						
							| 
									
										
										
										
											2011-04-13 08:42:33 +02:00
										 |  |  | ** | 
					
						
							| 
									
										
										
										
											2012-10-02 09:12:39 +02:00
										 |  |  | ** In addition, as a special exception, Digia gives you certain additional | 
					
						
							|  |  |  | ** rights.  These rights are described in the Digia Qt LGPL Exception | 
					
						
							| 
									
										
										
										
											2010-03-18 12:06:43 +01:00
										 |  |  | ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. | 
					
						
							|  |  |  | ** | 
					
						
							| 
									
										
										
										
											2012-10-02 09:12:39 +02:00
										 |  |  | ****************************************************************************/ | 
					
						
							| 
									
										
										
										
											2010-03-18 12:06:43 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2012-07-31 10:12:26 +02:00
										 |  |  | #ifndef QQMLDIRPARSER_P_H
 | 
					
						
							|  |  |  | #define QQMLDIRPARSER_P_H
 | 
					
						
							| 
									
										
										
										
											2010-03-18 12:06:43 +01:00
										 |  |  | 
 | 
					
						
							|  |  |  | //
 | 
					
						
							|  |  |  | //  W A R N I N G
 | 
					
						
							|  |  |  | //  -------------
 | 
					
						
							|  |  |  | //
 | 
					
						
							|  |  |  | // This file is not part of the Qt API.  It exists purely as an
 | 
					
						
							|  |  |  | // implementation detail.  This header file may change from version to
 | 
					
						
							|  |  |  | // version without notice, or even be removed.
 | 
					
						
							|  |  |  | //
 | 
					
						
							|  |  |  | // We mean it.
 | 
					
						
							|  |  |  | //
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2012-07-31 10:12:26 +02:00
										 |  |  | #include <QtCore/QUrl>
 | 
					
						
							|  |  |  | #include <QtCore/QHash>
 | 
					
						
							|  |  |  | #include <QtCore/QDebug>
 | 
					
						
							| 
									
										
										
										
											2010-03-18 12:06:43 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2010-03-18 15:43:33 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2012-08-01 07:48:37 +02:00
										 |  |  | #include "qmljsglobal_p.h"
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2010-03-18 12:06:43 +01:00
										 |  |  | QT_BEGIN_NAMESPACE | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | class QmlError; | 
					
						
							| 
									
										
										
										
											2012-07-31 10:12:26 +02:00
										 |  |  | class QmlEngine; | 
					
						
							| 
									
										
										
										
											2012-08-01 07:48:37 +02:00
										 |  |  | class QML_PARSER_EXPORT QmlDirParser | 
					
						
							| 
									
										
										
										
											2010-03-18 12:06:43 +01:00
										 |  |  | { | 
					
						
							|  |  |  |     Q_DISABLE_COPY(QmlDirParser) | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | public: | 
					
						
							|  |  |  |     QmlDirParser(); | 
					
						
							|  |  |  |     ~QmlDirParser(); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2012-07-31 10:12:26 +02:00
										 |  |  |     bool parse(const QString &source); | 
					
						
							| 
									
										
										
										
											2010-03-18 12:06:43 +01:00
										 |  |  | 
 | 
					
						
							|  |  |  |     bool hasError() const; | 
					
						
							| 
									
										
										
										
											2012-07-31 10:12:26 +02:00
										 |  |  |     void setError(const QmlError &); | 
					
						
							| 
									
										
										
										
											2011-09-13 08:42:52 +02:00
										 |  |  |     QList<QmlError> errors(const QString &uri) const; | 
					
						
							| 
									
										
										
										
											2010-03-18 12:06:43 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2012-07-31 10:12:26 +02:00
										 |  |  |     QString typeNamespace() const; | 
					
						
							|  |  |  |     void setTypeNamespace(const QString &s); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2010-03-18 12:06:43 +01:00
										 |  |  |     struct Plugin | 
					
						
							|  |  |  |     { | 
					
						
							|  |  |  |         Plugin() {} | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |         Plugin(const QString &name, const QString &path) | 
					
						
							|  |  |  |             : name(name), path(path) {} | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |         QString name; | 
					
						
							|  |  |  |         QString path; | 
					
						
							|  |  |  |     }; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     struct Component | 
					
						
							|  |  |  |     { | 
					
						
							|  |  |  |         Component() | 
					
						
							| 
									
										
										
										
											2010-03-25 14:11:23 +01:00
										 |  |  |             : majorVersion(0), minorVersion(0), internal(false) {} | 
					
						
							| 
									
										
										
										
											2010-03-18 12:06:43 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-12-07 11:16:26 +01:00
										 |  |  |         Component(const QString &typeName, const QString &fileName, int majorVersion, int minorVersion) | 
					
						
							| 
									
										
										
										
											2010-03-25 14:11:23 +01:00
										 |  |  |             : typeName(typeName), fileName(fileName), majorVersion(majorVersion), minorVersion(minorVersion), | 
					
						
							|  |  |  |             internal(false) {} | 
					
						
							| 
									
										
										
										
											2010-03-18 12:06:43 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-12-07 11:16:26 +01:00
										 |  |  |         QString typeName; | 
					
						
							| 
									
										
										
										
											2010-03-18 12:06:43 +01:00
										 |  |  |         QString fileName; | 
					
						
							|  |  |  |         int majorVersion; | 
					
						
							|  |  |  |         int minorVersion; | 
					
						
							| 
									
										
										
										
											2010-03-25 14:11:23 +01:00
										 |  |  |         bool internal; | 
					
						
							| 
									
										
										
										
											2010-03-18 12:06:43 +01:00
										 |  |  |     }; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2012-07-31 10:12:26 +02:00
										 |  |  |     struct Script | 
					
						
							|  |  |  |     { | 
					
						
							|  |  |  |         Script() | 
					
						
							|  |  |  |             : majorVersion(0), minorVersion(0) {} | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |         Script(const QString &nameSpace, const QString &fileName, int majorVersion, int minorVersion) | 
					
						
							|  |  |  |             : nameSpace(nameSpace), fileName(fileName), majorVersion(majorVersion), minorVersion(minorVersion) {} | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |         QString nameSpace; | 
					
						
							|  |  |  |         QString fileName; | 
					
						
							|  |  |  |         int majorVersion; | 
					
						
							|  |  |  |         int minorVersion; | 
					
						
							|  |  |  |     }; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     QHash<QString,Component> components() const; | 
					
						
							|  |  |  |     QList<Script> scripts() const; | 
					
						
							| 
									
										
										
										
											2010-03-18 12:06:43 +01:00
										 |  |  |     QList<Plugin> plugins() const; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-05-12 13:25:35 +02:00
										 |  |  | #ifdef QT_CREATOR
 | 
					
						
							|  |  |  |     struct TypeInfo | 
					
						
							|  |  |  |     { | 
					
						
							|  |  |  |         TypeInfo() {} | 
					
						
							|  |  |  |         TypeInfo(const QString &fileName) | 
					
						
							|  |  |  |             : fileName(fileName) {} | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |         QString fileName; | 
					
						
							|  |  |  |     }; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     QList<TypeInfo> typeInfos() const; | 
					
						
							|  |  |  | #endif
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2010-03-18 12:06:43 +01:00
										 |  |  | private: | 
					
						
							| 
									
										
										
										
											2013-01-22 11:15:23 +01:00
										 |  |  |     void reportError(quint16 line, quint16 column, const QString &message); | 
					
						
							| 
									
										
										
										
											2010-03-18 12:06:43 +01:00
										 |  |  | 
 | 
					
						
							|  |  |  | private: | 
					
						
							|  |  |  |     QList<QmlError> _errors; | 
					
						
							| 
									
										
										
										
											2012-07-31 10:12:26 +02:00
										 |  |  |     QString _typeNamespace; | 
					
						
							|  |  |  |     QHash<QString,Component> _components; // multi hash
 | 
					
						
							|  |  |  |     QList<Script> _scripts; | 
					
						
							| 
									
										
										
										
											2010-03-18 12:06:43 +01:00
										 |  |  |     QList<Plugin> _plugins; | 
					
						
							| 
									
										
										
										
											2011-05-12 13:25:35 +02:00
										 |  |  | #ifdef QT_CREATOR
 | 
					
						
							|  |  |  |     QList<TypeInfo> _typeInfos; | 
					
						
							|  |  |  | #endif
 | 
					
						
							| 
									
										
										
										
											2010-03-18 12:06:43 +01:00
										 |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2012-07-31 10:12:26 +02:00
										 |  |  | typedef QHash<QString,QmlDirParser::Component> QmlDirComponents; | 
					
						
							|  |  |  | typedef QList<QmlDirParser::Script> QmlDirScripts; | 
					
						
							|  |  |  | typedef QList<QmlDirParser::Plugin> QmlDirPlugins; | 
					
						
							| 
									
										
										
										
											2010-03-25 14:11:23 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2012-07-31 10:12:26 +02:00
										 |  |  | QDebug &operator<< (QDebug &, const QmlDirParser::Component &); | 
					
						
							|  |  |  | QDebug &operator<< (QDebug &, const QmlDirParser::Script &); | 
					
						
							| 
									
										
										
										
											2010-03-25 14:11:23 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2010-03-18 12:06:43 +01:00
										 |  |  | QT_END_NAMESPACE | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2012-07-31 10:12:26 +02:00
										 |  |  | #endif // QQMLDIRPARSER_P_H
 |