File indexing completed on 2024-05-05 16:49:23

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 #include "locationqueryresult.h"
0009 #include "pendingweatherforecast.h"
0010 #include "weatherforecast.h"
0011 #include <QObject>
0012 #include <kweathercore/kweathercore_export.h>
0013 class QNetworkReply;
0014 namespace KWeatherCore
0015 {
0016 class WeatherForecastSourcePrivate;
0017 /**
0018  * @short The WeatherForecastSource class is intened for query weather
0019  * information about a location
0020  *
0021  * @see WeatherForecast, PendingWeatherForecast
0022  *
0023  * @author Han Young <hanyoung@protonmail.com>
0024  */
0025 class KWEATHERCORE_EXPORT WeatherForecastSource : public QObject
0026 {
0027     Q_OBJECT
0028 public:
0029     WeatherForecastSource(QObject *parent = nullptr);
0030     /**
0031      * requestData
0032      * @param latitude
0033      * @param longitude
0034      * @param timezone
0035      * @param sunrise caching purpose
0036      * @return it is the client's responsibility to delete the
0037      * PendingWeatherForecast afterhand to avoid memory leak
0038      */
0039     PendingWeatherForecast *
0040     requestData(double latitude,
0041                 double longitude,
0042                 QString timezone = QString(),
0043                 const std::vector<Sunrise> &sunrise = std::vector<Sunrise>());
0044 
0045     /**
0046      * requestData
0047      * @param result
0048      * @return it is the client's responsibility to delete the
0049      * PendingWeatherForecast afterhand to avoid memory leak
0050      */
0051     PendingWeatherForecast *
0052     requestData(const KWeatherCore::LocationQueryResult &result);
0053 
0054 private:
0055     WeatherForecastSourcePrivate *d = nullptr;
0056 };
0057 }