# kabc Library API Documentation

Overview | Class Hierarchy | Classes | Classes (annotated) | Members | Namespaces | Source Files

# GeoValue.cpp

    00001 /*
    00002     This file is part of libvcard.
    00003     Copyright (c) 2002 Tobias Koenig <tokoe@kde.org>
    00004
    00005     This library is free software; you can redistribute it and/or
    00006     modify it under the terms of the GNU Library General Public
    00007     License as published by the Free Software Foundation; either
    00008     version 2 of the License, or (at your option) any later version.
    00009
    00010     This library is distributed in the hope that it will be useful,
    00011     but WITHOUT ANY WARRANTY; without even the implied warranty of
    00012     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
    00013     Library General Public License for more details.
    00014
    00015     You should have received a copy of the GNU Library General Public License
    00016     along with this library; see the file COPYING.LIB.  If not, write to
    00017     the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
    00018     Boston, MA 02111-1307, USA.
    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 ) // invalid
    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 kabc Library Version 3.4.1.
Documentation copyright © 1996-2004 the KDE developers.
Generated on Sat Jun 11 20:31:30 2005 by doxygen 1.4.1 written by Dimitri van Heesch, © 1997-2003