Marble

GeoDataSimpleField.cpp
1// SPDX-License-Identifier: LGPL-2.1-or-later
2//
3// SPDX-FileCopyrightText: 2014 Abhinav Gangwar <abhgang@gmail.com>
4//
5
6#include "GeoDataSimpleField.h"
7
8// Qt
9#include <QDataStream>
10#include <QString>
11
12// Marble
13#include "GeoDataTypes.h"
14
15namespace Marble
16{
17
18class GeoDataSimpleFieldPrivate
19{
20public:
21 QString m_name;
22 GeoDataSimpleField::SimpleFieldType m_type;
23 QString m_displayName;
24};
25
26GeoDataSimpleField::GeoDataSimpleField()
27 : GeoNode()
28 , d(new GeoDataSimpleFieldPrivate)
29{
30}
31
32GeoDataSimpleField::GeoDataSimpleField(const GeoDataSimpleField &other)
33 : GeoNode()
34 , d(new GeoDataSimpleFieldPrivate(*other.d))
35{
36}
37
38bool GeoDataSimpleField::operator==(const GeoDataSimpleField &other) const
39{
40 return d->m_name == other.d->m_name && d->m_type == other.d->m_type && d->m_displayName == other.d->m_displayName;
41}
42
43bool GeoDataSimpleField::operator!=(const GeoDataSimpleField &other) const
44{
45 return !this->operator==(other);
46}
47
48GeoDataSimpleField::~GeoDataSimpleField()
49{
50 delete d;
51}
52
53GeoDataSimpleField::SimpleFieldType GeoDataSimpleField::type() const
54{
55 return d->m_type;
56}
57
58void GeoDataSimpleField::setType(SimpleFieldType type)
59{
60 d->m_type = type;
61}
62
63QString GeoDataSimpleField::name() const
64{
65 return d->m_name;
66}
67
68void GeoDataSimpleField::setName(const QString &value)
69{
70 d->m_name = value;
71}
72
73QString GeoDataSimpleField::displayName() const
74{
75 return d->m_displayName;
76}
77
78void GeoDataSimpleField::setDisplayName(const QString &displayName)
79{
80 d->m_displayName = displayName;
81}
82
83GeoDataSimpleField &GeoDataSimpleField::operator=(const GeoDataSimpleField &other)
84{
85 *d = *other.d;
86 return *this;
87}
88
89const char *GeoDataSimpleField::nodeType() const
90{
91 return GeoDataTypes::GeoDataSimpleFieldType;
92}
93
94void GeoDataSimpleField::pack(QDataStream &stream) const
95{
96 stream << d->m_name;
97 stream << d->m_displayName;
98}
99
100void GeoDataSimpleField::unpack(QDataStream &stream)
101{
102 stream >> d->m_name;
103 stream >> d->m_displayName;
104}
105
106}
AKONADI_CALENDAR_EXPORT QString displayName(Akonadi::ETMCalendar *calendar, const Akonadi::Collection &collection)
KIOCORE_EXPORT bool operator==(const UDSEntry &entry, const UDSEntry &other)
VehicleSection::Type type(QStringView coachNumber, QStringView coachClassification)
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.