KNewStuff

tagsfilterchecker.h
1 /*
2  SPDX-FileCopyrightText: 2018 Dan Leinir Turthra Jensen <[email protected]>
3 
4  SPDX-License-Identifier: LGPL-2.1-or-later
5 */
6 
7 #ifndef KNSCORE_TAGSFILTERCHECKER_H
8 #define KNSCORE_TAGSFILTERCHECKER_H
9 
10 #include "knewstuffcore_export.h"
11 #include <QStringList>
12 
13 namespace KNSCore
14 {
15 /**
16  * @brief Apply simple filtering logic to a list of tags
17  *
18  * == Examples of specifying tag filters ==
19  * Value for tag "tagname" must be exactly "tagdata":
20  * tagname==tagdata
21  *
22  * Value for tag "tagname" must be different from "tagdata":
23  * tagname!=tagdata
24  *
25  * == Tag filter list ==
26  * A tag filter list is a string list of filters as shown above, and a combination
27  * of which might look like:
28  *
29  * - ghns_excluded!=1
30  * - data##mimetype==application/cbr+zip
31  * - data##mimetype==application/cbr+rar
32  *
33  * which would filter out anything which has ghns_excluded set to 1, and
34  * anything where the value of data##mimetype does not equal either
35  * "application/cbr+zip" or "application/cbr+rar".
36  * Notice in particular the two data##mimetype entries. Use this
37  * for when a tag may have multiple values.
38  *
39  * The value does not current support wildcards. The list should be considered
40  * a binary AND operation (that is, all filter entries must match for the data
41  * entry to be included in the return data)
42  * @since 5.51
43  */
44 class KNEWSTUFFCORE_EXPORT TagsFilterChecker
45 {
46 public:
47  /**
48  * Constructs an instance of the tags filter checker, prepopulated
49  * with the list of tag filters in the tagFilter parameter.
50  *
51  * @param tagFilter The list of tag filters
52  * @since 5.51
53  */
54  TagsFilterChecker(const QStringList &tagFilter);
56 
57  TagsFilterChecker(const TagsFilterChecker &) = delete;
58  TagsFilterChecker &operator=(const TagsFilterChecker &) = delete;
59 
60  /**
61  * Check whether the filter list accepts the passed list of tags
62  *
63  * @param tags A list of tags in the form of key=value strings
64  * @return True if the filter accepts the list, false if not
65  * @since 5.51
66  */
67  bool filterAccepts(const QStringList &tags);
68 
69 private:
70  class Private;
71  Private *d;
72 };
73 
74 }
75 
76 #endif // KNSCORE_TAGSFILTERCHECKER_H
Contains the core functionality for handling interaction with NewStuff providers. ...
Apply simple filtering logic to a list of tags.
This file is part of the KDE documentation.
Documentation copyright © 1996-2021 The KDE developers.
Generated on Tue Nov 30 2021 22:38:13 by doxygen 1.8.11 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.