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 mValidLatitude = other.mValidLatitude;
43 mValidLongitude = other.mValidLongitude;
76 if ( latitude >= -90 && latitude <= 90 ) {
78 d->mValidLatitude =
true;
81 d->mValidLatitude =
false;
92 if ( longitude >= -180 && longitude <= 180 ) {
94 d->mValidLongitude =
true;
97 d->mValidLongitude =
false;
103 return d->mLongitude;
108 return d->mValidLatitude && d->mValidLongitude;
121 if ( other.d->mLatitude == d->mLatitude && other.d->mLongitude == d->mLongitude ) {
130 return !( *
this == other );
135 if (
this != &other ) {
146 str += QLatin1String(
"Geo {\n" );
147 str += QString::fromLatin1(
" Valid: %1\n" ).
148 arg(
isValid() ? QLatin1String(
"true" ) : QLatin1String(
"false" ) );
149 str += QString::fromLatin1(
" Latitude: %1\n" ).arg( d->mLatitude );
150 str += QString::fromLatin1(
" Longitude: %1\n" ).arg( d->mLongitude );
151 str += QLatin1String(
"}\n" );
156 QDataStream &KABC::operator<<( QDataStream &s,
const Geo &geo )
158 return s << geo.d->mLatitude << geo.d->mValidLatitude
159 << geo.d->mLongitude << geo.d->mValidLongitude;
162 QDataStream &KABC::operator>>( QDataStream &s,
Geo &geo )
164 s >> geo.d->mLatitude >> geo.d->mValidLatitude
165 >> geo.d->mLongitude >> geo.d->mValidLongitude;
This file is part of the KDE documentation.
Documentation copyright © 1996-2013 The KDE developers.
Generated on Sat Jul 13 2013 01:29:40 by
doxygen 1.8.3.1 written
by
Dimitri van Heesch, © 1997-2006
KDE's Doxygen guidelines are available online.