author | Michael Krelin <hacker@klever.net> | 2007-07-04 11:23:42 (UTC) |
---|---|---|
committer | Michael Krelin <hacker@klever.net> | 2007-07-04 11:23:42 (UTC) |
commit | a08aff328d4393031d5ba7d622c2b05705a89d73 (patch) (unidiff) | |
tree | 8ee90d686081c52e7c69b5ce946e9b1a7d690001 /kabc/vcard/AdrParam.cpp | |
parent | 11edc920afe4f274c0964436633aa632c8288a40 (diff) | |
download | kdepimpi-p1.zip kdepimpi-p1.tar.gz kdepimpi-p1.tar.bz2 |
initial public commit of qt4 portp1
-rw-r--r-- | kabc/vcard/AdrParam.cpp | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/kabc/vcard/AdrParam.cpp b/kabc/vcard/AdrParam.cpp index fa46499..33d358c 100644 --- a/kabc/vcard/AdrParam.cpp +++ b/kabc/vcard/AdrParam.cpp | |||
@@ -3,124 +3,126 @@ | |||
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 <VCardAdrParam.h> | 25 | #include <VCardAdrParam.h> |
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 | AdrParam::AdrParam() | 32 | AdrParam::AdrParam() |
31 | :Param() | 33 | :Param() |
32 | { | 34 | { |
33 | } | 35 | } |
34 | 36 | ||
35 | AdrParam::AdrParam(const AdrParam & x) | 37 | AdrParam::AdrParam(const AdrParam & x) |
36 | :Param(x), | 38 | :Param(x), |
37 | adrTypeList_(x.adrTypeList_) | 39 | adrTypeList_(x.adrTypeList_) |
38 | { | 40 | { |
39 | } | 41 | } |
40 | 42 | ||
41 | AdrParam::AdrParam(const QCString & s) | 43 | AdrParam::AdrParam(const Q3CString & s) |
42 | :Param(s) | 44 | :Param(s) |
43 | { | 45 | { |
44 | } | 46 | } |
45 | 47 | ||
46 | AdrParam & | 48 | AdrParam & |
47 | AdrParam::operator = (AdrParam & x) | 49 | AdrParam::operator = (AdrParam & x) |
48 | { | 50 | { |
49 | if (*this == x) return *this; | 51 | if (*this == x) return *this; |
50 | 52 | ||
51 | adrTypeList_= x.adrTypeList(); | 53 | adrTypeList_= x.adrTypeList(); |
52 | textParam_ = x.textParam(); | 54 | textParam_ = x.textParam(); |
53 | 55 | ||
54 | Param::operator = (x); | 56 | Param::operator = (x); |
55 | return *this; | 57 | return *this; |
56 | } | 58 | } |
57 | 59 | ||
58 | AdrParam & | 60 | AdrParam & |
59 | AdrParam::operator = (const QCString & s) | 61 | AdrParam::operator = (const Q3CString & s) |
60 | { | 62 | { |
61 | Param::operator = (s); | 63 | Param::operator = (s); |
62 | 64 | ||
63 | adrTypeList_.clear(); | 65 | adrTypeList_.clear(); |
64 | textParam_.truncate(0); | 66 | textParam_.truncate(0); |
65 | 67 | ||
66 | return *this; | 68 | return *this; |
67 | } | 69 | } |
68 | 70 | ||
69 | bool | 71 | bool |
70 | AdrParam::operator == (AdrParam & x) | 72 | AdrParam::operator == (AdrParam & x) |
71 | { | 73 | { |
72 | parse(); | 74 | parse(); |
73 | 75 | ||
74 | if (!x.textParam().isEmpty()) | 76 | if (!x.textParam().isEmpty()) |
75 | return (x.textParam_ == textParam_); | 77 | return (x.textParam_ == textParam_); |
76 | 78 | ||
77 | if (x.adrTypeList().count() != adrTypeList_.count()) | 79 | if (x.adrTypeList().count() != adrTypeList_.count()) |
78 | return false; | 80 | return false; |
79 | 81 | ||
80 | QStrListIterator it(x.adrTypeList_); | 82 | Q3StrListIterator it(x.adrTypeList_); |
81 | 83 | ||
82 | for (; it.current(); ++it) | 84 | for (; it.current(); ++it) |
83 | if (!adrTypeList_.find(it.current())) | 85 | if (!adrTypeList_.find(it.current())) |
84 | return false; | 86 | return false; |
85 | 87 | ||
86 | return true; | 88 | return true; |
87 | } | 89 | } |
88 | 90 | ||
89 | AdrParam::~AdrParam() | 91 | AdrParam::~AdrParam() |
90 | { | 92 | { |
91 | } | 93 | } |
92 | 94 | ||
93 | void | 95 | void |
94 | AdrParam::_parse() | 96 | AdrParam::_parse() |
95 | { | 97 | { |
96 | adrTypeList_.clear(); | 98 | adrTypeList_.clear(); |
97 | 99 | ||
98 | if (strRep_.left(4) != "TYPE") { | 100 | if (strRep_.left(4) != "TYPE") { |
99 | textParam_ = strRep_; | 101 | textParam_ = strRep_; |
100 | return; | 102 | return; |
101 | } | 103 | } |
102 | 104 | ||
103 | if (!strRep_.contains('=')) | 105 | if (!strRep_.contains('=')) |
104 | return; | 106 | return; |
105 | 107 | ||
106 | RTokenise(strRep_, ",", adrTypeList_); | 108 | RTokenise(strRep_, ",", adrTypeList_); |
107 | } | 109 | } |
108 | 110 | ||
109 | void | 111 | void |
110 | AdrParam::_assemble() | 112 | AdrParam::_assemble() |
111 | { | 113 | { |
112 | if (!textParam_.isEmpty()) { | 114 | if (!textParam_.isEmpty()) { |
113 | strRep_ = textParam_; | 115 | strRep_ = textParam_; |
114 | return; | 116 | return; |
115 | } | 117 | } |
116 | 118 | ||
117 | QStrListIterator it(adrTypeList_); | 119 | Q3StrListIterator it(adrTypeList_); |
118 | 120 | ||
119 | for (; it.current(); ++it) { | 121 | for (; it.current(); ++it) { |
120 | 122 | ||
121 | strRep_ += it.current(); | 123 | strRep_ += it.current(); |
122 | 124 | ||
123 | if (it.current() != adrTypeList_.last()) | 125 | if (it.current() != adrTypeList_.last()) |
124 | strRep_ += ','; | 126 | strRep_ += ','; |
125 | } | 127 | } |
126 | } | 128 | } |