KWeatherCore

locationqueryresult.cpp
1/*
2 * SPDX-FileCopyrightText: 2020-2021 Han Young <hanyoung@protonmail.com>
3 * SPDX-FileCopyrightText: 2020 Devin Lin <espidev@gmail.com>
4 *
5 * SPDX-License-Identifier: LGPL-2.0-or-later
6 */
7#include "locationqueryresult.h"
8#include <memory>
9#include <optional>
10namespace KWeatherCore
11{
12class LocationQueryResult::LocationQueryResultPrivate
13{
14public:
15 double latitude, longitude;
16 QString toponymName, name, countryCode, countryName, geonameId;
17 std::optional<QString> subdivision;
18};
19LocationQueryResult::LocationQueryResult()
20 : d(std::make_unique<LocationQueryResultPrivate>())
21{
22}
23LocationQueryResult::LocationQueryResult(LocationQueryResult &&other) = default;
24LocationQueryResult::LocationQueryResult(double latitude,
25 double longitude,
26 QString toponymName,
27 QString name,
28 QString countryCode,
29 QString countryName,
30 QString geonameId,
31 std::optional<QString> subdivision)
32 : d(std::make_unique<LocationQueryResultPrivate>())
33{
34 d->latitude = latitude;
35 d->longitude = longitude;
36 d->toponymName = std::move(toponymName);
37 d->name = std::move(name);
38 d->countryCode = std::move(countryCode);
39 d->countryName = std::move(countryName);
40 d->geonameId = std::move(geonameId);
41 d->subdivision = std::move(subdivision);
42}
43LocationQueryResult::LocationQueryResult(const LocationQueryResult &other)
44 : d(std::make_unique<LocationQueryResultPrivate>())
45{
46 *d = *other.d;
47}
48LocationQueryResult::~LocationQueryResult() = default;
49LocationQueryResult &LocationQueryResult::operator=(const LocationQueryResult &other)
50{
51 *d = *other.d;
52 return *this;
53}
54LocationQueryResult &LocationQueryResult::operator=(LocationQueryResult &&other) = default;
55double LocationQueryResult::latitude() const
56{
57 return d->latitude;
58}
59double LocationQueryResult::longitude() const
60{
61 return d->longitude;
62}
63const QString &LocationQueryResult::toponymName() const
64{
65 return d->toponymName;
66}
67const QString &LocationQueryResult::name() const
68{
69 return d->name;
70}
71const QString &LocationQueryResult::countryCode() const
72{
73 return d->countryCode;
74}
75const QString &LocationQueryResult::countryName() const
76{
77 return d->countryName;
78}
79const QString &LocationQueryResult::geonameId() const
80{
81 return d->geonameId;
82}
83const std::optional<QString> &LocationQueryResult::subdivision() const
84{
85 return d->subdivision;
86}
87}
88
89#include "moc_locationqueryresult.cpp"
Class represents location query result.
const std::optional< QString > & subdivision() const
Country subdivision such as state, province, etc.
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Tue Mar 26 2024 11:20:42 by doxygen 1.10.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.