KPkPass

location.cpp
1 /*
2  SPDX-FileCopyrightText: 2018 Volker Krause <[email protected]>
3 
4  SPDX-License-Identifier: LGPL-2.0-or-later
5 */
6 
7 #include "location.h"
8 
9 #include <QJsonObject>
10 
11 #include <cmath>
12 
13 using namespace KPkPass;
14 
15 namespace KPkPass
16 {
17 class LocationPrivate
18 {
19 public:
20  QJsonObject obj;
21 };
22 }
23 
24 Location::Location()
25  : d(new LocationPrivate)
26 {
27 }
28 
29 Location::Location(const QJsonObject &obj)
30  : d(new LocationPrivate)
31 {
32  d->obj = obj;
33 }
34 
35 Location::~Location() = default;
36 
37 double Location::altitude() const
38 {
39  return d->obj.value(QLatin1String("altitude")).toDouble(NAN);
40 }
41 
42 double Location::latitude() const
43 {
44  return d->obj.value(QLatin1String("latitude")).toDouble(NAN);
45 }
46 
47 double Location::longitude() const
48 {
49  return d->obj.value(QLatin1String("longitude")).toDouble(NAN);
50 }
51 
52 QString Location::relevantText() const
53 {
54  return d->obj.value(QLatin1String("relevantText")).toString();
55 }
56 
57 #include "moc_location.cpp"
This file is part of the KDE documentation.
Documentation copyright © 1996-2023 The KDE developers.
Generated on Sat Sep 30 2023 03:55:45 by doxygen 1.8.17 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.