Mailcommon

searchrulestring.h
1/*
2 SPDX-FileCopyrightText: 2015-2024 Laurent Montel <montel@kde.org>
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 */
19namespace MailCommon
20{
21class SearchRuleString : public SearchRule
22{
23public:
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 [[nodiscard]] bool isEmpty() const override;
52
53 /**
54 * @copydoc SearchRule::requiredPart()
55 */
56 [[nodiscard]] RequiredPart requiredPart() const override;
57
58 /**
59 * @copydoc SearchRule::matches()
60 */
61 [[nodiscard]] 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 [[nodiscard]] bool matchesInternal(const QString &contents) const;
68
69 /**
70 * @copydoc SearchRule::addQueryTerms()
71 */
72 void addQueryTerms(Akonadi::SearchTerm &groupTerm, bool &emptyIsNotAnError) const override;
73 [[nodiscard]] QString informationAboutNotValidRules() const override;
74};
75}
QByteArray field() const
Returns the message header field name (without the trailing ':').
Function function() const
Returns the filter function of the rule.
QString contents() const
Returns the contents of the rule.
RequiredPart
Possible required parts.
Definition searchrule.h:68
The filter dialog.
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Tue Mar 26 2024 11:14:01 by doxygen 1.10.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.