| 1 | // Copyright (C) 2020 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 QQMLDOMFIELDFILTER_P_H | 
|---|
| 5 | #define QQMLDOMFIELDFILTER_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 "qqmldom_fwd_p.h" | 
|---|
| 19 | #include "qqmldom_global.h" | 
|---|
| 20 | #include "qqmldompath_p.h" | 
|---|
| 21 |  | 
|---|
| 22 | #include <QtCore/qobject.h> | 
|---|
| 23 | #include <QtCore/qmap.h> | 
|---|
| 24 | #include <QtCore/qset.h> | 
|---|
| 25 | #include <QtQml/private/qqmljsastvisitor_p.h> | 
|---|
| 26 |  | 
|---|
| 27 | QT_BEGIN_NAMESPACE | 
|---|
| 28 |  | 
|---|
| 29 | namespace QQmlJS { | 
|---|
| 30 | namespace Dom { | 
|---|
| 31 |  | 
|---|
| 32 | class QMLDOM_EXPORT FieldFilter | 
|---|
| 33 | { | 
|---|
| 34 | Q_GADGET | 
|---|
| 35 | public: | 
|---|
| 36 | QString describeFieldsFilter() const; | 
|---|
| 37 | bool addFilter(const QString &f); | 
|---|
| 38 | bool operator()(const DomItem &, const Path &, const DomItem &) const; | 
|---|
| 39 | bool operator()(const DomItem &, const PathEls::PathComponent &c, const DomItem &) const; | 
|---|
| 40 | static FieldFilter noFilter(); | 
|---|
| 41 | static FieldFilter defaultFilter(); | 
|---|
| 42 | static FieldFilter noLocationFilter(); | 
|---|
| 43 | static FieldFilter compareFilter(); | 
|---|
| 44 | static FieldFilter (); | 
|---|
| 45 | void setFiltred(); | 
|---|
| 46 | const QMultiMap<QString, QString> &fieldFilterAdd() const { return m_fieldFilterAdd; } | 
|---|
| 47 | QMultiMap<QString, QString> fieldFilterRemove() const { return m_fieldFilterRemove; } | 
|---|
| 48 | QSet<DomType> filtredTypes; | 
|---|
| 49 |  | 
|---|
| 50 | FieldFilter(const QMultiMap<QString, QString> &fieldFilterAdd = {}, | 
|---|
| 51 | const QMultiMap<QString, QString> &fieldFilterRemove = {}) | 
|---|
| 52 | : m_fieldFilterAdd(fieldFilterAdd), m_fieldFilterRemove(fieldFilterRemove) | 
|---|
| 53 | { | 
|---|
| 54 | setFiltred(); | 
|---|
| 55 | } | 
|---|
| 56 |  | 
|---|
| 57 | private: | 
|---|
| 58 | QMultiMap<QString, QString> m_fieldFilterAdd; | 
|---|
| 59 | QMultiMap<QString, QString> m_fieldFilterRemove; | 
|---|
| 60 | QSet<DomType> m_filtredTypes; | 
|---|
| 61 | QSet<size_t> m_filtredFields; | 
|---|
| 62 | bool m_filtredDefault = true; | 
|---|
| 63 | }; | 
|---|
| 64 |  | 
|---|
| 65 | } // end namespace Dom | 
|---|
| 66 | } // end namespace QQmlJS | 
|---|
| 67 |  | 
|---|
| 68 | QT_END_NAMESPACE | 
|---|
| 69 | #endif // QQMLDOMFIELDFILTER_P_H | 
|---|
| 70 |  | 
|---|