File indexing completed on 2025-01-05 03:59:00
0001 // SPDX-License-Identifier: LGPL-2.1-or-later 0002 // 0003 // SPDX-FileCopyrightText: 2014 Abhinav Gangwar <abhgang@gmail.com> 0004 // 0005 0006 #include "GeoDataSimpleField.h" 0007 0008 // Qt 0009 #include <QDataStream> 0010 #include <QString> 0011 0012 // Marble 0013 #include "GeoDataTypes.h" 0014 0015 0016 namespace Marble 0017 { 0018 0019 class GeoDataSimpleFieldPrivate 0020 { 0021 public: 0022 QString m_name; 0023 GeoDataSimpleField::SimpleFieldType m_type; 0024 QString m_displayName; 0025 }; 0026 0027 GeoDataSimpleField::GeoDataSimpleField() 0028 : GeoNode(), 0029 d( new GeoDataSimpleFieldPrivate ) 0030 { 0031 } 0032 0033 GeoDataSimpleField::GeoDataSimpleField( const GeoDataSimpleField& other ) 0034 : GeoNode(), 0035 d( new GeoDataSimpleFieldPrivate( *other.d ) ) 0036 { 0037 } 0038 0039 bool GeoDataSimpleField::operator==(const GeoDataSimpleField& other) const 0040 { 0041 return d->m_name == other.d->m_name && 0042 d->m_type == other.d->m_type && 0043 d->m_displayName == other.d->m_displayName; 0044 } 0045 0046 bool GeoDataSimpleField::operator!=(const GeoDataSimpleField& other) const 0047 { 0048 return !this->operator==( other ); 0049 } 0050 0051 GeoDataSimpleField::~GeoDataSimpleField() 0052 { 0053 delete d; 0054 } 0055 0056 GeoDataSimpleField::SimpleFieldType GeoDataSimpleField::type() const 0057 { 0058 return d->m_type; 0059 } 0060 0061 void GeoDataSimpleField::setType(SimpleFieldType type) 0062 { 0063 d->m_type = type; 0064 } 0065 0066 QString GeoDataSimpleField::name() const 0067 { 0068 return d->m_name; 0069 } 0070 0071 void GeoDataSimpleField::setName( const QString& value ) 0072 { 0073 d->m_name = value; 0074 } 0075 0076 QString GeoDataSimpleField::displayName() const 0077 { 0078 return d->m_displayName; 0079 } 0080 0081 void GeoDataSimpleField::setDisplayName( const QString& displayName ) 0082 { 0083 d->m_displayName = displayName; 0084 } 0085 0086 GeoDataSimpleField& GeoDataSimpleField::operator=( const GeoDataSimpleField& other ) 0087 { 0088 *d = *other.d; 0089 return *this; 0090 } 0091 0092 const char* GeoDataSimpleField::nodeType() const 0093 { 0094 return GeoDataTypes::GeoDataSimpleFieldType; 0095 } 0096 0097 void GeoDataSimpleField::pack( QDataStream& stream ) const 0098 { 0099 stream << d->m_name; 0100 stream << d->m_displayName; 0101 } 0102 0103 void GeoDataSimpleField::unpack( QDataStream& stream ) 0104 { 0105 stream >> d->m_name; 0106 stream >> d->m_displayName; 0107 } 0108 0109 0110 }