File indexing completed on 2024-05-05 16:49:22
0001 /* 0002 * SPDX-FileCopyrightText: 2021 Han Young <hanyoung@protonmail.com> 0003 * 0004 * SPDX-License-Identifier: LGPL-2.0-or-later 0005 */ 0006 #pragma once 0007 #include <QObject> 0008 #include <memory> 0009 #include "alertentry.h" 0010 #include "kweathercore/kweathercore_export.h" 0011 class QNetworkReply; 0012 namespace KWeatherCore { 0013 class PendingCAPPrivate; 0014 /** 0015 * @short The PendingAlerts class contains the reply to an asynchronous 0016 * CAP request. 0017 * 0018 * @see AlertEntry 0019 * 0020 * @author Han Young <hanyoung@protonmail.com> 0021 */ 0022 class KWEATHERCORE_EXPORT PendingCAP : public QObject 0023 { 0024 Q_OBJECT 0025 public: 0026 /** 0027 * value pointer to the shared alerts data 0028 * the pointer is nullptr until finished() raised 0029 * @return 0030 */ 0031 std::unique_ptr<AlertEntry> value() const; 0032 /** 0033 * isFinished if the call has finished 0034 * @return 0035 */ 0036 bool isFinished() const; 0037 Q_SIGNALS: 0038 /** 0039 * signals the call has finished 0040 */ 0041 void finished(); 0042 /** 0043 * indicate there is a network error 0044 */ 0045 void networkError(); 0046 protected: 0047 friend class AlertFeedEntry; 0048 explicit PendingCAP(QNetworkReply *reply = nullptr); 0049 private: 0050 PendingCAPPrivate *d = nullptr; 0051 }; 0052 }