Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Loading...
Searching...
No Matches
qqmljscontextproperties_p.h
Go to the documentation of this file.
1// Copyright (C) 2025 The Qt Company Ltd.
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
3// Qt-Security score:significant
4
5#ifndef QQMLJSCONTEXTPROPERTIES_P_H
6#define QQMLJSCONTEXTPROPERTIES_P_H
7
8//
9// W A R N I N G
10// -------------
11//
12// This file is not part of the Qt API. It exists purely as an
13// implementation detail. This header file may change from version to
14// version without notice, or even be removed.
15//
16// We mean it.
17
18#include <qtqmlcompilerexports.h>
19
20#include <QtCore/qstring.h>
21#include <QtCore/qhash.h>
22#include <QtCore/qlist.h>
23#include <QtCore/private/qflatmap_p.h>
24
25#include <QtQml/private/qqmljssourcelocation_p.h>
26
27#include <QtQmlToolingSettings/private/qqmltoolingsettings_p.h>
28
29QT_BEGIN_NAMESPACE
30
31class QSettings;
32
33namespace QQmlJS {
34class LoggerCategory;
35
48
49class Q_QMLCOMPILER_EXPORT HeuristicContextProperties
50{
51public:
52 bool contains(const QString &name) const { return m_properties.contains(name); }
53 qsizetype size() const { return m_properties.size(); }
54 bool isValid() const { return !m_properties.isEmpty(); }
56 void writeCache(const QString &folder) const;
57
59
62
70
71private:
72 struct Entry
73 {
76
77 friend bool comparesEqual(const Entry &a, const Entry &b) noexcept
78 {
79 return a.name == b.name && a.definitions == b.definitions;
80 }
82 };
83
84 void collectFromDirs(const QList<QString> &dirs);
85 void collectFromFile(const QString &file);
86 void grepFallback(const QList<QString> &rootUrls);
87#if QT_CONFIG(process) && !defined(Q_OS_WINDOWS)
88 void parseGrepOutput(const QString &output);
89#endif
90
92};
93
94} // namespace QQmlJS
95
96QT_END_NAMESPACE
97
98#endif // QQMLJSCONTEXTPROPERTIES_P_H
static const QRegularExpression s_matchSetContextProperty
static constexpr auto cachedHeuristicListKey
static constexpr QLatin1StringView s_pattern
static constexpr int s_contextPropertyNameIdxInPattern
static constexpr std::array s_fileFilters