Qt
Internal/Contributor docs for the Qt SDK. <b>Note:</b> These are NOT official API docs; those are found <a href='https://doc.qt.io/'>here</a>.
Loading...
Searching...
No Matches
qqmltypeloaderqmldircontent_p.h
Go to the documentation of this file.
1// Copyright (C) 2019 The Qt Company Ltd.
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
3
4#ifndef QQMLTYPELOADERQMLDIRCONTENT_P_H
5#define QQMLTYPELOADERQMLDIRCONTENT_P_H
6
7//
8// W A R N I N G
9// -------------
10//
11// This file is not part of the Qt API. It exists purely as an
12// implementation detail. This header file may change from version to
13// version without notice, or even be removed.
14//
15// We mean it.
16//
17
18#include <private/qqmldirparser_p.h>
19
21
22class QQmlError;
24{
25private:
26 friend class QQmlTypeLoader;
27
28 void setContent(const QString &location, const QString &content);
29 void setError(const QQmlError &);
30
31public:
35
36 bool hasContent() const { return m_hasContent; }
37 bool hasError() const { return m_parser.hasError(); }
38 QList<QQmlError> errors(const QString &uri, const QUrl &url) const;
39
40 QString typeNamespace() const { return m_parser.typeNamespace(); }
41
42 QQmlDirComponents components() const { return m_parser.components(); }
43 QQmlDirScripts scripts() const { return m_parser.scripts(); }
44 QQmlDirPlugins plugins() const { return m_parser.plugins(); }
45 QQmlDirImports imports() const { return m_parser.imports(); }
46
47 QString qmldirLocation() const { return m_location; }
48 QString preferredPath() const { return m_parser.preferredPath(); }
49
50 bool hasRedirection() const
51 {
52 const QString preferred = preferredPath();
53 return !preferred.isEmpty()
54 && preferred != QStringView(m_location).chopped(strlen("qmldir"));
55 }
56
57 bool designerSupported() const { return m_parser.designerSupported(); }
58 bool hasTypeInfo() const { return !m_parser.typeInfos().isEmpty(); }
59
60private:
61 QQmlDirParser m_parser;
62 QString m_location;
63 bool m_hasContent = false;
64};
65
67
68#endif // QQMLTYPELOADERQMLDIRCONTENT_P_H
bool hasError() const
QMultiHash< QString, Component > components() const
QList< Script > scripts() const
QList< Import > imports() const
QStringList typeInfos() const
bool designerSupported() const
QString preferredPath() const
QString typeNamespace() const
QList< Plugin > plugins() const
The QQmlError class encapsulates a QML error.
Definition qqmlerror.h:18
QList< QQmlError > errors(const QString &uri, const QUrl &url) const
QQmlTypeLoaderQmldirContent & operator=(const QQmlTypeLoaderQmldirContent &)=default
QQmlTypeLoaderQmldirContent(const QQmlTypeLoaderQmldirContent &)=default
The QQmlTypeLoader class abstracts loading files and their dependencies over the network.
\inmodule QtCore
Definition qstringview.h:78
constexpr QStringView chopped(qsizetype n) const noexcept
Returns the substring of length size() - length starting at the beginning of this object.
\macro QT_RESTRICTED_CAST_FROM_ASCII
Definition qstring.h:129
bool isEmpty() const noexcept
Returns true if the string has no characters; otherwise returns false.
Definition qstring.h:192
\inmodule QtCore
Definition qurl.h:94
Combined button and popup list for selecting options.
GLint location
static void setError(QJsonObject *response, const QString &msg)
QUrl url("example.com")
[constructor-url-reference]