blob: 5610755f9f3814fbb4333f08698d47f4ebe27d74 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
|
// Copyright (C) 2025 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#ifndef QQMLJSCONTEXTPROPERTIES_P_H
#define QQMLJSCONTEXTPROPERTIES_P_H
//
// 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.
#include <qtqmlcompilerexports.h>
#include <QtCore/qstring.h>
#include <QtCore/qhash.h>
#include <QtCore/qlist.h>
#include <QtCore/private/qflatmap_p.h>
#include <QtQml/private/qqmljssourcelocation_p.h>
QT_BEGIN_NAMESPACE
namespace QQmlJS {
class LoggerCategory;
struct Q_QMLCOMPILER_EXPORT HeuristicContextProperty
{
QString filename = {};
SourceLocation location = SourceLocation{};
};
class Q_QMLCOMPILER_EXPORT HeuristicContextProperties
{
public:
bool contains(const QString &name) const { return m_properties.contains(name); }
qsizetype size() const { return m_properties.size(); }
QList<HeuristicContextProperty> definitionsForName(const QString &name) const;
static HeuristicContextProperties collectFromCppSourceDirs(const QList<QString> &cppSourceDirs);
private:
struct Entry
{
QString name;
QList<HeuristicContextProperty> definitions;
};
void add(const QString &name, const HeuristicContextProperty &property);
void collectFromDirs(const QList<QString> &dirs);
void collectFromFile(const QString &file);
void grepFallback(const QList<QString> &rootUrls);
#if QT_CONFIG(process) && !defined(Q_OS_WINDOWS)
void parseGrepOutput(const QString &output);
#endif
QFlatMap<QString, QList<HeuristicContextProperty>> m_properties;
};
} // namespace QQmlJS
QT_END_NAMESPACE
#endif // QQMLJSCONTEXTPROPERTIES_P_H
|