aboutsummaryrefslogtreecommitdiffstats
path: root/tools/qmlcachegen/resourcefilemapper.h
diff options
context:
space:
mode:
authorSimon Hausmann <simon.hausmann@qt.io>2018-01-22 16:46:03 +0100
committerLars Knoll <lars.knoll@qt.io>2018-01-28 16:37:26 +0000
commite5b157275d7b924e1a0f39d27958a7ad1eed9cef (patch)
tree8d08a8a9fb0c79d77449875cc9e62ee6df99b2ea /tools/qmlcachegen/resourcefilemapper.h
parente29047555be764d59c52801553e23767ed367cec (diff)
Add support for compiling QML/JS files ahead of time in resources
This is bringing over the loading infrastructure from the Qt Quick Compiler that allows embedding qml/js files in resources and compiling them ahead of time. At the moment, the approach of generating one cpp file per qml/js file and the loader stub is needed because the build system does not support dynamic resource generation. In addition, as per QTBUG-60961, we must ensure that the generated data structures are aligned. To retain compatibility this is enabled via CONFIG += qtquickcompiler, but we may need to find a new name (but should keep the old one in any case). Task-number: QTBUG-60961 Change-Id: Ia9839bf98d3af4c50636b6e06815364a9fc7ee57 Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Diffstat (limited to 'tools/qmlcachegen/resourcefilemapper.h')
-rw-r--r--tools/qmlcachegen/resourcefilemapper.h51
1 files changed, 51 insertions, 0 deletions
diff --git a/tools/qmlcachegen/resourcefilemapper.h b/tools/qmlcachegen/resourcefilemapper.h
new file mode 100644
index 0000000000..f6e82bacb0
--- /dev/null
+++ b/tools/qmlcachegen/resourcefilemapper.h
@@ -0,0 +1,51 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the QtQml module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:GPL-EXCEPT$
+** 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 The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3 as published by the Free Software
+** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+#ifndef RESOURCEFILEMAPPER_H
+#define RESOURCEFILEMAPPER_H
+
+#include <QStringList>
+#include <QHash>
+#include <QFile>
+
+struct ResourceFileMapper
+{
+ ResourceFileMapper(const QStringList &resourceFiles);
+ ResourceFileMapper(const QString &resourceFile);
+
+ bool isEmpty() const;
+
+ QStringList resourcePaths(const QString &fileName);
+ QStringList qmlCompilerFiles() const;
+
+private:
+ void populateFromQrcFile(QFile &file);
+
+ QHash<QString, QString> qrcPathToFileSystemPath;
+};
+
+#endif // RESOURCEFILEMAPPER_H