• Skip to content
  • Skip to link menu
Trinity API Reference
  • Trinity API Reference
  • tdeabc
 

tdeabc

  • tdeabc
  • vcard
GeoValue.cpp
1/*
2 This file is part of libvcard.
3 Copyright (c) 2002 Tobias Koenig <tokoe@kde.org>
4
5 This library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Library General Public
7 License as published by the Free Software Foundation; either
8 version 2 of the License, or (at your option) any later version.
9
10 This library is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Library General Public License for more details.
14
15 You should have received a copy of the GNU Library General Public License
16 along with this library; see the file COPYING.LIB. If not, write to
17 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
18 Boston, MA 02110-1301, USA.
19*/
20
21#include <VCardGeoValue.h>
22
23#include <VCardValue.h>
24
25#include <kdebug.h>
26
27using namespace VCARD;
28
29GeoValue::GeoValue()
30 : Value()
31{
32}
33
34GeoValue::GeoValue(const GeoValue & x)
35 : Value(x), latitude_(x.latitude_), longitude_(x.longitude_)
36{
37}
38
39GeoValue::GeoValue(const TQCString & s)
40 : Value(s)
41{
42}
43
44 GeoValue &
45GeoValue::operator = (GeoValue & x)
46{
47 if (*this == x) return *this;
48
49 latitude_ = x.latitude_;
50 longitude_ = x.longitude_;
51
52 Value::operator = (x);
53 return *this;
54}
55
56 GeoValue &
57GeoValue::operator = (const TQCString & s)
58{
59 Value::operator = (s);
60 return *this;
61}
62
63 bool
64GeoValue::operator == (GeoValue & x)
65{
66 x.parse();
67
68 if ( latitude_ != x.latitude_ ) return false;
69 if ( longitude_ != x.longitude_ ) return false;
70
71 return true;
72}
73
74GeoValue::~GeoValue()
75{
76}
77
78 GeoValue *
79GeoValue::clone()
80{
81 return new GeoValue( *this );
82}
83
84 void
85GeoValue::_parse()
86{
87 int semiColon = strRep_.find( ";" );
88
89 if ( semiColon == -1 ) // invalid
90 return;
91
92 latitude_ = strRep_.left( semiColon ).toFloat();
93 longitude_ = strRep_.mid( semiColon + 1, strRep_.length() - semiColon ).toFloat();
94}
95
96 void
97GeoValue::_assemble()
98{
99 strRep_.sprintf( "%.6f;%.6f", latitude_, longitude_ );
100}

tdeabc

Skip menu "tdeabc"
  • Main Page
  • Namespace List
  • Class Hierarchy
  • Alphabetical List
  • Class List
  • File List
  • Namespace Members
  • Class Members
  • Related Pages

tdeabc

Skip menu "tdeabc"
  • arts
  • dcop
  • dnssd
  • interfaces
  •   kspeech
  •     interface
  •     library
  •   tdetexteditor
  • kate
  • kded
  • kdoctools
  • kimgio
  • kjs
  • libtdemid
  • libtdescreensaver
  • tdeabc
  • tdecmshell
  • tdecore
  • tdefx
  • tdehtml
  • tdeinit
  • tdeio
  •   bookmarks
  •   httpfilter
  •   kpasswdserver
  •   kssl
  •   tdefile
  •   tdeio
  •   tdeioexec
  • tdeioslave
  •   http
  • tdemdi
  •   tdemdi
  • tdenewstuff
  • tdeparts
  • tdeprint
  • tderandr
  • tderesources
  • tdespell2
  • tdesu
  • tdeui
  • tdeunittest
  • tdeutils
  • tdewallet
Generated for tdeabc by doxygen 1.9.4
This website is maintained by Timothy Pearson.