KNewStuff

searchrequest.h
1// SPDX-License-Identifier: LGPL-2.1-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL
2// SPDX-FileCopyrightText: 2024 Harald Sitter <sitter@kde.org>
3
4#pragma once
5
6#include <QStringList>
7
8#include "knewstuffcore_export.h"
9
10namespace KNSCore
11{
12Q_NAMESPACE_EXPORT(KNEWSTUFFCORE_EXPORT)
13
14struct SearchRequestPrivate;
15
16/**
17 * @since 6.9
18 */
19enum class SortMode {
20 Newest,
21 Alphabetical,
22 Rating,
23 Downloads,
24};
25Q_ENUM_NS(SortMode)
26
27/**
28 * @since 6.9
29 */
30enum class Filter {
31 None,
32 Installed,
33 Updates,
34 ExactEntryId,
35};
36Q_ENUM_NS(Filter)
37
38KNEWSTUFFCORE_EXPORT QDebug operator<<(QDebug, const class SearchRequest &);
39
40/**
41 * @brief A search request
42 * @since 6.9
43 */
44class KNEWSTUFFCORE_EXPORT SearchRequest
45{
46public:
47 SearchRequest(SortMode sortMode_ = KNSCore::SortMode::Downloads,
48 Filter filter_ = KNSCore::Filter::None,
49 const QString &searchTerm_ = {},
50 const QStringList &categories_ = {},
51 int page_ = -1,
52 int pageSize_ = 20);
53
54 [[nodiscard]] SortMode sortMode() const;
55 [[nodiscard]] Filter filter() const;
56 [[nodiscard]] QString searchTerm() const;
57 [[nodiscard]] QStringList categories() const;
58 [[nodiscard]] int page() const;
59 [[nodiscard]] int pageSize() const;
60 [[nodiscard]] SearchRequest nextPage() const;
61
62private:
63 friend class ResultsStream;
64 friend class AtticaProvider;
65 friend class AtticaRequester;
66 friend class StaticXmlProvider;
67 friend class OPDSProvider;
68 friend class Cache2;
69 friend QDebug KNSCore::operator<<(QDebug, const SearchRequest &);
70 std::shared_ptr<SearchRequestPrivate> d;
71};
72
73} // namespace KNSCore
The ResultsStream is returned by EngineBase::search.
A search request.
KTEXTEDITOR_EXPORT QDebug operator<<(QDebug s, const MovingCursor &cursor)
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Fri Dec 13 2024 11:51:58 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.