File indexing completed on 2024-04-28 04:42:42
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 #include "locationqueryresult.h" 0008 #include <memory> 0009 #include <optional> 0010 namespace KWeatherCore 0011 { 0012 class LocationQueryResult::LocationQueryResultPrivate 0013 { 0014 public: 0015 double latitude, longitude; 0016 QString toponymName, name, countryCode, countryName, geonameId; 0017 std::optional<QString> subdivision; 0018 }; 0019 LocationQueryResult::LocationQueryResult() 0020 : d(std::make_unique<LocationQueryResultPrivate>()) 0021 { 0022 } 0023 LocationQueryResult::LocationQueryResult(LocationQueryResult &&other) = default; 0024 LocationQueryResult::LocationQueryResult(double latitude, 0025 double longitude, 0026 QString toponymName, 0027 QString name, 0028 QString countryCode, 0029 QString countryName, 0030 QString geonameId, 0031 std::optional<QString> subdivision) 0032 : d(std::make_unique<LocationQueryResultPrivate>()) 0033 { 0034 d->latitude = latitude; 0035 d->longitude = longitude; 0036 d->toponymName = std::move(toponymName); 0037 d->name = std::move(name); 0038 d->countryCode = std::move(countryCode); 0039 d->countryName = std::move(countryName); 0040 d->geonameId = std::move(geonameId); 0041 d->subdivision = std::move(subdivision); 0042 } 0043 LocationQueryResult::LocationQueryResult(const LocationQueryResult &other) 0044 : d(std::make_unique<LocationQueryResultPrivate>()) 0045 { 0046 *d = *other.d; 0047 } 0048 LocationQueryResult::~LocationQueryResult() = default; 0049 LocationQueryResult &LocationQueryResult::operator=(const LocationQueryResult &other) 0050 { 0051 *d = *other.d; 0052 return *this; 0053 } 0054 LocationQueryResult &LocationQueryResult::operator=(LocationQueryResult &&other) = default; 0055 double LocationQueryResult::latitude() const 0056 { 0057 return d->latitude; 0058 } 0059 double LocationQueryResult::longitude() const 0060 { 0061 return d->longitude; 0062 } 0063 const QString &LocationQueryResult::toponymName() const 0064 { 0065 return d->toponymName; 0066 } 0067 const QString &LocationQueryResult::name() const 0068 { 0069 return d->name; 0070 } 0071 const QString &LocationQueryResult::countryCode() const 0072 { 0073 return d->countryCode; 0074 } 0075 const QString &LocationQueryResult::countryName() const 0076 { 0077 return d->countryName; 0078 } 0079 const QString &LocationQueryResult::geonameId() const 0080 { 0081 return d->geonameId; 0082 } 0083 const std::optional<QString> &LocationQueryResult::subdivision() const 0084 { 0085 return d->subdivision; 0086 } 0087 } 0088 0089 #include "moc_locationqueryresult.cpp"