Marble

GeoDataUpdate.cpp
1// SPDX-License-Identifier: LGPL-2.1-or-later
2//
3// SPDX-FileCopyrightText: 2013 Mohammed Nafees <nafees.technocool@gmail.com>
4//
5
6#include "GeoDataUpdate.h"
7
8#include "GeoDataChange.h"
9#include "GeoDataCreate.h"
10#include "GeoDataDelete.h"
11#include "GeoDataTypes.h"
12
13#include <QString>
14
15namespace Marble
16{
17
18class GeoDataUpdatePrivate
19{
20public:
21 GeoDataUpdatePrivate();
22 GeoDataCreate *m_create;
23 GeoDataDelete *m_delete;
24 GeoDataChange *m_change;
25 QString m_targetHref;
26};
27
28GeoDataUpdatePrivate::GeoDataUpdatePrivate()
29 : m_create(nullptr)
30 , m_delete(nullptr)
31 , m_change(nullptr)
32{
33}
34
35GeoDataUpdate::GeoDataUpdate()
36 : d(new GeoDataUpdatePrivate)
37{
38}
39
40GeoDataUpdate::GeoDataUpdate(const Marble::GeoDataUpdate &other)
41 : GeoDataObject()
42 , d(new GeoDataUpdatePrivate(*other.d))
43{
44}
45
46GeoDataUpdate &GeoDataUpdate::operator=(const GeoDataUpdate &other)
47{
48 GeoDataObject::operator=(other);
49 *d = *other.d;
50 return *this;
51}
52
53bool GeoDataUpdate::operator==(const GeoDataUpdate &other) const
54{
55 bool const changeEmpty = !d->m_change || d->m_change->size() == 0;
56 bool const otherChangeEmpty = !other.d->m_change || other.d->m_change->size() == 0;
57
58 if (changeEmpty != otherChangeEmpty) {
59 return false;
60 } else if (d->m_change && other.d->m_change && *d->m_change != *other.d->m_change) {
61 return false;
62 }
63
64 return d->m_targetHref == other.d->m_targetHref;
65}
66
67bool GeoDataUpdate::operator!=(const GeoDataUpdate &other) const
68{
69 return !this->operator==(other);
70}
71
72GeoDataUpdate::~GeoDataUpdate()
73{
74 delete d;
75}
76
77const char *GeoDataUpdate::nodeType() const
78{
79 return GeoDataTypes::GeoDataUpdateType;
80}
81
82QString GeoDataUpdate::targetHref() const
83{
84 return d->m_targetHref;
85}
86
87void GeoDataUpdate::setTargetHref(const QString &targetHref)
88{
89 d->m_targetHref = targetHref;
90}
91
92const GeoDataChange *GeoDataUpdate::change() const
93{
94 return d->m_change;
95}
96
97GeoDataChange *GeoDataUpdate::change()
98{
99 return d->m_change;
100}
101
102void GeoDataUpdate::setChange(GeoDataChange *change)
103{
104 delete d->m_change;
105 d->m_change = change;
106 if (d->m_change) {
107 d->m_change->setParent(this);
108 }
109}
110
111const GeoDataCreate *GeoDataUpdate::create() const
112{
113 return d->m_create;
114}
115
116GeoDataCreate *GeoDataUpdate::create()
117{
118 return d->m_create;
119}
120
121void GeoDataUpdate::setCreate(GeoDataCreate *create)
122{
123 delete d->m_create;
124 d->m_create = create;
125 if (d->m_create) {
126 d->m_create->setParent(this);
127 }
128}
129
130const GeoDataDelete *GeoDataUpdate::getDelete() const
131{
132 return d->m_delete;
133}
134
135GeoDataDelete *GeoDataUpdate::getDelete()
136{
137 return d->m_delete;
138}
139
140void GeoDataUpdate::setDelete(GeoDataDelete *dataDelete)
141{
142 delete d->m_delete;
143 d->m_delete = dataDelete;
144 if (d->m_delete) {
145 d->m_delete->setParent(this);
146 }
147}
148
149}
QAction * create(GameStandardAction id, const QObject *recvr, const char *slot, QObject *parent)
KIOCORE_EXPORT bool operator==(const UDSEntry &entry, const UDSEntry &other)
Binds a QML item to a specific geodetic location in screen coordinates.
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Mon Nov 4 2024 16:37:03 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.