KPkPass

location.cpp
1/*
2 SPDX-FileCopyrightText: 2018 Volker Krause <vkrause@kde.org>
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
13using namespace KPkPass;
14
15namespace KPkPass
16{
17class LocationPrivate
18{
19public:
20 QJsonObject obj;
21};
22}
23
24Location::Location()
25 : d(new LocationPrivate)
26{
27}
28
29Location::Location(const QJsonObject &obj)
30 : d(new LocationPrivate)
31{
32 d->obj = obj;
33}
34
35Location::~Location() = default;
36
37double Location::altitude() const
38{
39 return d->obj.value(QLatin1StringView("altitude")).toDouble(NAN);
40}
41
42double Location::latitude() const
43{
44 return d->obj.value(QLatin1StringView("latitude")).toDouble(NAN);
45}
46
47double Location::longitude() const
48{
49 return d->obj.value(QLatin1StringView("longitude")).toDouble(NAN);
50}
51
52QString Location::relevantText() const
53{
54 return d->obj.value(QLatin1StringView("relevantText")).toString();
55}
56
57#include "moc_location.cpp"
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Mon Nov 4 2024 16:39:50 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.