File indexing completed on 2024-05-12 03:50:18

0001 // SPDX-License-Identifier: LGPL-2.1-or-later
0002 //
0003 // SPDX-FileCopyrightText: 2014 Abhinav Gangwar <abhgang@gmail.com>
0004 //
0005 
0006 #include "GeoDataSimpleData.h"
0007 
0008 // Marble
0009 #include "GeoDataTypes.h"
0010 
0011 namespace Marble
0012 {
0013 
0014 class GeoDataSimpleDataPrivate
0015 {
0016 public:
0017     QString m_name;
0018     QString m_data;
0019 };
0020 
0021 GeoDataSimpleData::GeoDataSimpleData()
0022     : d( new GeoDataSimpleDataPrivate )
0023 {
0024 }
0025 
0026 GeoDataSimpleData::GeoDataSimpleData( const GeoDataSimpleData &other )
0027     : d( new GeoDataSimpleDataPrivate( *other.d ) )
0028 {
0029 }
0030 
0031 GeoDataSimpleData::~GeoDataSimpleData()
0032 {
0033     delete d;
0034 }
0035 
0036 QString GeoDataSimpleData::name() const
0037 {
0038     return d->m_name;
0039 }
0040 
0041 void GeoDataSimpleData::setName( const QString &name )
0042 {
0043     d->m_name = name;
0044 }
0045 
0046 QString GeoDataSimpleData::data() const
0047 {
0048     return d->m_data;
0049 }
0050 
0051 void GeoDataSimpleData::setData( const QString &data )
0052 {
0053     d->m_data = data;
0054 }
0055 
0056 GeoDataSimpleData &GeoDataSimpleData::operator=( const GeoDataSimpleData &rhs )
0057 {
0058     *d = *rhs.d;
0059     return *this;
0060 }
0061 
0062 bool GeoDataSimpleData::operator==( const GeoDataSimpleData &other ) const
0063 {
0064     return d->m_name == other.d->m_name &&
0065            d->m_data == other.d->m_data;
0066 }
0067 
0068 bool GeoDataSimpleData::operator!=( const GeoDataSimpleData &other ) const
0069 {
0070     return !this->operator==( other );
0071 }
0072 
0073 const char* GeoDataSimpleData::nodeType() const
0074 {
0075     return GeoDataTypes::GeoDataSimpleDataType;
0076 }
0077 
0078 void GeoDataSimpleData::pack( QDataStream &stream ) const
0079 {
0080     stream << d->m_name;
0081     stream << d->m_data;
0082 }
0083 
0084 void GeoDataSimpleData::unpack( QDataStream &stream )
0085 {
0086     stream >> d->m_name;
0087     stream >> d->m_data;
0088 }
0089 
0090 }