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

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