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