Changeset View
Changeset View
Standalone View
Standalone View
src/core/tagsfilterchecker.cpp
Show First 20 Lines • Show All 61 Lines • ▼ Show 20 Line(s) | 61 | public: | |||
---|---|---|---|---|---|
62 | EqualityValidator(const QString &tag, const QString &value) | 62 | EqualityValidator(const QString &tag, const QString &value) | ||
63 | : Validator(tag, value) | 63 | : Validator(tag, value) | ||
64 | {} | 64 | {} | ||
65 | ~EqualityValidator() override {} | 65 | ~EqualityValidator() override {} | ||
66 | bool filterAccepts(const QString &tag, const QString &value) override | 66 | bool filterAccepts(const QString &tag, const QString &value) override | ||
67 | { | 67 | { | ||
68 | bool result = true; | 68 | bool result = true; | ||
69 | if (tag == m_tag && !m_acceptedValues.contains(value)) { | 69 | if (tag == m_tag && !m_acceptedValues.contains(value)) { | ||
70 | qCDebug(KNEWSTUFFCORE) << "Item excluded by filter on" << m_tag << "because" << value << "was not included in" << m_acceptedValues; | ||||
70 | result = false; | 71 | result = false; | ||
71 | } | 72 | } | ||
72 | return result; | 73 | return result; | ||
73 | } | 74 | } | ||
74 | }; | 75 | }; | ||
75 | 76 | | |||
76 | // Will only accept entries which have none of the values set for the tag key | 77 | // Will only accept entries which have none of the values set for the tag key | ||
77 | class InequalityValidator : public Validator | 78 | class InequalityValidator : public Validator | ||
78 | { | 79 | { | ||
79 | public: | 80 | public: | ||
80 | InequalityValidator(const QString &tag, const QString &value) | 81 | InequalityValidator(const QString &tag, const QString &value) | ||
81 | : Validator(tag, value) | 82 | : Validator(tag, value) | ||
82 | {} | 83 | {} | ||
83 | ~InequalityValidator() override {} | 84 | ~InequalityValidator() override {} | ||
84 | bool filterAccepts(const QString &tag, const QString &value) override | 85 | bool filterAccepts(const QString &tag, const QString &value) override | ||
85 | { | 86 | { | ||
86 | bool result = true; | 87 | bool result = true; | ||
87 | if (tag == m_tag && m_acceptedValues.contains(value)) { | 88 | if (tag == m_tag && m_acceptedValues.contains(value)) { | ||
89 | qCDebug(KNEWSTUFFCORE) << "Item excluded by filter on" << m_tag << "because" << value << "was included in" << m_acceptedValues; | ||||
88 | result = false; | 90 | result = false; | ||
89 | } | 91 | } | ||
90 | return result; | 92 | return result; | ||
91 | } | 93 | } | ||
92 | }; | 94 | }; | ||
93 | 95 | | |||
94 | void addValidator(const QString &filter) | 96 | void addValidator(const QString &filter) | ||
95 | { | 97 | { | ||
▲ Show 20 Lines • Show All 73 Lines • Show Last 20 Lines |