File indexing completed on 2024-04-28 04:42:43

0001 /*
0002  * SPDX-FileCopyrightText: 2021 Han Young <hanyoung@protonmail.com>
0003  *
0004  * SPDX-License-Identifier: LGPL-2.0-or-later
0005  */
0006 
0007 #ifndef KWEATHERCORE_PENDINGALERTS_H
0008 #define KWEATHERCORE_PENDINGALERTS_H
0009 
0010 #include "feedparser.h"
0011 #include "reply.h"
0012 
0013 class QJsonDocument;
0014 class QNetworkReply;
0015 
0016 namespace KWeatherCore
0017 {
0018 class PendingAlertsPrivate;
0019 using AlertEntries = std::shared_ptr<std::vector<std::unique_ptr<AlertFeedEntry>>>;
0020 /**
0021  * @short The PendingAlerts class contains the reply to an asynchronous
0022  * CAP feed request.
0023  *
0024  * @see AlertFeedEntry
0025  *
0026  * @author Han Young <hanyoung@protonmail.com>
0027  */
0028 class KWEATHERCORE_EXPORT PendingAlerts : public Reply
0029 {
0030     Q_OBJECT
0031 public:
0032     ~PendingAlerts() override;
0033 
0034     /**
0035      * value pointer to the shared alerts data
0036      * the pointer is nullptr until finished() raised
0037      * @return
0038      */
0039     AlertEntries value() const;
0040 
0041 private:
0042     friend class AlertManager;
0043     explicit PendingAlerts(const QJsonDocument &config, QNetworkReply *reply, QObject *parent = nullptr);
0044     Q_DECLARE_PRIVATE(PendingAlerts)
0045 };
0046 }
0047 
0048 #endif