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 QQMLDOMTYPESREADER_H
5#define QQMLDOMTYPESREADER_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#include "qqmldomexternalitems_p.h"
18
19#include <QtQml/private/qqmljsastfwd_p.h>
20
21// for Q_DECLARE_TR_FUNCTIONS
22#include <QtCore/qcoreapplication.h>
23#include <private/qqmljsmetatypes_p.h>
24#include <private/qqmljsscope_p.h>
25
26QT_BEGIN_NAMESPACE
27
28namespace QQmlJS {
29namespace Dom {
30
31class QmltypesReader
32{
33 Q_DECLARE_TR_FUNCTIONS(TypeDescriptionReader)
34public:
35 explicit QmltypesReader(const DomItem &qmltypesFile)
36 : m_qmltypesFilePtr(qmltypesFile.ownerAs<QmltypesFile>()), m_qmltypesFile(qmltypesFile)
37 {
38 }
39
40 bool parse();
41 // static void read
42private:
43 void addError(ErrorMessage &&message);
44
45 void insertProperty(const QQmlJSScope::ConstPtr &jsScope, const QQmlJSMetaProperty &property,
46 QMap<int, QmlObject> &objs);
47 void insertSignalOrMethod(const QQmlJSMetaMethod &metaMethod, QMap<int, QmlObject> &objs);
48 void insertComponent(const QQmlJSScope::ConstPtr &jsScope,
49 const QList<QQmlJSScope::Export> &exportsList);
50 EnumDecl enumFromMetaEnum(const QQmlJSMetaEnum &metaEnum);
51
52 std::shared_ptr<QmltypesFile> qmltypesFilePtr() { return m_qmltypesFilePtr; }
53 DomItem &qmltypesFile() { return m_qmltypesFile; }
54 ErrorHandler handler()
55 {
56 return [this](const ErrorMessage &m) { this->addError(message: ErrorMessage(m)); };
57 }
58
59private:
60 std::shared_ptr<QmltypesFile> m_qmltypesFilePtr;
61 DomItem m_qmltypesFile;
62 Path m_currentPath;
63};
64
65} // end namespace Dom
66} // end namespace QQmlJS
67QT_END_NAMESPACE
68#endif // QQMLDOMTYPESREADER_H
69

Provided by KDAB

Privacy Policy
Learn to use CMake with our Intro Training
Find out more

source code of qtdeclarative/src/qmldom/qqmldomtypesreader_p.h