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
qqmlpreviewblacklist.h
Go to the documentation of this file.
1// Copyright (C) 2018 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// Qt-Security score:significant
4
5#ifndef QQMLPREVIEWBLACKLIST_H
6#define QQMLPREVIEWBLACKLIST_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
19#include <QtCore/qhash.h>
20#include <QtCore/qchar.h>
21#include <QtCore/qstring.h>
22#include <algorithm>
23
24QT_BEGIN_NAMESPACE
25
26class QQmlPreviewBlacklist
27{
28public:
29 void blacklist(const QString &path);
30 void whitelist(const QString &path);
31 bool isBlacklisted(const QString &path) const;
32 void clear();
33
34private:
35 class Node {
36 public:
37 enum PrefixResult {
38 MatchedLeaf,
39 MatchedBranch,
40 Unmatched,
41 };
42
43 Node();
44 Node(const Node &other);
45 Node(Node &&other) noexcept;
46
47 ~Node();
48
49 Node &operator=(const Node &other);
50 Node &operator=(Node &&other) noexcept;
51
52 void split(QString::iterator it, QString::iterator end);
53 void insert(const QString &path, int offset);
54 void remove(const QString &path, int offset);
55 PrefixResult findPrefix(const QString &path, int offset) const;
56
57 private:
58 Node(const QString &mine, const QHash<QChar, Node *> &next = QHash<QChar, Node *>(),
59 bool isLeaf = true);
60
61 QString m_mine;
62 QHash<QChar, Node *> m_next;
63 bool m_isLeaf = false;
64 };
65
66 Node m_root;
67};
68
70
71#endif // QQMLPREVIEWBLACKLIST_H
void messageReceived(const QByteArray &message) override
void foundTranslationBinding(const TranslationBindingInformation &translationBindingInformation) override
void engineAboutToBeAdded(QJSEngine *engine) override
void state(const QString &stateName)
void engineAboutToBeRemoved(QJSEngine *engine) override
QMultiMap< QObject *, TranslationBindingInformation > objectTranslationBindingMultiMap
QList< QPointer< QQuickItem > > translatableTextOccurrences
std::unique_ptr< QAbstractFileEngine > create(const QString &fileName) const override
If this file handler can handle fileName, this method creates a file engine and returns it wrapped in...
QQmlPreviewFileLoader(QQmlPreviewServiceImpl *service)
Result load(const QString &file)
bool isBlacklisted(const QString &file)
void whitelist(const QUrl &url)
void dropCU(const QUrl &url)
void zoom(qreal newFactor)
QQuickItem * currentRootItem()
bool eventFilter(QObject *obj, QEvent *event) override
Filters events if this object has been installed as an event filter for the watched object.
void fps(const FpsInfo &info)
void removeEngine(QQmlEngine *engine)
void addEngine(QQmlEngine *engine)
void loadUrl(const QUrl &url)
bool operator==(const QQmlPreviewPosition::ScreenData &other) const
void loadWindowPositionSettings(const QUrl &url)
void takePosition(QWindow *window, InitializeState state=PositionInitialized)
void initLastSavedWindowPosition(QWindow *window)
void forwardRequest(const QString &file)
void drop(const QUrl &url)
void engineAboutToBeRemoved(QJSEngine *engine) override
QQmlPreviewServiceImpl(QObject *parent=nullptr)
void file(const QString &file, const QByteArray &contents)
void directory(const QString &file, const QStringList &entries)
void engineAboutToBeAdded(QJSEngine *engine) override
void forwardFps(const QQmlPreviewHandler::FpsInfo &frames)
void zoom(qreal factor)
static const QString s_key
void load(const QUrl &url)
void stateChanged(State state) override
void forwardError(const QString &error)
void messageReceived(const QByteArray &message) override
Combined button and popup list for selecting options.
QDebug operator<<(QDebug dbg, const QFileInfo &fi)
static QString translationIdString(const QQmlTranslation::QsTrData &data)