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

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 "kweathercore/kweathercore_export.h"
0008 #include <QList>
0009 #include <QObject>
0010 #include <memory>
0011 class QNetworkAccessManager;
0012 namespace KWeatherCore
0013 {
0014 class PendingAlerts;
0015 /**
0016  * @short The AlertManager class is intened to get pending weather
0017  * alerts about a location
0018  *
0019  * @see Pendingalerts
0020  *
0021  * @author Nikunj Goyal <nikunjgoyal31@gmail.com>
0022  */
0023 class KWEATHERCORE_EXPORT AlertManager
0024 {
0025 public:
0026     /** inst
0027      * return a pointer to the global instance
0028      * @return
0029      */
0030     static AlertManager *inst();
0031     ~AlertManager();
0032     AlertManager(const AlertManager &other);
0033     /** availableCountries
0034      * @return names of all available countries supported
0035      */
0036     QList<QString> availableCountries() const;
0037     /** getAlerts
0038      *  @param country country for which alerts have to be received
0039      *  @return it is the client's responsibility to delete the
0040      *  PendingAlerts afterhand to avoid memory leak
0041      */
0042     PendingAlerts *getAlerts(const QString &country) const;
0043     AlertManager &operator=(const AlertManager &other);
0044     AlertManager &operator=(AlertManager &&other);
0045 
0046 private:
0047     AlertManager();
0048     class AlertManagerPrivate;
0049     std::unique_ptr<AlertManagerPrivate> d;
0050     void loadConfigs();
0051 };
0052 }