kabc
23 #include <QtCore/QDataStream>
24 #include <QtCore/QSharedData>
28 class Geo::Private :
public QSharedData
32 : mLatitude( 91 ), mLongitude( 181 ),
33 mValidLatitude( false ), mValidLongitude( false )
37 Private(
const Private &other )
38 : QSharedData( other )
40 mLatitude = other.mLatitude;
41 mLongitude = other.mLongitude;
42 mValid = other.mValid;
43 mValidLatitude = other.mValidLatitude;
44 mValidLongitude = other.mValidLongitude;
78 if ( latitude >= -90 && latitude <= 90 ) {
80 d->mValidLatitude =
true;
83 d->mValidLatitude =
false;
94 if ( longitude >= -180 && longitude <= 180 ) {
96 d->mValidLongitude =
true;
99 d->mValidLongitude =
false;
105 return d->mLongitude;
110 return d->mValidLatitude && d->mValidLongitude;
123 if ( other.d->mLatitude == d->mLatitude && other.d->mLongitude == d->mLongitude ) {
132 return !( *
this == other );
137 if (
this != &other ) {
148 str += QLatin1String(
"Geo {\n" );
149 str += QString::fromLatin1(
" Valid: %1\n" ).
150 arg(
isValid() ? QLatin1String(
"true" ) : QLatin1String(
"false" ) );
151 str += QString::fromLatin1(
" Latitude: %1\n" ).arg( d->mLatitude );
152 str += QString::fromLatin1(
" Longitude: %1\n" ).arg( d->mLongitude );
153 str += QLatin1String(
"}\n" );
158 QDataStream &KABC::operator<<( QDataStream &s,
const Geo &geo )
160 return s << geo.d->mLatitude << geo.d->mValidLatitude
161 << geo.d->mLongitude << geo.d->mValidLongitude;
164 QDataStream &KABC::operator>>( QDataStream &s,
Geo &geo )
166 s >> geo.d->mLatitude >> geo.d->mValidLatitude
167 >> geo.d->mLongitude >> geo.d->mValidLongitude;
This file is part of the KDE documentation.
Documentation copyright © 1996-2013 The KDE developers.
Generated on Sat Jan 5 2013 19:47:45 by
doxygen 1.8.1.2 written
by
Dimitri van Heesch, © 1997-2006
KDE's Doxygen guidelines are available online.