|
1 /**************************************************************************** |
|
2 ** |
|
3 ** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). |
|
4 ** All rights reserved. |
|
5 ** Contact: Nokia Corporation (qt-info@nokia.com) |
|
6 ** |
|
7 ** This file is part of the QtDeclarative module of the Qt Toolkit. |
|
8 ** |
|
9 ** $QT_BEGIN_LICENSE:LGPL$ |
|
10 ** No Commercial Usage |
|
11 ** This file contains pre-release code and may not be distributed. |
|
12 ** You may use this file in accordance with the terms and conditions |
|
13 ** contained in the Technology Preview License Agreement accompanying |
|
14 ** this package. |
|
15 ** |
|
16 ** GNU Lesser General Public License Usage |
|
17 ** Alternatively, this file may be used under the terms of the GNU Lesser |
|
18 ** General Public License version 2.1 as published by the Free Software |
|
19 ** Foundation and appearing in the file LICENSE.LGPL included in the |
|
20 ** packaging of this file. Please review the following information to |
|
21 ** ensure the GNU Lesser General Public License version 2.1 requirements |
|
22 ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. |
|
23 ** |
|
24 ** In addition, as a special exception, Nokia gives you certain additional |
|
25 ** rights. These rights are described in the Nokia Qt LGPL Exception |
|
26 ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. |
|
27 ** |
|
28 ** If you have questions regarding the use of this file, please contact |
|
29 ** Nokia at qt-info@nokia.com. |
|
30 ** |
|
31 ** |
|
32 ** |
|
33 ** |
|
34 ** |
|
35 ** |
|
36 ** |
|
37 ** |
|
38 ** $QT_END_LICENSE$ |
|
39 ** |
|
40 ****************************************************************************/ |
|
41 |
|
42 #ifndef QDECLARATIVEIMPORT_P_H |
|
43 #define QDECLARATIVEIMPORT_P_H |
|
44 |
|
45 #include <QtCore/qurl.h> |
|
46 #include <QtCore/qcoreapplication.h> |
|
47 #include <QtCore/qset.h> |
|
48 #include <private/qdeclarativedirparser_p.h> |
|
49 #include <private/qdeclarativescriptparser_p.h> |
|
50 #include <private/qdeclarativemetatype_p.h> |
|
51 |
|
52 // |
|
53 // W A R N I N G |
|
54 // ------------- |
|
55 // |
|
56 // This file is not part of the Qt API. It exists purely as an |
|
57 // implementation detail. This header file may change from version to |
|
58 // version without notice, or even be removed. |
|
59 // |
|
60 // We mean it. |
|
61 // |
|
62 |
|
63 QT_BEGIN_NAMESPACE |
|
64 |
|
65 class QDeclarativeTypeNameCache; |
|
66 class QDeclarativeEngine; |
|
67 class QDir; |
|
68 |
|
69 class QDeclarativeImportedNamespace; |
|
70 class QDeclarativeImportsPrivate; |
|
71 class QDeclarativeImports |
|
72 { |
|
73 public: |
|
74 QDeclarativeImports(); |
|
75 QDeclarativeImports(const QDeclarativeImports &); |
|
76 ~QDeclarativeImports(); |
|
77 QDeclarativeImports &operator=(const QDeclarativeImports &); |
|
78 |
|
79 void setBaseUrl(const QUrl &url); |
|
80 QUrl baseUrl() const; |
|
81 |
|
82 void cache(QDeclarativeTypeNameCache *cache, QDeclarativeEngine *) const; |
|
83 private: |
|
84 friend class QDeclarativeImportDatabase; |
|
85 QDeclarativeImportsPrivate *d; |
|
86 }; |
|
87 |
|
88 class QDeclarativeImportDatabase |
|
89 { |
|
90 Q_DECLARE_TR_FUNCTIONS(QDeclarativeImportDatabase) |
|
91 public: |
|
92 QDeclarativeImportDatabase(QDeclarativeEngine *); |
|
93 ~QDeclarativeImportDatabase(); |
|
94 |
|
95 bool importPlugin(const QString &filePath, const QString &uri, QString *errorString); |
|
96 |
|
97 QStringList importPathList() const; |
|
98 void setImportPathList(const QStringList &paths); |
|
99 void addImportPath(const QString& dir); |
|
100 |
|
101 QStringList pluginPathList() const; |
|
102 void setPluginPathList(const QStringList &paths); |
|
103 void addPluginPath(const QString& path); |
|
104 |
|
105 |
|
106 bool addToImport(QDeclarativeImports*, const QDeclarativeDirComponents &qmldircomponentsnetwork, |
|
107 const QString& uri, const QString& prefix, int vmaj, int vmin, |
|
108 QDeclarativeScriptParser::Import::Type importType, |
|
109 QString *errorString); |
|
110 bool resolveType(const QDeclarativeImports&, const QByteArray& type, |
|
111 QDeclarativeType** type_return, QUrl* url_return, |
|
112 int *version_major, int *version_minor, |
|
113 QDeclarativeImportedNamespace** ns_return, |
|
114 QString *errorString = 0) const; |
|
115 bool resolveTypeInNamespace(QDeclarativeImportedNamespace*, const QByteArray& type, |
|
116 QDeclarativeType** type_return, QUrl* url_return, |
|
117 int *version_major, int *version_minor ) const; |
|
118 |
|
119 |
|
120 private: |
|
121 friend class QDeclarativeImportsPrivate; |
|
122 QString resolvePlugin(const QDir &qmldirPath, const QString &qmldirPluginPath, |
|
123 const QString &baseName, const QStringList &suffixes, |
|
124 const QString &prefix = QString()); |
|
125 QString resolvePlugin(const QDir &qmldirPath, const QString &qmldirPluginPath, |
|
126 const QString &baseName); |
|
127 |
|
128 |
|
129 QStringList filePluginPath; |
|
130 QStringList fileImportPath; |
|
131 |
|
132 QSet<QString> initializedPlugins; |
|
133 QDeclarativeEngine *engine; |
|
134 }; |
|
135 |
|
136 QT_END_NAMESPACE |
|
137 |
|
138 #endif // QDECLARATIVEIMPORT_P_H |
|
139 |