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

0001 /*
0002  * SPDX-FileCopyrightText: 2020-2021 Han Young <hanyoung@protonmail.com>
0003  * SPDX-FileCopyrightText: 2020 Devin Lin <espidev@gmail.com>
0004  *
0005  * SPDX-License-Identifier: LGPL-2.0-or-later
0006  */
0007 #pragma once
0008 
0009 #include "reply.h"
0010 #include "weatherforecast.h"
0011 
0012 class QNetworkAccessManager;
0013 
0014 namespace KWeatherCore
0015 {
0016 class PendingWeatherForecastPrivate;
0017 /**
0018  * @short The PendingWeatherForecast class contains the reply to an asynchronous
0019  * weather forecast request.
0020  *
0021  * @see WeatherForecastSource
0022  *
0023  * @author Han Young <hanyoung@protonmail.com>
0024  */
0025 class KWEATHERCORE_EXPORT PendingWeatherForecast : public Reply
0026 {
0027     Q_OBJECT
0028 public:
0029     ~PendingWeatherForecast() override;
0030 
0031     /**
0032      * value pointer to the shared weather data
0033      * the pointer is nullptr until finished() raised
0034      * @return
0035      */
0036     WeatherForecast value() const;
0037 
0038 private:
0039     friend class WeatherForecastSource;
0040     explicit PendingWeatherForecast(double latitude,
0041                                     double longitude,
0042                                     const QString &timezone,
0043                                     QNetworkAccessManager *nam,
0044                                     QObject *parent = nullptr);
0045     explicit PendingWeatherForecast(WeatherForecast data, QObject *parent = nullptr);
0046     Q_DECLARE_PRIVATE(PendingWeatherForecast)
0047 };
0048 }