GeoValue.cpp
00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021 #include <VCardGeoValue.h>
00022
00023 #include <VCardValue.h>
00024
00025 #include <kdebug.h>
00026
00027 using namespace VCARD;
00028
00029 GeoValue::GeoValue()
00030 : Value()
00031 {
00032 }
00033
00034 GeoValue::GeoValue(const GeoValue & x)
00035 : Value(x), latitude_(x.latitude_), longitude_(x.longitude_)
00036 {
00037 }
00038
00039 GeoValue::GeoValue(const QCString & s)
00040 : Value(s)
00041 {
00042 }
00043
00044 GeoValue &
00045 GeoValue::operator = (GeoValue & x)
00046 {
00047 if (*this == x) return *this;
00048
00049 latitude_ = x.latitude_;
00050 longitude_ = x.longitude_;
00051
00052 Value::operator = (x);
00053 return *this;
00054 }
00055
00056 GeoValue &
00057 GeoValue::operator = (const QCString & s)
00058 {
00059 Value::operator = (s);
00060 return *this;
00061 }
00062
00063 bool
00064 GeoValue::operator == (GeoValue & x)
00065 {
00066 x.parse();
00067
00068 if ( latitude_ != x.latitude_ ) return false;
00069 if ( longitude_ != x.longitude_ ) return false;
00070
00071 return true;
00072 }
00073
00074 GeoValue::~GeoValue()
00075 {
00076 }
00077
00078 GeoValue *
00079 GeoValue::clone()
00080 {
00081 return new GeoValue( *this );
00082 }
00083
00084 void
00085 GeoValue::_parse()
00086 {
00087 int semiColon = strRep_.find( ";" );
00088
00089 if ( semiColon == -1 )
00090 return;
00091
00092 latitude_ = strRep_.left( semiColon ).toFloat();
00093 longitude_ = strRep_.mid( semiColon + 1, strRep_.length() - semiColon ).toFloat();
00094 }
00095
00096 void
00097 GeoValue::_assemble()
00098 {
00099 strRep_.sprintf( "%.6f;%.6f", latitude_, longitude_ );
00100 }
This file is part of the documentation for kdelibs Version 3.1.5.