Mailcommon

searchrulestring.h
1 /*
2  SPDX-FileCopyrightText: 2015-2022 Laurent Montel <[email protected]>
3 
4  SPDX-License-Identifier: GPL-2.0-or-later
5 */
6 
7 #pragma once
8 
9 #include "searchpattern.h"
10 #include <Akonadi/Item>
11 
12 /**
13  * @short This class represents a search pattern rule operating on a string.
14  *
15  * This class represents a search to be performed against a string.
16  * The string can be either a message header, or a pseudo header, such
17  * as <body>
18  */
19 namespace MailCommon
20 {
21 class SearchRuleString : public SearchRule
22 {
23 public:
24  /**
25  * Creates new new string search rule.
26  *
27  * @param field The field to search in.
28  * @param function The function to use for searching.
29  * @param contents The contents to search for.
30  */
31  explicit SearchRuleString(const QByteArray &field = QByteArray(), Function function = FuncContains, const QString &contents = QString());
32 
33  /**
34  * Creates a new string search rule from an @p other rule.
35  */
36  SearchRuleString(const SearchRuleString &other);
37 
38  /**
39  * Initializes this rule with an @p other rule.
40  */
41  const SearchRuleString &operator=(const SearchRuleString &other);
42 
43  /**
44  * Destroys the string search rule.
45  */
46  ~SearchRuleString() override;
47 
48  /**
49  * @copydoc SearchRule::isEmpty()
50  */
51  Q_REQUIRED_RESULT bool isEmpty() const override;
52 
53  /**
54  * @copydoc SearchRule::requiredPart()
55  */
56  Q_REQUIRED_RESULT RequiredPart requiredPart() const override;
57 
58  /**
59  * @copydoc SearchRule::matches()
60  */
61  Q_REQUIRED_RESULT bool matches(const Akonadi::Item &item) const override;
62 
63  /**
64  * A helper method for the main matches() method.
65  * Does the actual comparing.
66  */
67  Q_REQUIRED_RESULT bool matchesInternal(const QString &contents) const;
68 
69  /**
70  * @copydoc SearchRule::addQueryTerms()
71  */
72  void addQueryTerms(Akonadi::SearchTerm &groupTerm, bool &emptyIsNotAnError) const override;
73  Q_REQUIRED_RESULT QString informationAboutNotValidRules() const override;
74 };
75 }
RequiredPart
Possible required parts.
Definition: searchrule.h:68
const SearchRule & operator=(const SearchRule &other)
Initializes this rule with an other rule.
Definition: searchrule.cpp:64
The filter dialog.
This file is part of the KDE documentation.
Documentation copyright © 1996-2022 The KDE developers.
Generated on Sat Sep 24 2022 03:58:15 by doxygen 1.8.17 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.