-rw-r--r-- | kabc/vcard/ContentLine.cpp | 10 | ||||
-rw-r--r-- | kabc/vcard/VCardv.cpp | 12 | ||||
-rw-r--r-- | kabc/vcard/include/VCardDefines.h | 3 |
3 files changed, 18 insertions, 7 deletions
diff --git a/kabc/vcard/ContentLine.cpp b/kabc/vcard/ContentLine.cpp index 0fb5b5d..f7e04a9 100644 --- a/kabc/vcard/ContentLine.cpp +++ b/kabc/vcard/ContentLine.cpp | |||
@@ -1,196 +1,202 @@ | |||
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) 1999 Rik Hemsley rik@kde.org | 4 | Copyright (C) 1999 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 <qcstring.h> | 24 | #include <qcstring.h> |
25 | #include <qstrlist.h> | 25 | #include <qstrlist.h> |
26 | #include <qregexp.h> | 26 | #include <qregexp.h> |
27 | 27 | ||
28 | #include <kdebug.h> | 28 | #include <kdebug.h> |
29 | 29 | ||
30 | #include <VCardAdrParam.h> | 30 | #include <VCardAdrParam.h> |
31 | #include <VCardAgentParam.h> | 31 | #include <VCardAgentParam.h> |
32 | #include <VCardDateParam.h> | 32 | #include <VCardDateParam.h> |
33 | #include <VCardEmailParam.h> | 33 | #include <VCardEmailParam.h> |
34 | #include <VCardImageParam.h> | 34 | #include <VCardImageParam.h> |
35 | #include <VCardSourceParam.h> | 35 | #include <VCardSourceParam.h> |
36 | #include <VCardTelParam.h> | 36 | #include <VCardTelParam.h> |
37 | #include <VCardTextBinParam.h> | 37 | #include <VCardTextBinParam.h> |
38 | #include <VCardTextParam.h> | 38 | #include <VCardTextParam.h> |
39 | 39 | ||
40 | #include <VCardAdrValue.h> | 40 | #include <VCardAdrValue.h> |
41 | #include <VCardAgentValue.h> | 41 | #include <VCardAgentValue.h> |
42 | #include <VCardDateValue.h> | 42 | #include <VCardDateValue.h> |
43 | #include <VCardImageValue.h> | 43 | #include <VCardImageValue.h> |
44 | #include <VCardTextValue.h> | 44 | #include <VCardTextValue.h> |
45 | #include <VCardTextBinValue.h> | 45 | #include <VCardTextBinValue.h> |
46 | #include <VCardLangValue.h> | 46 | #include <VCardLangValue.h> |
47 | #include <VCardNValue.h> | 47 | #include <VCardNValue.h> |
48 | #include <VCardURIValue.h> | 48 | #include <VCardURIValue.h> |
49 | #include <VCardSoundValue.h> | 49 | #include <VCardSoundValue.h> |
50 | #include <VCardClassValue.h> | 50 | #include <VCardClassValue.h> |
51 | #include <VCardFloatValue.h> | 51 | #include <VCardFloatValue.h> |
52 | #include <VCardOrgValue.h> | 52 | #include <VCardOrgValue.h> |
53 | #include <VCardTelValue.h> | 53 | #include <VCardTelValue.h> |
54 | #include <VCardTextListValue.h> | 54 | #include <VCardTextListValue.h> |
55 | #include <VCardUTCValue.h> | 55 | #include <VCardUTCValue.h> |
56 | #include <VCardGeoValue.h> | 56 | #include <VCardGeoValue.h> |
57 | 57 | ||
58 | #include <VCardRToken.h> | 58 | #include <VCardRToken.h> |
59 | #include <VCardContentLine.h> | 59 | #include <VCardContentLine.h> |
60 | 60 | ||
61 | #include <VCardEntity.h> | 61 | #include <VCardEntity.h> |
62 | #include <VCardEnum.h> | 62 | #include <VCardEnum.h> |
63 | #include <VCardDefines.h> | 63 | #include <VCardDefines.h> |
64 | 64 | ||
65 | using namespace VCARD; | 65 | using namespace VCARD; |
66 | 66 | ||
67 | ContentLine::ContentLine() | 67 | ContentLine::ContentLine() |
68 | :Entity(), | 68 | :Entity(), |
69 | value_(0) | 69 | value_(0), |
70 | paramType_( ParamUnknown ), | ||
71 | valueType_( ValueUnknown ), | ||
72 | entityType_( EntityUnknown ) | ||
70 | { | 73 | { |
71 | paramList_.setAutoDelete( TRUE ); | 74 | paramList_.setAutoDelete( TRUE ); |
72 | } | 75 | } |
73 | 76 | ||
74 | ContentLine::ContentLine(const ContentLine & x) | 77 | ContentLine::ContentLine(const ContentLine & x) |
75 | :Entity(x), | 78 | :Entity(x), |
76 | group_ (x.group_), | 79 | group_ (x.group_), |
77 | name_ (x.name_), | 80 | name_ (x.name_), |
78 | /*US paramList_(x.paramList_),*/ | 81 | /*US paramList_(x.paramList_),*/ |
79 | value_(x.value_->clone()), | 82 | value_(x.value_->clone()), |
80 | paramType_(x.paramType_), | 83 | paramType_(x.paramType_), |
81 | valueType_(x.valueType_), | 84 | valueType_(x.valueType_), |
82 | entityType_(x.entityType_) | 85 | entityType_(x.entityType_) |
83 | { | 86 | { |
84 | paramList_.setAutoDelete( TRUE ); | 87 | paramList_.setAutoDelete( TRUE ); |
85 | 88 | ||
86 | 89 | ||
87 | ParamListIterator it(x.paramList_); | 90 | ParamListIterator it(x.paramList_); |
88 | for (; it.current(); ++it) | 91 | for (; it.current(); ++it) |
89 | { | 92 | { |
90 | Param *p = new Param; | 93 | Param *p = new Param; |
91 | p->setName( it.current()->name() ); | 94 | p->setName( it.current()->name() ); |
92 | p->setValue( it.current()->value() ); | 95 | p->setValue( it.current()->value() ); |
93 | paramList_.append(p); | 96 | paramList_.append(p); |
94 | } | 97 | } |
95 | 98 | ||
96 | } | 99 | } |
97 | 100 | ||
98 | ContentLine::ContentLine(const QCString & s) | 101 | ContentLine::ContentLine(const QCString & s) |
99 | :Entity(s), | 102 | :Entity(s), |
100 | value_(0) | 103 | value_(0), |
104 | paramType_( ParamUnknown ), | ||
105 | valueType_( ValueUnknown ), | ||
106 | entityType_( EntityUnknown ) | ||
101 | { | 107 | { |
102 | paramList_.setAutoDelete( TRUE ); | 108 | paramList_.setAutoDelete( TRUE ); |
103 | } | 109 | } |
104 | 110 | ||
105 | ContentLine & | 111 | ContentLine & |
106 | ContentLine::operator = (ContentLine & x) | 112 | ContentLine::operator = (ContentLine & x) |
107 | { | 113 | { |
108 | if (*this == x) return *this; | 114 | if (*this == x) return *this; |
109 | 115 | ||
110 | ParamListIterator it(x.paramList_); | 116 | ParamListIterator it(x.paramList_); |
111 | for (; it.current(); ++it) | 117 | for (; it.current(); ++it) |
112 | { | 118 | { |
113 | Param *p = new Param; | 119 | Param *p = new Param; |
114 | p->setName( it.current()->name() ); | 120 | p->setName( it.current()->name() ); |
115 | p->setValue( it.current()->value() ); | 121 | p->setValue( it.current()->value() ); |
116 | paramList_.append(p); | 122 | paramList_.append(p); |
117 | } | 123 | } |
118 | 124 | ||
119 | value_ = x.value_->clone(); | 125 | value_ = x.value_->clone(); |
120 | 126 | ||
121 | Entity::operator = (x); | 127 | Entity::operator = (x); |
122 | return *this; | 128 | return *this; |
123 | } | 129 | } |
124 | 130 | ||
125 | ContentLine & | 131 | ContentLine & |
126 | ContentLine::operator = (const QCString & s) | 132 | ContentLine::operator = (const QCString & s) |
127 | { | 133 | { |
128 | Entity::operator = (s); | 134 | Entity::operator = (s); |
129 | delete value_; | 135 | delete value_; |
130 | value_ = 0; | 136 | value_ = 0; |
131 | return *this; | 137 | return *this; |
132 | } | 138 | } |
133 | 139 | ||
134 | bool | 140 | bool |
135 | ContentLine::operator == (ContentLine & x) | 141 | ContentLine::operator == (ContentLine & x) |
136 | { | 142 | { |
137 | x.parse(); | 143 | x.parse(); |
138 | 144 | ||
139 | QPtrListIterator<Param> it(x.paramList()); | 145 | QPtrListIterator<Param> it(x.paramList()); |
140 | 146 | ||
141 | if (!paramList_.find(it.current())) | 147 | if (!paramList_.find(it.current())) |
142 | return false; | 148 | return false; |
143 | 149 | ||
144 | return true; | 150 | return true; |
145 | } | 151 | } |
146 | 152 | ||
147 | ContentLine::~ContentLine() | 153 | ContentLine::~ContentLine() |
148 | { | 154 | { |
149 | delete value_; | 155 | delete value_; |
150 | value_ = 0; | 156 | value_ = 0; |
151 | } | 157 | } |
152 | 158 | ||
153 | void | 159 | void |
154 | ContentLine::_parse() | 160 | ContentLine::_parse() |
155 | { | 161 | { |
156 | vDebug("parse"); | 162 | vDebug("parse"); |
157 | 163 | ||
158 | // Unqote newlines | 164 | // Unqote newlines |
159 | strRep_ = strRep_.replace( QRegExp( "\\\\n" ), "\n" ); | 165 | strRep_ = strRep_.replace( QRegExp( "\\\\n" ), "\n" ); |
160 | 166 | ||
161 | int split = strRep_.find(':'); | 167 | int split = strRep_.find(':'); |
162 | 168 | ||
163 | if (split == -1) { // invalid content line | 169 | if (split == -1) { // invalid content line |
164 | vDebug("No ':'"); | 170 | vDebug("No ':'"); |
165 | return; | 171 | return; |
166 | } | 172 | } |
167 | 173 | ||
168 | QCString firstPart(strRep_.left(split)); | 174 | QCString firstPart(strRep_.left(split)); |
169 | QCString valuePart(strRep_.mid(split + 1)); | 175 | QCString valuePart(strRep_.mid(split + 1)); |
170 | 176 | ||
171 | split = firstPart.find('.'); | 177 | split = firstPart.find('.'); |
172 | 178 | ||
173 | if (split != -1) { | 179 | if (split != -1) { |
174 | group_ = firstPart.left(split); | 180 | group_ = firstPart.left(split); |
175 | firstPart= firstPart.mid(split + 1); | 181 | firstPart= firstPart.mid(split + 1); |
176 | } | 182 | } |
177 | 183 | ||
178 | vDebug("Group == " + group_); | 184 | vDebug("Group == " + group_); |
179 | vDebug("firstPart == " + firstPart); | 185 | vDebug("firstPart == " + firstPart); |
180 | vDebug("valuePart == " + valuePart); | 186 | vDebug("valuePart == " + valuePart); |
181 | 187 | ||
182 | // Now we have the group, the name and param list together and the value. | 188 | // Now we have the group, the name and param list together and the value. |
183 | 189 | ||
184 | QStrList l; | 190 | QStrList l; |
185 | 191 | ||
186 | RTokenise(firstPart, ";", l); | 192 | RTokenise(firstPart, ";", l); |
187 | 193 | ||
188 | if (l.count() == 0) {// invalid - no name ! | 194 | if (l.count() == 0) {// invalid - no name ! |
189 | vDebug("No name for this content line !"); | 195 | vDebug("No name for this content line !"); |
190 | return; | 196 | return; |
191 | } | 197 | } |
192 | 198 | ||
193 | name_ = l.at(0); | 199 | name_ = l.at(0); |
194 | 200 | ||
195 | // Now we have the name, so the rest of 'l' is the params. | 201 | // Now we have the name, so the rest of 'l' is the params. |
196 | // Remove the name part. | 202 | // Remove the name part. |
diff --git a/kabc/vcard/VCardv.cpp b/kabc/vcard/VCardv.cpp index 391a69e..d19a004 100644 --- a/kabc/vcard/VCardv.cpp +++ b/kabc/vcard/VCardv.cpp | |||
@@ -95,199 +95,203 @@ VCard::~VCard() | |||
95 | 95 | ||
96 | void | 96 | void |
97 | VCard::_parse() | 97 | VCard::_parse() |
98 | { | 98 | { |
99 | vDebug("parse() called"); | 99 | vDebug("parse() called"); |
100 | QStrList l; | 100 | QStrList l; |
101 | 101 | ||
102 | RTokenise(strRep_, "\r\n", l); | 102 | RTokenise(strRep_, "\r\n", l); |
103 | 103 | ||
104 | if (l.count() < 3) { // Invalid VCARD ! | 104 | if (l.count() < 3) { // Invalid VCARD ! |
105 | vDebug("Invalid vcard"); | 105 | vDebug("Invalid vcard"); |
106 | return; | 106 | return; |
107 | } | 107 | } |
108 | 108 | ||
109 | // Get the first line | 109 | // Get the first line |
110 | QCString beginLine = QCString(l.at(0)).stripWhiteSpace(); | 110 | QCString beginLine = QCString(l.at(0)).stripWhiteSpace(); |
111 | 111 | ||
112 | vDebug("Begin line == \"" + beginLine + "\""); | 112 | vDebug("Begin line == \"" + beginLine + "\""); |
113 | 113 | ||
114 | // Remove extra blank lines | 114 | // Remove extra blank lines |
115 | while (QCString(l.last()).isEmpty()) | 115 | while (QCString(l.last()).isEmpty()) |
116 | l.remove(l.last()); | 116 | l.remove(l.last()); |
117 | 117 | ||
118 | // Now we know this is the last line | 118 | // Now we know this is the last line |
119 | QCString endLine = l.last(); | 119 | QCString endLine = l.last(); |
120 | 120 | ||
121 | // Trash the first and last lines as we have seen them. | 121 | // Trash the first and last lines as we have seen them. |
122 | l.remove(0u); | 122 | l.remove(0u); |
123 | l.remove(l.last()); | 123 | l.remove(l.last()); |
124 | 124 | ||
125 | /////////////////////////////////////////////////////////////// | 125 | /////////////////////////////////////////////////////////////// |
126 | // FIRST LINE | 126 | // FIRST LINE |
127 | 127 | ||
128 | int split = beginLine.find(':'); | 128 | int split = beginLine.find(':'); |
129 | 129 | ||
130 | if (split == -1) { // invalid, no BEGIN | 130 | if (split == -1) { // invalid, no BEGIN |
131 | vDebug("No split"); | 131 | vDebug("No split"); |
132 | return; | 132 | return; |
133 | } | 133 | } |
134 | 134 | ||
135 | QCString firstPart(beginLine.left(split)); | 135 | QCString firstPart(beginLine.left(split)); |
136 | QCString valuePart(beginLine.mid(split + 1)); | 136 | QCString valuePart(beginLine.mid(split + 1)); |
137 | 137 | ||
138 | split = firstPart.find('.'); | 138 | split = firstPart.find('.'); |
139 | 139 | ||
140 | if (split != -1) { | 140 | if (split != -1) { |
141 | group_ = firstPart.left(split); | 141 | group_ = firstPart.left(split); |
142 | firstPart= firstPart.right(firstPart.length() - split - 1); | 142 | firstPart= firstPart.right(firstPart.length() - split - 1); |
143 | } | 143 | } |
144 | 144 | ||
145 | if (qstrnicmp(firstPart, "BEGIN", 5) != 0) { // No BEGIN ! | 145 | if (qstrnicmp(firstPart, "BEGIN", 5) != 0) { // No BEGIN ! |
146 | vDebug("No BEGIN"); | 146 | vDebug("No BEGIN"); |
147 | return; | 147 | return; |
148 | } | 148 | } |
149 | 149 | ||
150 | if (qstrnicmp(valuePart, "VCARD", 5) != 0) { // Not a vcard ! | 150 | if (qstrnicmp(valuePart, "VCARD", 5) != 0) { // Not a vcard ! |
151 | vDebug("No VCARD"); | 151 | vDebug("No VCARD"); |
152 | return; | 152 | return; |
153 | } | 153 | } |
154 | 154 | ||
155 | /////////////////////////////////////////////////////////////// | 155 | /////////////////////////////////////////////////////////////// |
156 | // CONTENT LINES | 156 | // CONTENT LINES |
157 | // | 157 | // |
158 | vDebug("Content lines"); | 158 | vDebug("Content lines"); |
159 | 159 | ||
160 | // Handle folded lines. | 160 | // Handle folded lines. |
161 | 161 | ||
162 | QStrList refolded; | 162 | QStrList refolded; |
163 | 163 | ||
164 | QStrListIterator it(l); | 164 | QStrListIterator it(l); |
165 | 165 | ||
166 | QCString cur; | 166 | QCString cur; |
167 | 167 | ||
168 | for (; it.current(); ++it) { | 168 | for (; it.current(); ++it) { |
169 | 169 | ||
170 | cur = it.current(); | 170 | cur = it.current(); |
171 | 171 | ||
172 | ++it; | 172 | ++it; |
173 | 173 | ||
174 | while ( | 174 | while ( |
175 | it.current() && | 175 | it.current() && |
176 | it.current()[0] == ' '&& | 176 | it.current()[0] == ' '&& |
177 | strlen(it.current()) != 1) | 177 | strlen(it.current()) != 1) |
178 | { | 178 | { |
179 | cur += it.current() + 1; | 179 | cur += it.current() + 1; |
180 | ++it; | 180 | ++it; |
181 | } | 181 | } |
182 | 182 | ||
183 | --it; | 183 | --it; |
184 | 184 | ||
185 | refolded.append(cur); | 185 | refolded.append(cur); |
186 | } | 186 | } |
187 | 187 | ||
188 | QStrListIterator it2(refolded); | 188 | QStrListIterator it2(refolded); |
189 | 189 | ||
190 | for (; it2.current(); ++it2) { | 190 | for (; it2.current(); ++it2) { |
191 | 191 | vDebug("New contentline using \"" + QCString(it2.current()) + "\""); | |
192 | vDebug("New contentline using \"" + QCString(it2.current()) + "\""); | ||
193 | ContentLine * cl = new ContentLine(it2.current()); | 192 | ContentLine * cl = new ContentLine(it2.current()); |
194 | 193 | ||
195 | cl->parse(); | 194 | cl->parse(); |
196 | 195 | if (cl->value() == 0) | |
197 | contentLineList_.append(cl); | 196 | { |
197 | qDebug("Content line could not be parsed. Discarded: %s" + QCString(it2.current())); | ||
198 | delete cl; | ||
199 | } | ||
200 | else | ||
201 | contentLineList_.append(cl); | ||
198 | } | 202 | } |
199 | 203 | ||
200 | /////////////////////////////////////////////////////////////// | 204 | /////////////////////////////////////////////////////////////// |
201 | // LAST LINE | 205 | // LAST LINE |
202 | 206 | ||
203 | split = endLine.find(':'); | 207 | split = endLine.find(':'); |
204 | 208 | ||
205 | if (split == -1) // invalid, no END | 209 | if (split == -1) // invalid, no END |
206 | return; | 210 | return; |
207 | 211 | ||
208 | firstPart = endLine.left(split); | 212 | firstPart = endLine.left(split); |
209 | valuePart = endLine.right(firstPart.length() - split - 1); | 213 | valuePart = endLine.right(firstPart.length() - split - 1); |
210 | 214 | ||
211 | split = firstPart.find('.'); | 215 | split = firstPart.find('.'); |
212 | 216 | ||
213 | if (split != -1) { | 217 | if (split != -1) { |
214 | group_ = firstPart.left(split); | 218 | group_ = firstPart.left(split); |
215 | firstPart= firstPart.right(firstPart.length() - split - 1); | 219 | firstPart= firstPart.right(firstPart.length() - split - 1); |
216 | } | 220 | } |
217 | 221 | ||
218 | if (qstricmp(firstPart, "END") != 0) // No END ! | 222 | if (qstricmp(firstPart, "END") != 0) // No END ! |
219 | return; | 223 | return; |
220 | 224 | ||
221 | if (qstricmp(valuePart, "VCARD") != 0) // Not a vcard ! | 225 | if (qstricmp(valuePart, "VCARD") != 0) // Not a vcard ! |
222 | return; | 226 | return; |
223 | } | 227 | } |
224 | 228 | ||
225 | void | 229 | void |
226 | VCard::_assemble() | 230 | VCard::_assemble() |
227 | { | 231 | { |
228 | vDebug("Assembling vcard"); | 232 | vDebug("Assembling vcard"); |
229 | strRep_ = "BEGIN:VCARD\r\n"; | 233 | strRep_ = "BEGIN:VCARD\r\n"; |
230 | strRep_ += "VERSION:3.0\r\n"; | 234 | strRep_ += "VERSION:3.0\r\n"; |
231 | 235 | ||
232 | QPtrListIterator<ContentLine> it(contentLineList_); | 236 | QPtrListIterator<ContentLine> it(contentLineList_); |
233 | 237 | ||
234 | for (; it.current(); ++it) | 238 | for (; it.current(); ++it) |
235 | strRep_ += it.current()->asString() + "\r\n"; | 239 | strRep_ += it.current()->asString() + "\r\n"; |
236 | 240 | ||
237 | strRep_ += "END:VCARD\r\n"; | 241 | strRep_ += "END:VCARD\r\n"; |
238 | } | 242 | } |
239 | 243 | ||
240 | bool | 244 | bool |
241 | VCard::has(EntityType t) | 245 | VCard::has(EntityType t) |
242 | { | 246 | { |
243 | parse(); | 247 | parse(); |
244 | return contentLine(t) == 0 ? false : true; | 248 | return contentLine(t) == 0 ? false : true; |
245 | } | 249 | } |
246 | 250 | ||
247 | bool | 251 | bool |
248 | VCard::has(const QCString & s) | 252 | VCard::has(const QCString & s) |
249 | { | 253 | { |
250 | parse(); | 254 | parse(); |
251 | return contentLine(s) == 0 ? false : true; | 255 | return contentLine(s) == 0 ? false : true; |
252 | } | 256 | } |
253 | 257 | ||
254 | void | 258 | void |
255 | VCard::add(const ContentLine & cl) | 259 | VCard::add(const ContentLine & cl) |
256 | { | 260 | { |
257 | parse(); | 261 | parse(); |
258 | ContentLine * c = new ContentLine(cl); | 262 | ContentLine * c = new ContentLine(cl); |
259 | contentLineList_.append(c); | 263 | contentLineList_.append(c); |
260 | } | 264 | } |
261 | 265 | ||
262 | void | 266 | void |
263 | VCard::add(const QCString & s) | 267 | VCard::add(const QCString & s) |
264 | { | 268 | { |
265 | parse(); | 269 | parse(); |
266 | ContentLine * c = new ContentLine(s); | 270 | ContentLine * c = new ContentLine(s); |
267 | contentLineList_.append(c); | 271 | contentLineList_.append(c); |
268 | } | 272 | } |
269 | 273 | ||
270 | ContentLine * | 274 | ContentLine * |
271 | VCard::contentLine(EntityType t) | 275 | VCard::contentLine(EntityType t) |
272 | { | 276 | { |
273 | parse(); | 277 | parse(); |
274 | QPtrListIterator<ContentLine> it(contentLineList_); | 278 | QPtrListIterator<ContentLine> it(contentLineList_); |
275 | 279 | ||
276 | for (; it.current(); ++it) | 280 | for (; it.current(); ++it) |
277 | if (it.current()->entityType() == t) | 281 | if (it.current()->entityType() == t) |
278 | return it.current(); | 282 | return it.current(); |
279 | 283 | ||
280 | return 0; | 284 | return 0; |
281 | } | 285 | } |
282 | 286 | ||
283 | ContentLine * | 287 | ContentLine * |
284 | VCard::contentLine(const QCString & s) | 288 | VCard::contentLine(const QCString & s) |
285 | { | 289 | { |
286 | parse(); | 290 | parse(); |
287 | QPtrListIterator<ContentLine> it(contentLineList_); | 291 | QPtrListIterator<ContentLine> it(contentLineList_); |
288 | 292 | ||
289 | for (; it.current(); ++it) | 293 | for (; it.current(); ++it) |
290 | if (it.current()->entityType() == EntityNameToEntityType(s)) | 294 | if (it.current()->entityType() == EntityNameToEntityType(s)) |
291 | return it.current(); | 295 | return it.current(); |
292 | 296 | ||
293 | return 0; | 297 | return 0; |
diff --git a/kabc/vcard/include/VCardDefines.h b/kabc/vcard/include/VCardDefines.h index dd38ae2..557410f 100644 --- a/kabc/vcard/include/VCardDefines.h +++ b/kabc/vcard/include/VCardDefines.h | |||
@@ -1,52 +1,53 @@ | |||
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 | #ifndef VCARD_DEFINES_H | 24 | #ifndef VCARD_DEFINES_H |
25 | #define VCARD_DEFINES_H | 25 | #define VCARD_DEFINES_H |
26 | 26 | ||
27 | #include <kdebug.h> | 27 | #include <kdebug.h> |
28 | 28 | ||
29 | #ifdef VCARD_DEBUG | 29 | #ifdef VCARD_DEBUG |
30 | #define vDebug(a) kdDebug(5710) << a << endl; | 30 | //US #define vDebug(a) kdDebug(5710) << a << endl; |
31 | #define vDebug(a) qDebug(a); | ||
31 | #else | 32 | #else |
32 | #define vDebug(a) | 33 | #define vDebug(a) |
33 | #endif | 34 | #endif |
34 | 35 | ||
35 | #if 0 | 36 | #if 0 |
36 | #ifndef NDEBUG | 37 | #ifndef NDEBUG |
37 | #include <qcstring.h> | 38 | #include <qcstring.h> |
38 | #include <iostream> | 39 | #include <iostream> |
39 | #ifdef __GNUG__ | 40 | #ifdef __GNUG__ |
40 | # define vDebug(a) cerr << className() << ":" << __FUNCTION__ << " (" \ | 41 | # define vDebug(a) cerr << className() << ":" << __FUNCTION__ << " (" \ |
41 | << __LINE__ << "): " << QCString((a)).data() << endl; | 42 | << __LINE__ << "): " << QCString((a)).data() << endl; |
42 | #else | 43 | #else |
43 | # define vDebug(a) cerr << className() << ": " \ | 44 | # define vDebug(a) cerr << className() << ": " \ |
44 | << QCString((a)).data() << endl; | 45 | << QCString((a)).data() << endl; |
45 | #endif | 46 | #endif |
46 | #else | 47 | #else |
47 | #define vDebug(a) | 48 | #define vDebug(a) |
48 | #endif | 49 | #endif |
49 | #endif | 50 | #endif |
50 | 51 | ||
51 | #endif // Included this file | 52 | #endif // Included this file |
52 | 53 | ||