-rw-r--r-- | kabc/vcard/AdrValue.cpp | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/kabc/vcard/AdrValue.cpp b/kabc/vcard/AdrValue.cpp index 7ecef33..51ca12a 100644 --- a/kabc/vcard/AdrValue.cpp +++ b/kabc/vcard/AdrValue.cpp | |||
@@ -1,140 +1,143 @@ | |||
1 | /* | 1 | /* |
2 | libvcard - vCard parsing library for vCard version 3.0 | 2 | libvcard - vCard parsing library for vCard version 3.0 |
3 | 3 | ||
4 | Copyright (C) 1998 Rik Hemsley rik@kde.org | 4 | Copyright (C) 1998 Rik Hemsley rik@kde.org |
5 | 5 | ||
6 | Permission is hereby granted, free of charge, to any person obtaining a copy | 6 | Permission is hereby granted, free of charge, to any person obtaining a copy |
7 | of this software and associated documentation files (the "Software"), to | 7 | of this software and associated documentation files (the "Software"), to |
8 | deal in the Software without restriction, including without limitation the | 8 | deal in the Software without restriction, including without limitation the |
9 | rights to use, copy, modify, merge, publish, distribute, sublicense, and/or | 9 | rights to use, copy, modify, merge, publish, distribute, sublicense, and/or |
10 | sell copies of the Software, and to permit persons to whom the Software is | 10 | sell copies of the Software, and to permit persons to whom the Software is |
11 | furnished to do so, subject to the following conditions: | 11 | furnished to do so, subject to the following conditions: |
12 | 12 | ||
13 | The above copyright notice and this permission notice shall be included in | 13 | The above copyright notice and this permission notice shall be included in |
14 | all copies or substantial portions of the Software. | 14 | all copies or substantial portions of the Software. |
15 | 15 | ||
16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | 17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
18 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | 18 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE |
19 | AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN | 19 | AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN |
20 | ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION | 20 | ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION |
21 | WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | 21 | WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
22 | */ | 22 | */ |
23 | 23 | ||
24 | #include <VCardRToken.h> | 24 | #include <VCardRToken.h> |
25 | #include <VCardAdrValue.h> | 25 | #include <VCardAdrValue.h> |
26 | #include <VCardValue.h> | 26 | #include <VCardValue.h> |
27 | #include <VCardDefines.h> | 27 | #include <VCardDefines.h> |
28 | //Added by qt3to4: | ||
29 | #include <Q3StrList> | ||
30 | #include <Q3CString> | ||
28 | 31 | ||
29 | using namespace VCARD; | 32 | using namespace VCARD; |
30 | 33 | ||
31 | AdrValue::AdrValue() | 34 | AdrValue::AdrValue() |
32 | :Value() | 35 | :Value() |
33 | { | 36 | { |
34 | } | 37 | } |
35 | 38 | ||
36 | AdrValue::AdrValue(const AdrValue & x) | 39 | AdrValue::AdrValue(const AdrValue & x) |
37 | :Value(x), | 40 | :Value(x), |
38 | poBox_ (x.poBox_), | 41 | poBox_ (x.poBox_), |
39 | extAddress_(x.extAddress_), | 42 | extAddress_(x.extAddress_), |
40 | street_ (x.street_), | 43 | street_ (x.street_), |
41 | locality_(x.locality_), | 44 | locality_(x.locality_), |
42 | region_ (x.region_), | 45 | region_ (x.region_), |
43 | postCode_(x.postCode_), | 46 | postCode_(x.postCode_), |
44 | countryName_(x.countryName_) | 47 | countryName_(x.countryName_) |
45 | { | 48 | { |
46 | } | 49 | } |
47 | 50 | ||
48 | AdrValue::AdrValue(const QCString & s) | 51 | AdrValue::AdrValue(const Q3CString & s) |
49 | :Value(s) | 52 | :Value(s) |
50 | { | 53 | { |
51 | } | 54 | } |
52 | 55 | ||
53 | AdrValue & | 56 | AdrValue & |
54 | AdrValue::operator = (AdrValue & x) | 57 | AdrValue::operator = (AdrValue & x) |
55 | { | 58 | { |
56 | if (*this == x) return *this; | 59 | if (*this == x) return *this; |
57 | 60 | ||
58 | poBox_ = x.poBox_; | 61 | poBox_ = x.poBox_; |
59 | extAddress_= x.extAddress_; | 62 | extAddress_= x.extAddress_; |
60 | street_ = x.street_; | 63 | street_ = x.street_; |
61 | locality_= x.locality_; | 64 | locality_= x.locality_; |
62 | region_ = x.region_; | 65 | region_ = x.region_; |
63 | postCode_= x.postCode_; | 66 | postCode_= x.postCode_; |
64 | countryName_= x.countryName_; | 67 | countryName_= x.countryName_; |
65 | 68 | ||
66 | Value::operator = (x); | 69 | Value::operator = (x); |
67 | return *this; | 70 | return *this; |
68 | } | 71 | } |
69 | 72 | ||
70 | AdrValue & | 73 | AdrValue & |
71 | AdrValue::operator = (const QCString & s) | 74 | AdrValue::operator = (const Q3CString & s) |
72 | { | 75 | { |
73 | Value::operator = (s); | 76 | Value::operator = (s); |
74 | return *this; | 77 | return *this; |
75 | } | 78 | } |
76 | 79 | ||
77 | bool | 80 | bool |
78 | AdrValue::operator == (AdrValue & x) | 81 | AdrValue::operator == (AdrValue & x) |
79 | { | 82 | { |
80 | parse(); | 83 | parse(); |
81 | x.parse(); | 84 | x.parse(); |
82 | 85 | ||
83 | return ( | 86 | return ( |
84 | poBox_ == x.poBox_ && | 87 | poBox_ == x.poBox_ && |
85 | extAddress_ == x.extAddress_&& | 88 | extAddress_ == x.extAddress_&& |
86 | street_ == x.street_ && | 89 | street_ == x.street_ && |
87 | locality_ == x.locality_ && | 90 | locality_ == x.locality_ && |
88 | region_ == x.region_ && | 91 | region_ == x.region_ && |
89 | postCode_ == x.postCode_ && | 92 | postCode_ == x.postCode_ && |
90 | countryName_== x.countryName_); | 93 | countryName_== x.countryName_); |
91 | } | 94 | } |
92 | 95 | ||
93 | AdrValue::~AdrValue() | 96 | AdrValue::~AdrValue() |
94 | { | 97 | { |
95 | } | 98 | } |
96 | 99 | ||
97 | AdrValue * | 100 | AdrValue * |
98 | AdrValue::clone() | 101 | AdrValue::clone() |
99 | { | 102 | { |
100 | return new AdrValue( *this ); | 103 | return new AdrValue( *this ); |
101 | } | 104 | } |
102 | 105 | ||
103 | void | 106 | void |
104 | AdrValue::_parse() | 107 | AdrValue::_parse() |
105 | { | 108 | { |
106 | vDebug("AdrValue::_parse()"); | 109 | vDebug("AdrValue::_parse()"); |
107 | 110 | ||
108 | QStrList l; | 111 | Q3StrList l; |
109 | RTokenise(strRep_, ";", l); | 112 | RTokenise(strRep_, ";", l); |
110 | 113 | ||
111 | for (unsigned int i = 0; i < l.count(); i++) { | 114 | for (unsigned int i = 0; i < l.count(); i++) { |
112 | 115 | ||
113 | switch (i) { | 116 | switch (i) { |
114 | 117 | ||
115 | case 0: poBox_ = l.at(0);break; | 118 | case 0: poBox_ = l.at(0);break; |
116 | case 1: extAddress_ = l.at(1);break; | 119 | case 1: extAddress_ = l.at(1);break; |
117 | case 2: street_ = l.at(2);break; | 120 | case 2: street_ = l.at(2);break; |
118 | case 3: locality_ = l.at(3);break; | 121 | case 3: locality_ = l.at(3);break; |
119 | case 4: region_ = l.at(4);break; | 122 | case 4: region_ = l.at(4);break; |
120 | case 5: postCode_ = l.at(5);break; | 123 | case 5: postCode_ = l.at(5);break; |
121 | case 6: countryName_ = l.at(6);break; | 124 | case 6: countryName_ = l.at(6);break; |
122 | default: break; | 125 | default: break; |
123 | } | 126 | } |
124 | } | 127 | } |
125 | } | 128 | } |
126 | 129 | ||
127 | void | 130 | void |
128 | AdrValue::_assemble() | 131 | AdrValue::_assemble() |
129 | { | 132 | { |
130 | vDebug("AdrValue::_assemble"); | 133 | vDebug("AdrValue::_assemble"); |
131 | 134 | ||
132 | strRep_ = poBox_; | 135 | strRep_ = poBox_; |
133 | strRep_ += ";" +extAddress_; | 136 | strRep_ += ";" +extAddress_; |
134 | strRep_ += ";" +street_; | 137 | strRep_ += ";" +street_; |
135 | strRep_ += ";" +locality_; | 138 | strRep_ += ";" +locality_; |
136 | strRep_ += ";" +region_; | 139 | strRep_ += ";" +region_; |
137 | strRep_ += ";" +postCode_; | 140 | strRep_ += ";" +postCode_; |
138 | strRep_ += ";" +countryName_; | 141 | strRep_ += ";" +countryName_; |
139 | } | 142 | } |
140 | 143 | ||