-rw-r--r-- | kabc/vcard/SourceParam.cpp | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/kabc/vcard/SourceParam.cpp b/kabc/vcard/SourceParam.cpp index cd51cbd..8f02113 100644 --- a/kabc/vcard/SourceParam.cpp +++ b/kabc/vcard/SourceParam.cpp | |||
@@ -1,111 +1,113 @@ | |||
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 <VCardSourceParam.h> | 24 | #include <VCardSourceParam.h> |
25 | 25 | ||
26 | #include <VCardParam.h> | 26 | #include <VCardParam.h> |
27 | //Added by qt3to4: | ||
28 | #include <Q3CString> | ||
27 | 29 | ||
28 | using namespace VCARD; | 30 | using namespace VCARD; |
29 | 31 | ||
30 | SourceParam::SourceParam() | 32 | SourceParam::SourceParam() |
31 | :Param(), | 33 | :Param(), |
32 | type_(SourceParam::TypeUnknown) | 34 | type_(SourceParam::TypeUnknown) |
33 | { | 35 | { |
34 | } | 36 | } |
35 | 37 | ||
36 | SourceParam::SourceParam(const SourceParam & x) | 38 | SourceParam::SourceParam(const SourceParam & x) |
37 | :Param(x), | 39 | :Param(x), |
38 | type_(x.type_), | 40 | type_(x.type_), |
39 | par_(x.par_), | 41 | par_(x.par_), |
40 | val_(x.val_) | 42 | val_(x.val_) |
41 | { | 43 | { |
42 | } | 44 | } |
43 | 45 | ||
44 | SourceParam::SourceParam(const QCString & s) | 46 | SourceParam::SourceParam(const Q3CString & s) |
45 | :Param(s), | 47 | :Param(s), |
46 | type_(SourceParam::TypeUnknown) | 48 | type_(SourceParam::TypeUnknown) |
47 | { | 49 | { |
48 | } | 50 | } |
49 | 51 | ||
50 | SourceParam & | 52 | SourceParam & |
51 | SourceParam::operator = (SourceParam & x) | 53 | SourceParam::operator = (SourceParam & x) |
52 | { | 54 | { |
53 | if (*this == x) return *this; | 55 | if (*this == x) return *this; |
54 | type_= x.type(); | 56 | type_= x.type(); |
55 | par_= x.par(); | 57 | par_= x.par(); |
56 | val_= x.val(); | 58 | val_= x.val(); |
57 | 59 | ||
58 | Param::operator = (x); | 60 | Param::operator = (x); |
59 | return *this; | 61 | return *this; |
60 | } | 62 | } |
61 | 63 | ||
62 | SourceParam & | 64 | SourceParam & |
63 | SourceParam::operator = (const QCString & s) | 65 | SourceParam::operator = (const Q3CString & s) |
64 | { | 66 | { |
65 | Param::operator = (s); | 67 | Param::operator = (s); |
66 | return *this; | 68 | return *this; |
67 | } | 69 | } |
68 | 70 | ||
69 | bool | 71 | bool |
70 | SourceParam::operator == (SourceParam & x) | 72 | SourceParam::operator == (SourceParam & x) |
71 | { | 73 | { |
72 | x.parse(); | 74 | x.parse(); |
73 | return false; | 75 | return false; |
74 | } | 76 | } |
75 | 77 | ||
76 | SourceParam::~SourceParam() | 78 | SourceParam::~SourceParam() |
77 | { | 79 | { |
78 | } | 80 | } |
79 | 81 | ||
80 | void | 82 | void |
81 | SourceParam::_parse() | 83 | SourceParam::_parse() |
82 | { | 84 | { |
83 | int i = strRep_.find('='); | 85 | int i = strRep_.find('='); |
84 | if (i == -1) // Invalid | 86 | if (i == -1) // Invalid |
85 | return; | 87 | return; |
86 | 88 | ||
87 | par_ = strRep_.left(i); | 89 | par_ = strRep_.left(i); |
88 | val_ = strRep_.right(strRep_.length() - i - 1); | 90 | val_ = strRep_.right(strRep_.length() - i - 1); |
89 | 91 | ||
90 | if (qstricmp(par_, "VALUE") == 0 && qstricmp(val_, "uri") == 0) | 92 | if (qstricmp(par_, "VALUE") == 0 && qstricmp(val_, "uri") == 0) |
91 | type_ = TypeValue; | 93 | type_ = TypeValue; |
92 | else if (qstricmp(par_, "CONTEXT") == 0 && qstricmp(val_, "word") == 0) | 94 | else if (qstricmp(par_, "CONTEXT") == 0 && qstricmp(val_, "word") == 0) |
93 | type_ = TypeContext; | 95 | type_ = TypeContext; |
94 | else if (qstrnicmp(par_, "X-", 2) == 0) { | 96 | else if (qstrnicmp(par_, "X-", 2) == 0) { |
95 | type_ = TypeX; | 97 | type_ = TypeX; |
96 | } | 98 | } |
97 | else type_ = TypeUnknown; | 99 | else type_ = TypeUnknown; |
98 | 100 | ||
99 | } | 101 | } |
100 | 102 | ||
101 | void | 103 | void |
102 | SourceParam::_assemble() | 104 | SourceParam::_assemble() |
103 | { | 105 | { |
104 | if (type_ == TypeValue) | 106 | if (type_ == TypeValue) |
105 | strRep_ = "VALUE=uri"; | 107 | strRep_ = "VALUE=uri"; |
106 | else if (type_ == TypeContext) | 108 | else if (type_ == TypeContext) |
107 | strRep_ = "CONTEXT=word"; | 109 | strRep_ = "CONTEXT=word"; |
108 | else if (type_ == TypeX) | 110 | else if (type_ == TypeX) |
109 | strRep_ = par_ + "=" + val_; | 111 | strRep_ = par_ + "=" + val_; |
110 | else strRep_ = ""; | 112 | else strRep_ = ""; |
111 | } | 113 | } |