KNewStuff

resultsstream.h
1/*
2 SPDX-FileCopyrightText: 2023 Aleix Pol Gonzalez <aleixpol@kde.org>
3
4 SPDX-License-Identifier: LGPL-2.1-or-later
5*/
6
7#ifndef RESULTSSTREAM_H
8#define RESULTSSTREAM_H
9
10#include <QObject>
11
12#include "enginebase.h"
13#include "provider.h"
14
15#include "knewstuffcore_export.h"
16
17namespace KNSCore
18{
19class SearchRequest;
20class ResultsStreamPrivate;
21/**
22 * The ResultsStream is returned by EngineBase::search. It is used to communicate
23 * the different entries in response to a request using the signal @m entriesFound.
24 *
25 * Initially the stream will communicate the entries part of the page as specified
26 * in the request. Further pages can be requested using @m fetchMore.
27 *
28 * Once we have reached the end of the requested stream, the object shall emit
29 * @m finished and delete itself.
30 *
31 * @since 6.0
32 */
33class KNEWSTUFFCORE_EXPORT ResultsStream : public QObject
34{
35 Q_OBJECT
36public:
37 ~ResultsStream() override;
38
39 /// Issues the search, make sure all signals are connected before calling
40 void fetch();
41
42 /// Increments the requested page and issues another search
43 void fetchMore();
44
45Q_SIGNALS:
46 void entriesFound(const KNSCore::Entry::List &entries);
47 void finished();
48
49private:
50 friend class EngineBase;
51#if KNEWSTUFFCORE_ENABLE_DEPRECATED_SINCE(6, 9)
52 /// @deprecated since 6.9 Use SearchRequest constructor
53 KNEWSTUFFCORE_DEPRECATED_VERSION(6, 9, "Use SearchRequest constructor")
55#endif
56 /**
57 * @param request The search request to be issued
58 * @param base The engine issuing the request
59 * @since 6.9
60 */
61 ResultsStream(const SearchRequest &request, EngineBase *base);
62 void finish();
63
64 std::unique_ptr<ResultsStreamPrivate> d;
65};
66
67}
68
69#endif // RESULTSSTREAM_H
KNewStuff engine.
Definition enginebase.h:56
The ResultsStream is returned by EngineBase::search.
A search request.
used to keep track of a search
Definition provider.h:77
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Fri Dec 6 2024 12:13:34 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.