File indexing completed on 2025-01-05 03:58:54
0001 // SPDX-License-Identifier: LGPL-2.1-or-later 0002 // 0003 // SPDX-FileCopyrightText: 2010 Harshit Jain <hjain.itbhu@gmail.com> 0004 // 0005 0006 #include "GeoDataData.h" 0007 #include "GeoDataData_p.h" 0008 0009 #include <QDataStream> 0010 0011 #include "GeoDataTypes.h" 0012 //#include "OsmPlacemarkData.h" 0013 0014 namespace Marble 0015 { 0016 0017 GeoDataData::GeoDataData() 0018 : GeoDataObject(), d( new GeoDataDataPrivate ) 0019 { 0020 } 0021 0022 GeoDataData::GeoDataData( const GeoDataData& other ) 0023 : GeoDataObject( other ), d( new GeoDataDataPrivate( *other.d ) ) 0024 { 0025 } 0026 0027 GeoDataData::~GeoDataData() 0028 { 0029 delete d; 0030 } 0031 0032 GeoDataData& GeoDataData::operator=( const GeoDataData& other ) 0033 { 0034 GeoDataObject::operator=( other ); 0035 *d = *other.d; 0036 return *this; 0037 } 0038 0039 bool GeoDataData::operator==( const GeoDataData& other) const 0040 { 0041 return equals(other) && 0042 d->m_name == other.d->m_name && 0043 d->m_value == other.d->m_value && 0044 d->m_displayName == other.d->m_displayName; 0045 } 0046 0047 bool GeoDataData::operator!=( const GeoDataData &other ) const 0048 { 0049 return !this->operator==(other); 0050 } 0051 0052 GeoDataData::GeoDataData( const QString &name, const QVariant &value ) 0053 : d( new GeoDataDataPrivate ) 0054 { 0055 d->m_name = name; 0056 d->m_value = value; 0057 } 0058 0059 const char* GeoDataData::nodeType() const 0060 { 0061 return GeoDataTypes::GeoDataDataType; 0062 } 0063 0064 QVariant GeoDataData::value() const 0065 { 0066 return d->m_value; 0067 } 0068 0069 QVariant& GeoDataData::valueRef() 0070 { 0071 return d->m_value; 0072 } 0073 0074 const QVariant& GeoDataData::valueRef() const 0075 { 0076 return d->m_value; 0077 } 0078 0079 void GeoDataData::setValue( const QVariant& value ) 0080 { 0081 d->m_value = value; 0082 } 0083 0084 QString GeoDataData::name() const 0085 { 0086 return d->m_name; 0087 } 0088 0089 void GeoDataData::setName( const QString& name ) 0090 { 0091 d->m_name = name; 0092 } 0093 0094 QString GeoDataData::displayName() const 0095 { 0096 return d->m_displayName; 0097 } 0098 0099 void GeoDataData::setDisplayName( const QString& displayName ) 0100 { 0101 d->m_displayName = displayName; 0102 } 0103 0104 void GeoDataData::pack( QDataStream& stream ) const 0105 { 0106 GeoDataObject::pack( stream ); 0107 0108 stream << d->m_value; 0109 stream << d->m_displayName; 0110 } 0111 0112 void GeoDataData::unpack( QDataStream& stream ) 0113 { 0114 GeoDataObject::unpack( stream ); 0115 0116 stream >> d->m_value; 0117 stream >> d->m_displayName; 0118 } 0119 0120 }