Marble

GeoDataData.cpp
1// SPDX-License-Identifier: LGPL-2.1-or-later
2//
3// SPDX-FileCopyrightText: 2010 Harshit Jain <hjain.itbhu@gmail.com>
4//
5
6#include "GeoDataData.h"
7#include "GeoDataData_p.h"
8
9#include <QDataStream>
10
11#include "GeoDataTypes.h"
12
13namespace Marble
14{
15
16GeoDataData::GeoDataData()
17 : GeoDataObject()
18 , d(new GeoDataDataPrivate)
19{
20}
21
22GeoDataData::GeoDataData(const GeoDataData &other)
23 : GeoDataObject(other)
24 , d(new GeoDataDataPrivate(*other.d))
25{
26}
27
28GeoDataData::~GeoDataData()
29{
30 delete d;
31}
32
33GeoDataData &GeoDataData::operator=(const GeoDataData &other)
34{
35 GeoDataObject::operator=(other);
36 *d = *other.d;
37 return *this;
38}
39
40bool GeoDataData::operator==(const GeoDataData &other) const
41{
42 return equals(other) && d->m_name == other.d->m_name && d->m_value == other.d->m_value && d->m_displayName == other.d->m_displayName;
43}
44
45bool GeoDataData::operator!=(const GeoDataData &other) const
46{
47 return !this->operator==(other);
48}
49
50GeoDataData::GeoDataData(const QString &name, const QVariant &value)
51 : d(new GeoDataDataPrivate)
52{
53 d->m_name = name;
54 d->m_value = value;
55}
56
57const char *GeoDataData::nodeType() const
58{
59 return GeoDataTypes::GeoDataDataType;
60}
61
62QVariant GeoDataData::value() const
63{
64 return d->m_value;
65}
66
67QVariant &GeoDataData::valueRef()
68{
69 return d->m_value;
70}
71
72const QVariant &GeoDataData::valueRef() const
73{
74 return d->m_value;
75}
76
77void GeoDataData::setValue(const QVariant &value)
78{
79 d->m_value = value;
80}
81
82QString GeoDataData::name() const
83{
84 return d->m_name;
85}
86
87void GeoDataData::setName(const QString &name)
88{
89 d->m_name = name;
90}
91
92QString GeoDataData::displayName() const
93{
94 return d->m_displayName;
95}
96
97void GeoDataData::setDisplayName(const QString &displayName)
98{
99 d->m_displayName = displayName;
100}
101
102void GeoDataData::pack(QDataStream &stream) const
103{
104 GeoDataObject::pack(stream);
105
106 stream << d->m_value;
107 stream << d->m_displayName;
108}
109
110void GeoDataData::unpack(QDataStream &stream)
111{
112 GeoDataObject::unpack(stream);
113
114 stream >> d->m_value;
115 stream >> d->m_displayName;
116}
117
118}
AKONADI_CALENDAR_EXPORT QString displayName(Akonadi::ETMCalendar *calendar, const Akonadi::Collection &collection)
QString name(StandardAction id)
bool equals(const QVariant &lhs, const QVariant &rhs)
bool operator==(const StyleDelim &l, const StyleDelim &r)
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 Sat Dec 21 2024 17:04:13 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.