KWeatherCore

reply.h
1/*
2 * SPDX-FileCopyrightText: 2022 Volker Krause <vkrause@kde.org>
3 * SPDX-License-Identifier: LGPL-2.0-or-later
4 */
5
6#ifndef KWEATHERCORE_REPLY_H
7#define KWEATHERCORE_REPLY_H
8
9#include <kweathercore/kweathercore_export.h>
10
11#include <QObject>
12
13#include <memory>
14
15namespace KWeatherCore
16{
17
18class ReplyPrivate;
19
20/** Base class for all asynchronous jobs.
21 * @since 0.6
22 */
23class KWEATHERCORE_EXPORT Reply : public QObject
24{
25 Q_OBJECT
26public:
27 ~Reply() override;
28
29 /** Possible error states of the job. */
30 enum Error {
31 NoError,
32 NetworkError, ///< Network operation failed
33 RateLimitExceeded, ///< Remote API rate limited exceeded
34 NotFound, ///< The queried information could not be found by the backend (e.g. unknown location).
35 NoService, ///< There is no service available for obtaining the requested information.
36 };
37
38 /** Error state of the job. */
39 Error error() const;
40
41 /** Error message of the job.
42 * Only valid if error() returns something other than NoError.
43 */
44 QString errorMessage() const;
45
46Q_SIGNALS:
47 /**
48 * Emitted once the job has been finished, either successfully or with an error.
49 *
50 * Connect to this signal for every job you create to obtain its result and
51 * delete it eventually.
52 */
53 void finished();
54
55protected:
56 explicit Reply(ReplyPrivate *dd, QObject *parent);
57
58 Q_DECLARE_PRIVATE(Reply)
59 std::unique_ptr<ReplyPrivate> d_ptr;
60};
61
62}
63
64#endif // KWEATHERCORE_REPLY_H
Base class for all asynchronous jobs.
Definition reply.h:24
void finished()
Emitted once the job has been finished, either successfully or with an error.
Error
Possible error states of the job.
Definition reply.h:30
@ NoService
There is no service available for obtaining the requested information.
Definition reply.h:35
@ NetworkError
Network operation failed.
Definition reply.h:32
@ RateLimitExceeded
Remote API rate limited exceeded.
Definition reply.h:33
@ NotFound
The queried information could not be found by the backend (e.g. unknown location).
Definition reply.h:34
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Mon Nov 18 2024 12:18:45 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.