Mailcommon

searchrulenumerical.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#include "mailcommon_private_export.h"
9#include "searchpattern.h"
10#include <Akonadi/Item>
11namespace MailCommon
12{
13/**
14 * @short This class represents a search pattern rule operating on numerical values.
15 *
16 * This class represents a search to be performed against a numerical value,
17 * such as the age of the message in days or its size.
18 */
19class MAILCOMMON_TESTS_EXPORT SearchRuleNumerical : public SearchRule
20{
21public:
22 /**
23 * Creates new numerical search rule.
24 *
25 * @param field The field to search in.
26 * @param function The function to use for searching.
27 * @param contents The contents to search for.
28 */
29 explicit SearchRuleNumerical(const QByteArray &field = QByteArray(), Function function = FuncContains, const QString &contents = QString());
30
31 /**
32 * @copydoc SearchRule::isEmpty()
33 */
34 [[nodiscard]] bool isEmpty() const override;
35
36 /**
37 * @copydoc SearchRule::matches()
38 */
39 [[nodiscard]] bool matches(const Akonadi::Item &item) const override;
40
41 /**
42 * @copydoc SearchRule::requiredPart()
43 */
44 [[nodiscard]] RequiredPart requiredPart() const override;
45
46 // Optimized matching not implemented, will use the unoptimized matching
47 // from SearchRule
48 using SearchRule::matches;
49
50 /**
51 * A helper method for the main matches() method.
52 * Does the actual comparing.
53 */
54 bool matchesInternal(long numericalValue, long numericalContents, const QString &contents) const;
55
56 /**
57 * @copydoc SearchRule::addQueryTerms()
58 */
59 void addQueryTerms(Akonadi::SearchTerm &groupTerm, bool &emptyIsNotAnError) const override;
60 [[nodiscard]] QString informationAboutNotValidRules() const override;
61};
62}
This class represents a search pattern rule operating on numerical values.
This class represents one search pattern rule.
Definition searchrule.h:24
Function
Describes operators for comparison of field and contents.
Definition searchrule.h:40
RequiredPart
Possible required parts.
Definition searchrule.h:70
The filter dialog.
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Sat Dec 21 2024 17:00:25 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.