File indexing completed on 2025-01-05 03:59:01
0001 // SPDX-License-Identifier: LGPL-2.1-or-later 0002 // 0003 // SPDX-FileCopyrightText: 2010 Harshit Jain <hjain.itbhu@gmail.com> 0004 // 0005 0006 // Own 0007 #include "GeoDataTimeStamp.h" 0008 0009 // Private 0010 #include "GeoDataTimeStamp_p.h" 0011 0012 // Qt 0013 #include <QDataStream> 0014 0015 // GeoData 0016 #include "GeoDataTypes.h" 0017 0018 namespace Marble 0019 { 0020 0021 GeoDataTimeStamp::GeoDataTimeStamp() 0022 : GeoDataTimePrimitive(), d( new GeoDataTimeStampPrivate ) 0023 { 0024 } 0025 0026 GeoDataTimeStamp::GeoDataTimeStamp( const GeoDataTimeStamp& other ) 0027 : GeoDataTimePrimitive( other ) , d( new GeoDataTimeStampPrivate( *other.d ) ) 0028 { 0029 } 0030 0031 GeoDataTimeStamp::~GeoDataTimeStamp() 0032 { 0033 delete d; 0034 } 0035 0036 GeoDataTimeStamp& GeoDataTimeStamp::operator=( const GeoDataTimeStamp& other ) 0037 { 0038 GeoDataTimePrimitive::operator=( other ); 0039 *d = *other.d; 0040 return *this; 0041 } 0042 0043 bool GeoDataTimeStamp::operator==( const GeoDataTimeStamp& other ) const 0044 { 0045 return equals(other) && 0046 d->m_resolution == other.d->m_resolution && 0047 d->m_when == other.d->m_when; 0048 } 0049 0050 bool GeoDataTimeStamp::operator!=( const GeoDataTimeStamp& other ) const 0051 { 0052 return !this->operator==( other ); 0053 } 0054 0055 0056 const char* GeoDataTimeStamp::nodeType() const 0057 { 0058 return GeoDataTypes::GeoDataTimeStampType; 0059 } 0060 0061 QDateTime GeoDataTimeStamp::when() const 0062 { 0063 return d->m_when; 0064 } 0065 0066 void GeoDataTimeStamp::setWhen( const QDateTime& when ) 0067 { 0068 d->m_when = when; 0069 } 0070 0071 void GeoDataTimeStamp::setResolution( GeoDataTimeStamp::TimeResolution resolution ) 0072 { 0073 d->m_resolution = resolution; 0074 } 0075 0076 GeoDataTimeStamp::TimeResolution GeoDataTimeStamp::resolution() const 0077 { 0078 return d->m_resolution; 0079 } 0080 0081 void GeoDataTimeStamp::pack( QDataStream& stream ) const 0082 { 0083 GeoDataTimePrimitive::pack( stream ); 0084 0085 stream << d->m_when; 0086 } 0087 0088 void GeoDataTimeStamp::unpack( QDataStream& stream ) 0089 { 0090 GeoDataTimePrimitive::unpack( stream ); 0091 0092 stream >> d->m_when; 0093 } 0094 0095 }