summaryrefslogtreecommitdiffabout
path: root/kabc/vcard/Enum.cpp
Unidiff
Diffstat (limited to 'kabc/vcard/Enum.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--kabc/vcard/Enum.cpp8
1 files changed, 4 insertions, 4 deletions
diff --git a/kabc/vcard/Enum.cpp b/kabc/vcard/Enum.cpp
index cc48b5a..036324c 100644
--- a/kabc/vcard/Enum.cpp
+++ b/kabc/vcard/Enum.cpp
@@ -1,329 +1,329 @@
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 <qcstring.h> 24#include <q3cstring.h>
25#include <ctype.h> 25#include <ctype.h>
26 26
27#include <VCardEnum.h> 27#include <VCardEnum.h>
28 28
29using namespace VCARD; 29using namespace VCARD;
30 30
31// There are 31 possible types, not including extensions. 31// There are 31 possible types, not including extensions.
32 const QCString 32 const Q3CString
33VCARD::paramNames [] = 33VCARD::paramNames [] =
34{ 34{
35 "NAME", 35 "NAME",
36 "PROFILE", 36 "PROFILE",
37 "SOURCE", 37 "SOURCE",
38 "FN", 38 "FN",
39 "N", 39 "N",
40 "NICKNAME", 40 "NICKNAME",
41 "PHOTO", 41 "PHOTO",
42 "BDAY", 42 "BDAY",
43 "ADR", 43 "ADR",
44 "LABEL", 44 "LABEL",
45 "TEL", 45 "TEL",
46 "EMAIL", 46 "EMAIL",
47 "MAILER", 47 "MAILER",
48 "TZ", 48 "TZ",
49 "GEO", 49 "GEO",
50 "TITLE", 50 "TITLE",
51 "ROLE", 51 "ROLE",
52 "LOGO", 52 "LOGO",
53 "AGENT", 53 "AGENT",
54 "ORG", 54 "ORG",
55 "CATEGORIES", 55 "CATEGORIES",
56 "NOTE", 56 "NOTE",
57 "PRODID", 57 "PRODID",
58 "REV", 58 "REV",
59 "SORT-STRING", 59 "SORT-STRING",
60 "SOUND", 60 "SOUND",
61 "UID", 61 "UID",
62 "URL", 62 "URL",
63 "VERSION", 63 "VERSION",
64 "CLASS", 64 "CLASS",
65 "KEY" 65 "KEY"
66}; 66};
67 67
68 const ParamType 68 const ParamType
69VCARD::paramTypesTable[] = { 69VCARD::paramTypesTable[] = {
70 ParamNone, // NAME 70 ParamNone, // NAME
71 ParamNone, // PROFILE 71 ParamNone, // PROFILE
72 ParamSource, // SOURCE 72 ParamSource, // SOURCE
73 ParamText, // FN 73 ParamText, // FN
74 ParamText, // N 74 ParamText, // N
75 ParamText, // NICKNAME 75 ParamText, // NICKNAME
76 ParamImage, // PHOTO (inline/refer) 76 ParamImage, // PHOTO (inline/refer)
77 ParamDate, // BDAY ("VALUE = "date-time/date) 77 ParamDate, // BDAY ("VALUE = "date-time/date)
78 ParamAddrText, // ADR (adr-param/text-param) 78 ParamAddrText, // ADR (adr-param/text-param)
79 ParamAddrText, // LABEL (adr-param/text-param) 79 ParamAddrText, // LABEL (adr-param/text-param)
80 ParamTel, // TEL 80 ParamTel, // TEL
81 ParamEmail, // EMAIL 81 ParamEmail, // EMAIL
82 ParamText, // MAILER 82 ParamText, // MAILER
83 ParamNone, // TZ 83 ParamNone, // TZ
84 ParamNone, // GEO 84 ParamNone, // GEO
85 ParamText, // TITLE 85 ParamText, // TITLE
86 ParamText, // ROLE 86 ParamText, // ROLE
87 ParamImage, // LOGO 87 ParamImage, // LOGO
88 ParamAgent, // AGENT 88 ParamAgent, // AGENT
89 ParamText, // ORG 89 ParamText, // ORG
90 ParamText, // CATEGORIES 90 ParamText, // CATEGORIES
91 ParamText, // NOTE 91 ParamText, // NOTE
92 ParamNone, // PRODID 92 ParamNone, // PRODID
93 ParamDate, // REV 93 ParamDate, // REV
94 ParamText, // SORT-STRING 94 ParamText, // SORT-STRING
95 ParamSound, // SOUND 95 ParamSound, // SOUND
96 ParamNone, // UID 96 ParamNone, // UID
97 ParamNone, // URL 97 ParamNone, // URL
98 ParamNone, // VERSION 98 ParamNone, // VERSION
99 ParamNone, // CLASS 99 ParamNone, // CLASS
100 ParamTextBin, // KEY 100 ParamTextBin, // KEY
101 ParamTextNS // X 101 ParamTextNS // X
102}; 102};
103 103
104 ParamType 104 ParamType
105VCARD::EntityTypeToParamType(EntityType e) 105VCARD::EntityTypeToParamType(EntityType e)
106{ 106{
107 ParamType t(ParamUnknown); 107 ParamType t(ParamUnknown);
108 108
109 switch (e) { 109 switch (e) {
110 110
111 //---------------------------------------------------------------// 111 //---------------------------------------------------------------//
112 case EntityAgent: t = ParamAgent; break; 112 case EntityAgent: t = ParamAgent; break;
113 //---------------------------------------------------------------// 113 //---------------------------------------------------------------//
114 case EntitySound: t = ParamSound; break; 114 case EntitySound: t = ParamSound; break;
115 //---------------------------------------------------------------// 115 //---------------------------------------------------------------//
116 case EntitySource: t = ParamSource;break; 116 case EntitySource: t = ParamSource;break;
117 //---------------------------------------------------------------// 117 //---------------------------------------------------------------//
118 case EntityTelephone: t = ParamTel; break; 118 case EntityTelephone: t = ParamTel; break;
119 //---------------------------------------------------------------// 119 //---------------------------------------------------------------//
120 case EntityEmail: t = ParamEmail; break; 120 case EntityEmail: t = ParamEmail; break;
121 //---------------------------------------------------------------// 121 //---------------------------------------------------------------//
122 case EntityKey: t = ParamTextBin;break; 122 case EntityKey: t = ParamTextBin;break;
123 //---------------------------------------------------------------// 123 //---------------------------------------------------------------//
124 case EntityExtension: t = ParamTextNS;break; 124 case EntityExtension: t = ParamTextNS;break;
125 //---------------------------------------------------------------// 125 //---------------------------------------------------------------//
126 case EntityAddress: 126 case EntityAddress:
127 case EntityLabel: t = ParamAddrText;break; 127 case EntityLabel: t = ParamAddrText;break;
128 //---------------------------------------------------------------// 128 //---------------------------------------------------------------//
129 case EntityBirthday: 129 case EntityBirthday:
130 case EntityRevision: t = ParamDate; break; 130 case EntityRevision: t = ParamDate; break;
131 //---------------------------------------------------------------// 131 //---------------------------------------------------------------//
132 case EntityPhoto: 132 case EntityPhoto:
133 case EntityLogo: t = ParamImage; break; 133 case EntityLogo: t = ParamImage; break;
134 //---------------------------------------------------------------// 134 //---------------------------------------------------------------//
135 case EntityOrganisation: 135 case EntityOrganisation:
136 case EntityTitle: 136 case EntityTitle:
137 case EntityRole: 137 case EntityRole:
138 case EntityFullName: 138 case EntityFullName:
139 case EntityMailer: 139 case EntityMailer:
140 case EntityN: 140 case EntityN:
141 case EntitySortString: 141 case EntitySortString:
142 case EntityNickname: 142 case EntityNickname:
143 case EntityCategories: 143 case EntityCategories:
144 case EntityNote: t = ParamText; break; 144 case EntityNote: t = ParamText; break;
145 //---------------------------------------------------------------// 145 //---------------------------------------------------------------//
146 case EntityProductID: 146 case EntityProductID:
147 case EntityTimeZone: 147 case EntityTimeZone:
148 case EntityUID: 148 case EntityUID:
149 case EntityURL: 149 case EntityURL:
150 case EntityClass: 150 case EntityClass:
151 case EntityGeo: 151 case EntityGeo:
152 case EntityName: 152 case EntityName:
153 case EntityVersion: 153 case EntityVersion:
154 case EntityProfile: 154 case EntityProfile:
155 default: t = ParamNone; break; 155 default: t = ParamNone; break;
156 //---------------------------------------------------------------// 156 //---------------------------------------------------------------//
157 157
158 } 158 }
159 159
160 return t; 160 return t;
161} 161}
162 162
163 ValueType 163 ValueType
164VCARD::EntityTypeToValueType(EntityType e) 164VCARD::EntityTypeToValueType(EntityType e)
165{ 165{
166 ValueType t(ValueUnknown); 166 ValueType t(ValueUnknown);
167 167
168 switch (e) { 168 switch (e) {
169 169
170 //---------------------------------------------------------------// 170 //---------------------------------------------------------------//
171 case EntitySound: t = ValueSound; break; 171 case EntitySound: t = ValueSound; break;
172 //---------------------------------------------------------------// 172 //---------------------------------------------------------------//
173 case EntityAgent: t = ValueAgent; break; 173 case EntityAgent: t = ValueAgent; break;
174 //---------------------------------------------------------------// 174 //---------------------------------------------------------------//
175 case EntityAddress: t = ValueAddress;break; 175 case EntityAddress: t = ValueAddress;break;
176 //---------------------------------------------------------------// 176 //---------------------------------------------------------------//
177 case EntityTelephone: t = ValueTel; break; 177 case EntityTelephone: t = ValueTel; break;
178 //---------------------------------------------------------------// 178 //---------------------------------------------------------------//
179 case EntityKey: t = ValueTextBin;break; 179 case EntityKey: t = ValueTextBin;break;
180 //---------------------------------------------------------------// 180 //---------------------------------------------------------------//
181 case EntityOrganisation: t = ValueOrg; break; 181 case EntityOrganisation: t = ValueOrg; break;
182 //---------------------------------------------------------------// 182 //---------------------------------------------------------------//
183 case EntityN: t = ValueN; break; 183 case EntityN: t = ValueN; break;
184 //---------------------------------------------------------------// 184 //---------------------------------------------------------------//
185 case EntityTimeZone: t = ValueUTC; break; 185 case EntityTimeZone: t = ValueUTC; break;
186 //---------------------------------------------------------------// 186 //---------------------------------------------------------------//
187 case EntityClass: t = ValueClass; break; 187 case EntityClass: t = ValueClass; break;
188 //---------------------------------------------------------------// 188 //---------------------------------------------------------------//
189 case EntityGeo: t = ValueGeo; break; 189 case EntityGeo: t = ValueGeo; break;
190 //---------------------------------------------------------------// 190 //---------------------------------------------------------------//
191 case EntitySource: 191 case EntitySource:
192 case EntityURL: t = ValueURI; break; 192 case EntityURL: t = ValueURI; break;
193 //---------------------------------------------------------------// 193 //---------------------------------------------------------------//
194 case EntityPhoto: 194 case EntityPhoto:
195 case EntityLogo: t = ValueImage; break; 195 case EntityLogo: t = ValueImage; break;
196 //---------------------------------------------------------------// 196 //---------------------------------------------------------------//
197 case EntityBirthday: 197 case EntityBirthday:
198 case EntityRevision: t = ValueDate; break; 198 case EntityRevision: t = ValueDate; break;
199 //---------------------------------------------------------------// 199 //---------------------------------------------------------------//
200 case EntityCategories: 200 case EntityCategories:
201 case EntityNickname: t = ValueTextList;break; 201 case EntityNickname: t = ValueTextList;break;
202 //---------------------------------------------------------------// 202 //---------------------------------------------------------------//
203 case EntityLabel: 203 case EntityLabel:
204 case EntityExtension: 204 case EntityExtension:
205 case EntityEmail: 205 case EntityEmail:
206 case EntityTitle: 206 case EntityTitle:
207 case EntityRole: 207 case EntityRole:
208 case EntityFullName: 208 case EntityFullName:
209 case EntityMailer: 209 case EntityMailer:
210 case EntityProductID: 210 case EntityProductID:
211 case EntityName: 211 case EntityName:
212 case EntitySortString: 212 case EntitySortString:
213 case EntityVersion: 213 case EntityVersion:
214 case EntityProfile: 214 case EntityProfile:
215 case EntityUID: 215 case EntityUID:
216 case EntityNote: 216 case EntityNote:
217 default: t = ValueText; break; 217 default: t = ValueText; break;
218 //---------------------------------------------------------------// 218 //---------------------------------------------------------------//
219 219
220 } 220 }
221 221
222 return t; 222 return t;
223} 223}
224 224
225 QCString 225 Q3CString
226VCARD::EntityTypeToParamName(EntityType e) 226VCARD::EntityTypeToParamName(EntityType e)
227{ 227{
228 if ( e > EntityUnknown ) e = EntityUnknown; 228 if ( e > EntityUnknown ) e = EntityUnknown;
229 return paramNames[ int( e ) ]; 229 return paramNames[ int( e ) ];
230} 230}
231 231
232 EntityType 232 EntityType
233VCARD::EntityNameToEntityType(const QCString & s) 233VCARD::EntityNameToEntityType(const Q3CString & s)
234{ 234{
235 if (s.isEmpty()) return EntityUnknown; 235 if (s.isEmpty()) return EntityUnknown;
236 236
237 EntityType t(EntityUnknown); 237 EntityType t(EntityUnknown);
238 238
239 switch (s[0]) { 239 switch (s[0]) {
240 240
241 case 'A': 241 case 'A':
242 if (s == "ADR") 242 if (s == "ADR")
243 t = EntityAddress; 243 t = EntityAddress;
244 else if (s == "AGENT") 244 else if (s == "AGENT")
245 t = EntityAgent; 245 t = EntityAgent;
246 break; 246 break;
247 247
248 case 'B': 248 case 'B':
249 if (s == "BDAY") 249 if (s == "BDAY")
250 t = EntityBirthday; 250 t = EntityBirthday;
251 break; 251 break;
252 252
253 case 'C': 253 case 'C':
254 if (s == "CATEGORIES") 254 if (s == "CATEGORIES")
255 t = EntityCategories; 255 t = EntityCategories;
256 else if (s == "CLASS") 256 else if (s == "CLASS")
257 t = EntityClass; 257 t = EntityClass;
258 break; 258 break;
259 259
260 case 'E': 260 case 'E':
261 if (s == "EMAIL") 261 if (s == "EMAIL")
262 t = EntityEmail; 262 t = EntityEmail;
263 break; 263 break;
264 264
265 case 'F': 265 case 'F':
266 if (s == "FN") 266 if (s == "FN")
267 t = EntityFullName; 267 t = EntityFullName;
268 break; 268 break;
269 269
270 case 'G': 270 case 'G':
271 if (s == "GEO") 271 if (s == "GEO")
272 t = EntityGeo; 272 t = EntityGeo;
273 break; 273 break;
274 274
275 case 'K': 275 case 'K':
276 if (s == "KEY") 276 if (s == "KEY")
277 t = EntityKey; 277 t = EntityKey;
278 break; 278 break;
279 279
280 case 'L': 280 case 'L':
281 if (s == "LABEL") 281 if (s == "LABEL")
282 t = EntityLabel; 282 t = EntityLabel;
283 else if (s == "LOGO") 283 else if (s == "LOGO")
284 t = EntityLogo; 284 t = EntityLogo;
285 break; 285 break;
286 286
287 case 'M': 287 case 'M':
288 if (s == "MAILER") 288 if (s == "MAILER")
289 t = EntityMailer; 289 t = EntityMailer;
290 break; 290 break;
291 291
292 case 'N': 292 case 'N':
293 if (s == "N") 293 if (s == "N")
294 t = EntityN; 294 t = EntityN;
295 else if (s == "NAME") 295 else if (s == "NAME")
296 t = EntityName; 296 t = EntityName;
297 else if (s == "NICKNAME") 297 else if (s == "NICKNAME")
298 t = EntityNickname; 298 t = EntityNickname;
299 else if (s == "NOTE") 299 else if (s == "NOTE")
300 t = EntityNote; 300 t = EntityNote;
301 break; 301 break;
302 302
303 case 'O': 303 case 'O':
304 if (s == "ORG") 304 if (s == "ORG")
305 t = EntityOrganisation; 305 t = EntityOrganisation;
306 break; 306 break;
307 307
308 case 'P': 308 case 'P':
309 if (s == "PHOTO") 309 if (s == "PHOTO")
310 t = EntityPhoto; 310 t = EntityPhoto;
311 else if (s == "PRODID") 311 else if (s == "PRODID")
312 t = EntityProductID; 312 t = EntityProductID;
313 else if (s == "PROFILE") 313 else if (s == "PROFILE")
314 t = EntityProfile; 314 t = EntityProfile;
315 break; 315 break;
316 316
317 case 'R': 317 case 'R':
318 if (s == "REV") 318 if (s == "REV")
319 t = EntityRevision; 319 t = EntityRevision;
320 else if (s == "ROLE") 320 else if (s == "ROLE")
321 t = EntityRole; 321 t = EntityRole;
322 break; 322 break;
323 323
324 case 'S': 324 case 'S':
325 if (s == "SORT-STRING") 325 if (s == "SORT-STRING")
326 t = EntitySortString; 326 t = EntitySortString;
327 else if (s == "SOUND") 327 else if (s == "SOUND")
328 t = EntitySound; 328 t = EntitySound;
329 else if (s == "SOURCE") 329 else if (s == "SOURCE")