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 #include "feedparser.h" 0007 #include <QJsonDocument> 0008 #include <QObject> 0009 #include "kweathercore/kweathercore_export.h" 0010 class QNetworkReply; 0011 namespace KWeatherCore 0012 { 0013 class PendingAlertsPrivate; 0014 using AlertEntries = 0015 std::shared_ptr<std::vector<std::unique_ptr<AlertFeedEntry>>>; 0016 /** 0017 * @short The PendingAlerts class contains the reply to an asynchronous 0018 * CAP feed request. 0019 * 0020 * @see AlertFeedEntry 0021 * 0022 * @author Han Young <hanyoung@protonmail.com> 0023 */ 0024 class KWEATHERCORE_EXPORT PendingAlerts : public QObject 0025 { 0026 Q_OBJECT 0027 public: 0028 /** 0029 * value pointer to the shared alerts data 0030 * the pointer is nullptr until finished() raised 0031 * @return 0032 */ 0033 AlertEntries value() const; 0034 /** 0035 * isFinished if the call has finished 0036 * @return 0037 */ 0038 bool isFinished() const; 0039 Q_SIGNALS: 0040 /** 0041 * signals the call has finished 0042 */ 0043 void finished(); 0044 /** 0045 * indicate there is a network error 0046 */ 0047 void networkError(); 0048 0049 protected: 0050 friend class AlertManager; 0051 explicit PendingAlerts(const QJsonDocument &config, 0052 QNetworkReply *reply = nullptr); 0053 0054 private: 0055 PendingAlertsPrivate *d = nullptr; 0056 }; 0057 }